update master data pharmacy
This commit is contained in:
23
src/model/factory.ts
Normal file
23
src/model/factory.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Factory } from "entity";
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
|
||||
export class FactoryModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(Factory);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "factory").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "factory").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("factory");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
23
src/model/generic_name.ts
Normal file
23
src/model/generic_name.ts
Normal 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;
|
||||
}
|
||||
}
|
||||
23
src/model/item_class.ts
Normal file
23
src/model/item_class.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ItemClass } from "entity";
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
|
||||
export class ItemClassModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(ItemClass);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "item_class").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "item_class").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("item_class");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
23
src/model/item_class_detail.ts
Normal file
23
src/model/item_class_detail.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ItemClassDetail } from "entity";
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
|
||||
export class ItemClassDetailModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(ItemClassDetail);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "item_class_detail").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "item_class_detail").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("item_class_detail");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
23
src/model/supplier.ts
Normal file
23
src/model/supplier.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { Supplier } from "entity";
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
|
||||
export class SupplierModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(Supplier);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "supplier").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "supplier").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("supplier");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
23
src/model/usage_instructions.ts
Normal file
23
src/model/usage_instructions.ts
Normal file
@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
23
src/model/usage_time.ts
Normal file
23
src/model/usage_time.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { UsageTime } from "entity";
|
||||
import { SelectQueryBuilder } from "typeorm";
|
||||
import CommonHelper from "../helpers/common";
|
||||
import { OrmHelper } from "../helpers/orm";
|
||||
|
||||
export class UsageTimeModel {
|
||||
static async list(filter = {}): Promise<SelectQueryBuilder<any>> {
|
||||
const repo = OrmHelper.DB.getRepository(UsageTime);
|
||||
let whereAttr: string[] = [];
|
||||
let whereVal: any = {};
|
||||
if (filter && Object.keys(filter).length > 0) {
|
||||
whereAttr = [...whereAttr, ...CommonHelper.handleQueryFilter(filter, "usage_time").whereAttr];
|
||||
whereVal = { ...whereVal, ...CommonHelper.handleQueryFilter(filter, "usage_time").whereVal };
|
||||
}
|
||||
|
||||
var query = repo.createQueryBuilder("usage_time");
|
||||
if (whereAttr.length != 0) {
|
||||
query = query.where(whereAttr.join(" and "), whereVal);
|
||||
}
|
||||
|
||||
return query;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user