update master data pharmacy

This commit is contained in:
Muhammad Rayhan Ardiansyah
2026-02-27 14:34:50 +07:00
parent 3cd4755c8e
commit ce1e4d3466
16 changed files with 2696 additions and 42 deletions

23
src/model/generic_name.ts Normal file
View File

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