Files
service-master-data-revenue/src/model/usage_instructions.ts
Muhammad Rayhan Ardiansyah ce1e4d3466 update master data pharmacy
2026-02-27 14:34:50 +07:00

23 lines
936 B
TypeScript

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