Skip to content

Commit

Permalink
feat: add findOneByPatientID to wrap mongoose findOne method
Browse files Browse the repository at this point in the history
  • Loading branch information
Chinlinlee committed Jan 22, 2024
1 parent c212fd0 commit a731375
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DeletePatientService {

async delete() {
let { patientID } = this.request.params;
let patient = await PatientModel.findOne({ patientID});
let patient = await PatientModel.findOneByPatientID(patientID);
if (!patient) {
throw new DicomWebServiceError(
DicomWebStatusCodes.NoSuchObjectInstance,
Expand Down
5 changes: 5 additions & 0 deletions models/mongodb/models/patient.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ let patientSchemaOptions = _.merge(

return patient;
},
findOneByPatientID: async function(patientID) {
return await mongoose.model("patient").findOne({
patientID
});
},
/**
*
* @param {string} patientID
Expand Down

0 comments on commit a731375

Please sign in to comment.