-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mongodb): implement MWL delete API
- Loading branch information
1 parent
3e022d1
commit 4c2c0bf
Showing
7 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const { ApiErrorArrayHandler } = require("@error/api-errors.handler"); | ||
const { Controller } = require("@root/api/controller.class"); | ||
const { ApiLogger } = require("@root/utils/logs/api-logger"); | ||
const { DeleteMwlItemService } = require("./service/delete-mwlItem.service"); | ||
|
||
class DeleteMwlItemCountController extends Controller { | ||
constructor(req, res) { | ||
super(req, res); | ||
this.apiLogger = new ApiLogger(this.request, "MWL-RS"); | ||
} | ||
|
||
async mainProcess() { | ||
try { | ||
let deleteMwlItemService = new DeleteMwlItemService(this.request, this.response); | ||
await deleteMwlItemService.deleteMwlItem(); | ||
|
||
return this.response | ||
.set("Content-Type", "application/dicom+json") | ||
.status(200) | ||
.send(); | ||
|
||
} catch (e) { | ||
let apiErrorArrayHandler = new ApiErrorArrayHandler(this.response, this.apiLogger, e); | ||
return apiErrorArrayHandler.doErrorResponse(); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param {import('express').Request} req | ||
* @param {import('express').Response} res | ||
*/ | ||
module.exports = async function (req, res) { | ||
let controller = new DeleteMwlItemCountController(req, res); | ||
|
||
await controller.doPipeline(); | ||
}; |
22 changes: 22 additions & 0 deletions
22
api/dicom-web/controller/MWL-RS/service/delete-mwlItem.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const { DicomWebServiceError, DicomWebStatusCodes } = require("@error/dicom-web-service"); | ||
const { MwlItemModel } = require("@models/mongodb/models/mwlitems.model"); | ||
|
||
class DeleteMwlItemService { | ||
constructor(req, res) { | ||
/** @type { import("express").Request } */ | ||
this.request = req; | ||
/** @type { import("express").Response } */ | ||
this.response = res; | ||
} | ||
|
||
async deleteMwlItem() { | ||
const { studyUID, spsID } = this.request.params; | ||
let { deletedCount } = await MwlItemModel.deleteByStudyInstanceUIDAndSpsID(studyUID, spsID); | ||
|
||
if (!deletedCount) { | ||
throw new DicomWebServiceError(DicomWebStatusCodes.NoSuchSOPInstance, "Modality Worklist Item not found.", 404); | ||
} | ||
} | ||
} | ||
|
||
module.exports.DeleteMwlItemService = DeleteMwlItemService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
components: | ||
parameters: | ||
spsID: | ||
in: path | ||
name: spsID | ||
required: true | ||
schema: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters