adding certificates to pilot form (#57)
* adding certificates to pilot form * adding certificates to pilot form
This commit was merged in pull request #57.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
export class Certificate {
|
||||
partitionKey: string;
|
||||
rowKey: string;
|
||||
type: string;
|
||||
issueDate: Date;
|
||||
number?: string;
|
||||
issueDate: string;
|
||||
number: string;
|
||||
}
|
||||
|
||||
@@ -51,9 +51,23 @@ export class PilotController {
|
||||
@Post()
|
||||
async create(@Body() pilotDto: PilotDto) {
|
||||
try {
|
||||
const pilot = new Pilot();
|
||||
|
||||
Object.assign(pilot, pilotDto);
|
||||
let pilot = new Pilot();
|
||||
|
||||
pilot = {
|
||||
partitionKey: pilotDto.partitionKey,
|
||||
rowKey: pilotDto.rowKey,
|
||||
id: pilotDto.id,
|
||||
name: pilotDto.name,
|
||||
address: pilotDto.address,
|
||||
city: pilotDto.city,
|
||||
state: pilotDto.state,
|
||||
postalCode: pilotDto.postalCode,
|
||||
email: pilotDto.email,
|
||||
phone: pilotDto.phone,
|
||||
medicalClass: pilotDto.medicalClass,
|
||||
medicalExpiration: pilotDto.medicalExpiration,
|
||||
certificates: JSON.stringify(pilotDto.certificates)
|
||||
}
|
||||
|
||||
return await this.pilotService.create(pilot);
|
||||
} catch (error) {
|
||||
@@ -70,9 +84,23 @@ export class PilotController {
|
||||
@Body() pilotDto: PilotDto
|
||||
) {
|
||||
try {
|
||||
const pilot = new Pilot();
|
||||
let pilot = new Pilot();
|
||||
|
||||
Object.assign(pilot, pilotDto);
|
||||
pilot = {
|
||||
partitionKey: pilotDto.partitionKey,
|
||||
rowKey: pilotDto.rowKey,
|
||||
id: pilotDto.id,
|
||||
name: pilotDto.name,
|
||||
address: pilotDto.address,
|
||||
city: pilotDto.city,
|
||||
state: pilotDto.state,
|
||||
postalCode: pilotDto.postalCode,
|
||||
email: pilotDto.email,
|
||||
phone: pilotDto.phone,
|
||||
medicalClass: pilotDto.medicalClass,
|
||||
medicalExpiration: pilotDto.medicalExpiration,
|
||||
certificates: JSON.stringify(pilotDto.certificates)
|
||||
}
|
||||
|
||||
return await this.pilotService.update(partitionKey, rowKey, pilot);
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { Certificate } from "./certificate/certificate.entity";
|
||||
|
||||
export class PilotDto {
|
||||
partitionKey: string;
|
||||
rowKey: string;
|
||||
@@ -9,4 +11,7 @@ export class PilotDto {
|
||||
postalCode: string;
|
||||
email?: string;
|
||||
phone?: string;
|
||||
medicalClass?: string;
|
||||
medicalExpiration?: string;
|
||||
certificates: Certificate;
|
||||
}
|
||||
|
||||
@@ -11,4 +11,7 @@ export class Pilot {
|
||||
@EntityString() postalCode?: string;
|
||||
@EntityString() email?: string;
|
||||
@EntityString() phone?: string;
|
||||
@EntityString() medicalClass?: string;
|
||||
@EntityString() medicalExpiration: string;
|
||||
@EntityString() certificates: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user