update: add option for order pharmacy
This commit is contained in:
@ -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> {
|
||||
/*
|
||||
#swagger.tags = ['Pharmacy - Supplier']
|
||||
@ -110,7 +135,7 @@ export class SupplierController {
|
||||
|
||||
var query = await SupplierModel.list(filter);
|
||||
const data = await query.getMany();
|
||||
|
||||
|
||||
const filename = "supplier.csv";
|
||||
|
||||
res.setHeader('Content-Type', 'text/csv');
|
||||
|
||||
Reference in New Issue
Block a user