health-petal/apps/backend/src/lib/data-manager.ts
2026-05-24 17:08:30 +05:30

74 lines
2.2 KiB
TypeScript

import {
createStorageSpacesRepo,
createDistributorsRepo,
createProductsRepo,
createDrugInfoRepo,
createUnitsRepo,
createStockBatchesRepo,
createEnterpriseRepo,
createStaffRepo,
createEnterpriseStaffRepo,
createRolesRepo,
createCustomersRepo,
createBillsRepo,
createDashboardRepo,
type StorageSpacesRepo,
type DistributorsRepo,
type ProductsRepo,
type DrugInfoRepo,
type UnitsRepo,
type StockBatchesRepo,
type EnterpriseRepo,
type StaffRepo,
type EnterpriseStaffRepo,
type RolesRepo,
type CustomersRepo,
type BillsRepo,
type DashboardRepo,
} from "data-manager-sqlite";
export class DataManager {
readonly storageSpaces: StorageSpacesRepo;
readonly distributors: DistributorsRepo;
readonly products: ProductsRepo;
readonly drugInfo: DrugInfoRepo;
readonly units: UnitsRepo;
readonly stockBatches: StockBatchesRepo;
readonly enterprises: EnterpriseRepo;
readonly staff: StaffRepo;
readonly enterpriseStaff: EnterpriseStaffRepo;
readonly roles: RolesRepo;
readonly customers: CustomersRepo;
readonly bills: BillsRepo;
readonly dashboard: DashboardRepo;
constructor() {
const { repo: storageSpacesRepo } = createStorageSpacesRepo();
const { repo: distributorsRepo } = createDistributorsRepo();
const { repo: productsRepo } = createProductsRepo();
const { repo: drugInfoRepo } = createDrugInfoRepo();
const { repo: unitsRepo } = createUnitsRepo();
const { repo: stockBatchesRepo } = createStockBatchesRepo();
const { repo: enterpriseRepo } = createEnterpriseRepo();
const { repo: staffRepo } = createStaffRepo();
const { repo: enterpriseStaffRepo } = createEnterpriseStaffRepo();
const { repo: rolesRepo } = createRolesRepo();
const { repo: customersRepo } = createCustomersRepo();
const { repo: billsRepo } = createBillsRepo();
const { repo: dashboardRepo } = createDashboardRepo();
this.storageSpaces = storageSpacesRepo;
this.distributors = distributorsRepo;
this.products = productsRepo;
this.drugInfo = drugInfoRepo;
this.units = unitsRepo;
this.stockBatches = stockBatchesRepo;
this.enterprises = enterpriseRepo;
this.staff = staffRepo;
this.enterpriseStaff = enterpriseStaffRepo;
this.roles = rolesRepo;
this.customers = customersRepo;
this.bills = billsRepo;
this.dashboard = dashboardRepo;
}
}