get protocol item
This commit is contained in:
parent
72fb6fbc20
commit
5c4e521bd8
10 changed files with 155 additions and 3 deletions
22
src/controller/admin/protocolController.ts
Normal file
22
src/controller/admin/protocolController.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { Request, Response } from "express";
|
||||
import ProtocolService from "../../service/protocolService";
|
||||
import ProtocolFactory from "../../factory/admin/protocol";
|
||||
|
||||
/**
|
||||
* @description get all protocols
|
||||
* @param req {Request} Express req object
|
||||
* @param res {Response} Express res object
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
export async function getAllProtocols(req: Request, res: Response): Promise<any> {
|
||||
let offset = parseInt((req.query.offset as string) ?? "0");
|
||||
let count = parseInt((req.query.count as string) ?? "25");
|
||||
let [protocols, total] = await ProtocolService.getAll(offset, count);
|
||||
|
||||
res.json({
|
||||
protocols: ProtocolFactory.mapToBase(protocols),
|
||||
total: total,
|
||||
offset: offset,
|
||||
count: count,
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue