Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/controllers/certificate.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ class CertificateController implements BaseController {
businessName: myProfessional?.businessName,
cuil: myProfessional?.cuil,
enrollment: myProfessional?.enrollment,
profesionGrado: myProfessional?.profesionGrado?.length ? myProfessional.profesionGrado.map((pg: any) => ({
profesion: pg.profesion,
codigoProfesion: pg.codigoProfesion,
numeroMatricula: pg.numeroMatricula
})) : [],
},
certificate,
startDate,
Expand Down
8 changes: 7 additions & 1 deletion src/controllers/practice.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PracticeController {
});
}

if (patient?.os.nombre) {
if (patient?.os?.nombre) {
patient.os.otraOS = patient.otraOS || false;
myPatient.obraSocial = patient.os;
}
Expand All @@ -49,6 +49,11 @@ class PracticeController {
businessName: myProfessional?.businessName,
cuil: myProfessional?.cuil,
enrollment: myProfessional?.enrollment,
profesionGrado: myProfessional?.profesionGrado?.length ? myProfessional.profesionGrado.map((pg: any) => ({
profesion: pg.profesion,
codigoProfesion: pg.codigoProfesion,
numeroMatricula: pg.numeroMatricula
})) : [],
},
practice,
indications,
Expand All @@ -59,6 +64,7 @@ class PracticeController {

return res.status(httpCodes.CREATED).json([savedPractice]);
} catch (error) {
console.error('Error interno del servidor al crear la práctica:', error);
return res.status(httpCodes.INTERNAL_SERVER_ERROR).json('Error interno del servidor al crear la práctica');
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/certificate.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ export default interface ICertificate extends Document {
enrollment: string,
cuil: string,
businessName: string,
profesionGrado?: {
profesion: string;
codigoProfesion: string;
numeroMatricula: string;
}[];
};
certificate: string;
status?: string;
Expand Down
5 changes: 5 additions & 0 deletions src/interfaces/practice.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export default interface IPractice extends Document {
enrollment: string;
cuil: string;
businessName: string;
profesionGrado?: {
profesion: string;
codigoProfesion: string;
numeroMatricula: string;
}[];
};
practice: string;
diagnostic: string;
Expand Down
14 changes: 14 additions & 0 deletions src/models/certificate.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ const certificateSchema = new Schema({
businessName: { type: String, required: true },
cuil: { type: String },
enrollment: { type: String },
profesionGrado: [{
profesion: {
type: String,
required: true
},
codigoProfesion: {
type: String,
required: true
},
numeroMatricula: {
type: String,
required: true
},
}]
},
certificate: { type: String },
startDate: { type: Date, required: true },
Expand Down
25 changes: 18 additions & 7 deletions src/models/practice.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,28 @@ const practiceSchema: Schema = new Schema({
required: true
},
enrollment: {
type: String,
required: true
type: String
},
cuil: {
type: String,
required: true
type: String
},
businessName: {
type: String,
required: true
}
type: String
},
profesionGrado: [{
profesion: {
type: String,
required: true
},
codigoProfesion: {
type: String,
required: true
},
numeroMatricula: {
type: String,
required: true
},
}]
},
practice: {
type: String,
Expand Down
Loading