fix(surgery-type): fix the list from clause

This commit is contained in:
avicenan
2026-05-04 14:23:55 +07:00
parent acce0861a9
commit 1c0474600f
2 changed files with 12 additions and 6 deletions

View File

@ -47,7 +47,7 @@ export class SurgeryTypeController {
const res_count = query;
const res_list = query
.orderBy("SurgeryType." + param.order_field, param.order_direction)
.orderBy("st." + param.order_field, param.order_direction)
.offset(offset)
.limit(limit);
@ -110,7 +110,7 @@ export class SurgeryTypeController {
let param: { id: string } = await schema.validateAsync(req.params);
let surgeryType = await SurgeryTypeModel.list({ "SurgeryType.id": param.id }).then((q) => q.getOne());
let surgeryType = await SurgeryTypeModel.list({ "st.id": param.id }).then((q) => q.getOne());
if (!surgeryType) throw { message: "Surgery Type " + Language.lang.failed_not_found };
@ -142,7 +142,7 @@ export class SurgeryTypeController {
let exist = await SurgeryTypeModel.list({ name: param.name }).then((q) => q.getOne());
if (exist && exist.id != param.id) throw { message: "Surgery Type " + Language.lang.failed_duplicate };
let surgeryType = await SurgeryTypeModel.list({ "SurgeryType.id": param.id }).then((q) => q.getOne());
let surgeryType = await SurgeryTypeModel.list({ "st.id": param.id }).then((q) => q.getOne());
if (!surgeryType) throw { message: "Surgery Type " + Language.lang.failed_not_found };