-
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: implement count API for MWL item
- Loading branch information
1 parent
fa81ba6
commit 188b10d
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
api-sql/dicom-web/controller/MWL-RS/service/count-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,27 @@ | ||
const { MwlItemModel } = require("@models/sql/models/mwlItems.model"); | ||
const { GetMwlItemCountService } = require("@root/api/dicom-web/controller/MWL-RS/service/count-mwlItem.service"); | ||
const { convertAllQueryToDicomTag } = require("@root/api/dicom-web/service/base-query.service"); | ||
const { cloneDeep } = require("lodash"); | ||
|
||
class SqlGetMwlItemCountService extends GetMwlItemCountService{ | ||
constructor(req, res) { | ||
super(req, res); | ||
} | ||
|
||
async getMwlItemCount() { | ||
return await MwlItemModel.getCount(this.query); | ||
} | ||
|
||
initQuery_() { | ||
let query = cloneDeep(this.request.query); | ||
let queryKeys = Object.keys(query).sort(); | ||
for (let i = 0; i < queryKeys.length; i++) { | ||
let queryKey = queryKeys[i]; | ||
if (!query[queryKey]) delete query[queryKey]; | ||
} | ||
|
||
this.query = convertAllQueryToDicomTag(query, false); | ||
} | ||
} | ||
|
||
module.exports.GetMwlItemCountService = SqlGetMwlItemCountService; |
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