add pharmacy info

This commit is contained in:
Rayhan Ardiansyah
2026-03-02 12:31:03 +07:00
parent 57083ad9fe
commit 8df10aa2e3
5 changed files with 682 additions and 2 deletions

View File

@ -0,0 +1,23 @@
import { SelectQueryBuilder } from "typeorm";
import CommonHelper from "../helpers/common";
import { OrmHelper } from "../helpers/orm";
import { PharmacyInfo } from "entity";
export class PharmacyInfoModel {
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
const repo = OrmHelper.DB.getRepository(PharmacyInfo);
let whereAttr: string[] = [];
let whereVal: any = {};
if (filter && Object.keys(filter).length > 0) {
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "pharmacy_info").whereAttr];
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "pharmacy_info").whereVal };
}
var query = repo.createQueryBuilder("pharmacy_info").leftJoinAndSelect("pharmacy_info.default_room", "default_room");
if (whereAttr.length != 0) {
query = query.where(whereAttr.join(" and "), whereVal);
}
return query;
}
}