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:
2025-03-02 16:39:37 +00:00
committed by GitHub
parent 032cd4665f
commit 8f1dc5cb61
19 changed files with 454 additions and 654 deletions

View File

@@ -1,7 +1,5 @@
export class Certificate {
partitionKey: string;
rowKey: string;
type: string;
issueDate: Date;
number?: string;
issueDate: string;
number: string;
}

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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;
}