update: add option for order pharmacy
This commit is contained in:
@ -75,7 +75,14 @@ export class ItemMasterController {
|
|||||||
#swagger.security = [{ "bearerAuth": [] }]
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
const query = await ItemMasterModel.list(); // ← hapus await disini, karena list() return QueryBuilder
|
const query = await ItemMasterModel.list();
|
||||||
|
|
||||||
|
query.select([
|
||||||
|
"item_master.item_name",
|
||||||
|
"unit.large_unit",
|
||||||
|
"unit.small_unit",
|
||||||
|
"item_master.pack_size",
|
||||||
|
]);
|
||||||
|
|
||||||
const total_count_data = await query.getCount();
|
const total_count_data = await query.getCount();
|
||||||
const list_data = await query.getMany();
|
const list_data = await query.getMany();
|
||||||
|
|||||||
@ -68,6 +68,31 @@ export class ItemOriginController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async option(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Pharmacy - ItemOrigin']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const query = await ItemOriginModel.list();
|
||||||
|
|
||||||
|
query.select([
|
||||||
|
"item_origin.id",
|
||||||
|
"item_origin.origin_name",
|
||||||
|
]);
|
||||||
|
|
||||||
|
const total_count_data = await query.getCount();
|
||||||
|
const list_data = await query.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, 1, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Pharmacy - ItemOrigin']
|
#swagger.tags = ['Pharmacy - ItemOrigin']
|
||||||
|
|||||||
@ -68,6 +68,31 @@ export class SupplierController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async option(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Pharmacy - Supplier']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const query = await SupplierModel.list();
|
||||||
|
|
||||||
|
query.select([
|
||||||
|
"supplier.id",
|
||||||
|
"supplier.supplier_name",
|
||||||
|
]);
|
||||||
|
|
||||||
|
const total_count_data = await query.getCount();
|
||||||
|
const list_data = await query.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, 1, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Pharmacy - Supplier']
|
#swagger.tags = ['Pharmacy - Supplier']
|
||||||
|
|||||||
@ -86,6 +86,31 @@ export class RoomController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async option(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Room']
|
||||||
|
#swagger.security = [{ "bearerAuth": [] }]
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const query = await RoomModel.list();
|
||||||
|
|
||||||
|
query.select([
|
||||||
|
"Room.id",
|
||||||
|
"Room.room",
|
||||||
|
]);
|
||||||
|
|
||||||
|
const total_count_data = await query.getCount();
|
||||||
|
const list_data = await query.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, 1, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static async create(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async create(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Room']
|
#swagger.tags = ['Room']
|
||||||
|
|||||||
@ -130,6 +130,7 @@ export class RoutePrivate {
|
|||||||
app.put('/api/diagnostic-procedure/restore/:id', DiagnosticProcedureController.restore)
|
app.put('/api/diagnostic-procedure/restore/:id', DiagnosticProcedureController.restore)
|
||||||
|
|
||||||
app.get('/api/room/list', RoomController.list)
|
app.get('/api/room/list', RoomController.list)
|
||||||
|
app.get('/api/room/option', RoomController.option)
|
||||||
app.post('/api/room/create', RoomController.create)
|
app.post('/api/room/create', RoomController.create)
|
||||||
app.get('/api/room/detail/:id', RoomController.detail)
|
app.get('/api/room/detail/:id', RoomController.detail)
|
||||||
app.put('/api/room/update/:id', RoomController.update)
|
app.put('/api/room/update/:id', RoomController.update)
|
||||||
@ -247,6 +248,7 @@ export class RoutePrivate {
|
|||||||
app.put('/api/pharmacy/item-group/restore/:id', ItemGroupController.restore)
|
app.put('/api/pharmacy/item-group/restore/:id', ItemGroupController.restore)
|
||||||
|
|
||||||
app.get('/api/pharmacy/item-origin/list', ItemOriginController.list)
|
app.get('/api/pharmacy/item-origin/list', ItemOriginController.list)
|
||||||
|
app.get('/api/pharmacy/item-origin/option', ItemOriginController.option)
|
||||||
app.get('/api/pharmacy/item-origin/export', ItemOriginController.export)
|
app.get('/api/pharmacy/item-origin/export', ItemOriginController.export)
|
||||||
app.post('/api/pharmacy/item-origin/create', ItemOriginController.create)
|
app.post('/api/pharmacy/item-origin/create', ItemOriginController.create)
|
||||||
app.put('/api/pharmacy/item-origin/update/:id', ItemOriginController.update)
|
app.put('/api/pharmacy/item-origin/update/:id', ItemOriginController.update)
|
||||||
@ -331,6 +333,7 @@ export class RoutePrivate {
|
|||||||
app.put('/api/pharmacy/factory/restore/:id', FactoryController.restore)
|
app.put('/api/pharmacy/factory/restore/:id', FactoryController.restore)
|
||||||
|
|
||||||
app.get('/api/pharmacy/supplier/list', SupplierController.list)
|
app.get('/api/pharmacy/supplier/list', SupplierController.list)
|
||||||
|
app.get('/api/pharmacy/supplier/option', SupplierController.option)
|
||||||
app.get('/api/pharmacy/supplier/export', SupplierController.export)
|
app.get('/api/pharmacy/supplier/export', SupplierController.export)
|
||||||
app.post('/api/pharmacy/supplier/create', SupplierController.create)
|
app.post('/api/pharmacy/supplier/create', SupplierController.create)
|
||||||
app.put('/api/pharmacy/supplier/update/:id', SupplierController.update)
|
app.put('/api/pharmacy/supplier/update/:id', SupplierController.update)
|
||||||
|
|||||||
Reference in New Issue
Block a user