autosync_backend2 1.2.41 → 1.2.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1958,6 +1958,7 @@ export declare const app: Elysia<"", {
1958
1958
  totalCount: number;
1959
1959
  totalPage: number;
1960
1960
  result: Omit<{
1961
+ type: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet";
1961
1962
  name: string;
1962
1963
  id: string;
1963
1964
  email: string;
@@ -2003,6 +2004,7 @@ export declare const app: Elysia<"", {
2003
2004
  company: {
2004
2005
  post: {
2005
2006
  body: {
2007
+ type?: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet" | undefined;
2006
2008
  oldId?: number | null | undefined;
2007
2009
  isActive?: boolean | undefined;
2008
2010
  province?: string | null | undefined;
@@ -2029,6 +2031,7 @@ export declare const app: Elysia<"", {
2029
2031
  headers: {};
2030
2032
  response: {
2031
2033
  200: {
2034
+ type: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet";
2032
2035
  name: string;
2033
2036
  id: string;
2034
2037
  email: string;
@@ -2072,6 +2075,7 @@ export declare const app: Elysia<"", {
2072
2075
  ":id": {
2073
2076
  put: {
2074
2077
  body: {
2078
+ type?: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet" | undefined;
2075
2079
  name?: string | undefined;
2076
2080
  email?: string | undefined;
2077
2081
  oldId?: number | null | undefined;
@@ -2100,6 +2104,7 @@ export declare const app: Elysia<"", {
2100
2104
  headers: {};
2101
2105
  response: {
2102
2106
  200: {
2107
+ type: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet";
2103
2108
  name: string;
2104
2109
  id: string;
2105
2110
  email: string;
@@ -4272,6 +4277,7 @@ export declare const app: Elysia<"", {
4272
4277
  isNexus: boolean;
4273
4278
  isActive: boolean;
4274
4279
  branchCount: number;
4280
+ type: "AutoService" | "MiningFleet" | "UrbanTransportFleet" | "Long-haul/Logistics" | "Emergency/Medical/Police" | "CorporateFleet";
4275
4281
  id: string;
4276
4282
  createdAt: string;
4277
4283
  updatedAt: string;
@@ -9639,16 +9645,42 @@ export declare const app: Elysia<"", {
9639
9645
  totalCount: number;
9640
9646
  totalPage: number;
9641
9647
  result: Omit<{
9648
+ product: {
9649
+ pmTemplateId: string;
9650
+ productKindId: string;
9651
+ quantity: number | null;
9652
+ uomId: string;
9653
+ id: string;
9654
+ createdAt: string;
9655
+ updatedAt: string;
9656
+ deletedAt: string | null;
9657
+ oldId: number | null;
9658
+ };
9659
+ productKind: {
9660
+ productCategoryId: string;
9661
+ name: string;
9662
+ description: string | null;
9663
+ id: string;
9664
+ createdAt: string;
9665
+ updatedAt: string;
9666
+ deletedAt: string | null;
9667
+ oldId: number | null;
9668
+ } | null;
9669
+ uom: {
9670
+ uomCategoryId: string;
9671
+ code: string | null;
9672
+ name: string;
9673
+ description: string | null;
9674
+ symbol: string | null;
9675
+ isBaseUnit: boolean;
9676
+ baseFactor: number | null;
9677
+ id: string;
9678
+ createdAt: string;
9679
+ updatedAt: string;
9680
+ deletedAt: string | null;
9681
+ oldId: number | null;
9682
+ } | null;
9642
9683
  totalCount: number;
9643
- pmTemplateId: string;
9644
- productKindId: string;
9645
- quantity: number | null;
9646
- uomId: string;
9647
- id: string;
9648
- createdAt: string;
9649
- updatedAt: string;
9650
- deletedAt: string | null;
9651
- oldId: number | null;
9652
9684
  }, "totalCount">[];
9653
9685
  };
9654
9686
  422: {
@@ -9929,6 +9961,7 @@ export declare const app: Elysia<"", {
9929
9961
  body: unknown;
9930
9962
  params: {};
9931
9963
  query: {
9964
+ id?: string | undefined;
9932
9965
  pagination: {
9933
9966
  size: number;
9934
9967
  page: number;
package/dist/index.js CHANGED
@@ -142480,6 +142480,9 @@ __export(exports_schema, {
142480
142480
  pmPlanMachineTable: () => pmPlanMachineTable,
142481
142481
  permissionTable: () => permissionTable,
142482
142482
  permissionGroupTable: () => permissionGroupTable,
142483
+ maintenanceServiceSchema: () => maintenanceServiceSchema,
142484
+ maintenanceServiceRecordTable: () => maintenanceServiceRecordTable,
142485
+ maintenanceServiceRecordProductTable: () => maintenanceServiceRecordProductTable,
142483
142486
  logTable: () => logTable,
142484
142487
  inspectionTemplateTable: () => inspectionTemplateTable,
142485
142488
  inspectionTemplateMachineKindTable: () => inspectionTemplateMachineKindTable,
@@ -142524,6 +142527,7 @@ __export(exports_schema, {
142524
142527
  crmCpOrderItemTable: () => crmCpOrderItemTable,
142525
142528
  crmCpOrderItemEmployeeTable: () => crmCpOrderItemEmployeeTable,
142526
142529
  companyWorkScheduleTable: () => companyWorkScheduleTable,
142530
+ companyTypeEnum: () => companyTypeEnum,
142527
142531
  companyServiceKindTable: () => companyServiceKindTable,
142528
142532
  companyServiceBookingTable: () => companyServiceBookingTable,
142529
142533
  companySchema: () => companySchema,
@@ -142669,6 +142673,14 @@ var uomConversionTable = pgTable("uom_conversion", {
142669
142673
  });
142670
142674
  // src/lib/db/schema/company.schema.ts
142671
142675
  var companySchema = pgSchema("company");
142676
+ var companyTypeEnum = companySchema.enum("company_type", [
142677
+ "AutoService",
142678
+ "MiningFleet",
142679
+ "UrbanTransportFleet",
142680
+ "Long-haul/Logistics",
142681
+ "Emergency/Medical/Police",
142682
+ "CorporateFleet"
142683
+ ]);
142672
142684
  var companyCompanyTable = companySchema.table("company", {
142673
142685
  ...base_schema_helper_default,
142674
142686
  name: varchar().notNull(),
@@ -142689,7 +142701,8 @@ var companyCompanyTable = companySchema.table("company", {
142689
142701
  isNoat: boolean4().notNull().default(false),
142690
142702
  isNexus: boolean4().notNull().default(false),
142691
142703
  isActive: boolean4().notNull().default(true),
142692
- branchCount: integer2().notNull().default(1)
142704
+ branchCount: integer2().notNull().default(1),
142705
+ type: companyTypeEnum().notNull().default("AutoService")
142693
142706
  });
142694
142707
  var companyBranchTable = companySchema.table("branch", {
142695
142708
  ...base_schema_helper_default,
@@ -143203,6 +143216,25 @@ var pmPlanProductTable = pmSchema.table("plan_product", {
143203
143216
  quantity: numeric({ mode: "number" }),
143204
143217
  pmQuantity: uuid5().notNull()
143205
143218
  });
143219
+ var maintenanceServiceSchema = pgSchema("maintenance_service");
143220
+ var maintenanceServiceRecordTable = maintenanceServiceSchema.table("record", {
143221
+ ...base_schema_helper_default,
143222
+ machineId: uuid5().notNull(),
143223
+ serviceKindId: uuid5().notNull(),
143224
+ pmPlanId: uuid5(),
143225
+ pmPlanMachineId: uuid5(),
143226
+ employeeTechnicianId: uuid5().notNull(),
143227
+ state: varchar().notNull(),
143228
+ note: text(),
143229
+ timeCompleted: timestamp({ withTimezone: true })
143230
+ });
143231
+ var maintenanceServiceRecordProductTable = maintenanceServiceSchema.table("record_product", {
143232
+ ...base_schema_helper_default,
143233
+ msRecordId: uuid5().notNull(),
143234
+ companyProductId: uuid5().notNull(),
143235
+ uomId: uuid5().notNull(),
143236
+ quantity: numeric({ mode: "number" })
143237
+ });
143206
143238
  // src/lib/db/schema/techdoc.schema.ts
143207
143239
  var techdocSchema = pgSchema("techdoc");
143208
143240
  var techdocVehicleKindEnum = pgEnum("vehicle_kind_enum", [
@@ -147317,7 +147349,7 @@ var WarehouseProductLogic;
147317
147349
  ((WarehouseProductLogic) => {
147318
147350
  WarehouseProductLogic.getFilter = (query, user2) => {
147319
147351
  const ilikeSearch = `%${query.search}%`;
147320
- return and(softDeletedFilter(warehouseProductTable), eq(warehouseProductTable.companyId, user2.companyId), or(ilike(warehouseProductTable.name, ilikeSearch), ilike(warehouseProductTable.barCode, ilikeSearch), ilike(warehouseProductTable.oen, ilikeSearch), ilike(warehouseProductTable.partNumber, ilikeSearch), ilike(warehouseProductTable.alias, ilikeSearch))?.if(!!query.search), eq(warehouseProductTable.priceSell, query.priceSell ?? 0).if(query.priceSell), eq(warehouseProductTable.productId, query.productId ?? "").if(query.productId), eq(warehouseProductTable.supplierId, query.supplierId ?? "").if(query.supplierId), eq(warehouseProductTable.id, query.id ?? "").if(query.id), inArray(warehouseProductTable.id, query.ids ?? []).if(query.ids?.length), ...query.type ? [eq(warehouseProductTable.type, query.type)] : []);
147352
+ return and(softDeletedFilter(warehouseProductTable), eq(warehouseProductTable.companyId, user2.companyId), or(ilike(warehouseProductTable.name, `%${ilikeSearch}%`), ilike(warehouseProductTable.barCode, `%${ilikeSearch}%`), ilike(warehouseProductTable.oen, `%${ilikeSearch}%`), ilike(warehouseProductTable.partNumber, `%${ilikeSearch}%`), ilike(warehouseProductTable.alias, `%${ilikeSearch}%`))?.if(!!query.search), eq(warehouseProductTable.priceSell, query.priceSell ?? 0).if(query.priceSell), eq(warehouseProductTable.productId, query.productId ?? "").if(query.productId), eq(warehouseProductTable.supplierId, query.supplierId ?? "").if(query.supplierId), eq(warehouseProductTable.id, query.id ?? "").if(query.id), inArray(warehouseProductTable.id, query.ids ?? []).if(query.ids?.length), ...query.type ? [eq(warehouseProductTable.type, query.type)] : []);
147321
147353
  };
147322
147354
  WarehouseProductLogic.select = async (query, user2) => {
147323
147355
  const baseQuery = db_default.select({
@@ -152408,7 +152440,7 @@ var CrmInspectionLogic;
152408
152440
  status: crmInspectionTable.status
152409
152441
  }
152410
152442
  }).from(crmInspectionTable).where(eq(crmInspectionTable.id, inspection.id)).leftJoin(companyCompanyTable, eq(companyCompanyTable.id, crmInspectionTable.companyId)).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).leftJoin(techdocVehicleKindTable, eq(techdocVehicleKindTable.id, crmVehicleTable.vehicleKindId)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmInspectionTable.employeeId));
152411
- await distribution_default.post(env_default.NODE_ENV === "development" ? "https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection" : "https://driver-partner-api.ubcabtech.com/v1/webhook/autosync/inspection", {
152443
+ await distribution_default.post(env_default.NODE_ENV === "development" ? "https://driver-partner-api-v4.dev.ubcabtech.com/v1/webhook/autosync/inspection" : "https://driver-partner-api-v4.ubcabtech.com/v1/webhook/autosync/inspection", {
152412
152444
  json: result[0],
152413
152445
  retry: 3
152414
152446
  });
@@ -154852,7 +154884,7 @@ var inspection_default2 = inspectionRoutes2;
154852
154884
  var MachineLogic;
154853
154885
  ((MachineLogic) => {
154854
154886
  MachineLogic.select = async (query, user2) => {
154855
- const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")), softDeletedFilter(companyMachineTable));
154887
+ const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")), eq(companyMachineTable.id, query.id).if(query.id), softDeletedFilter(companyMachineTable));
154856
154888
  const columns = getTableColumns(companyMachineTable);
154857
154889
  const baseQuery = db_default.select({
154858
154890
  ...columns,
@@ -154887,7 +154919,12 @@ var MachineModel;
154887
154919
  const updateSchema = createUpdateSchema(companyMachineTable);
154888
154920
  MachineModel.create = OmitBaseSchema(createSchema);
154889
154921
  MachineModel.update = OmitBaseSchema(updateSchema);
154890
- MachineModel.select = t.Composite([PaginationSchema]);
154922
+ MachineModel.select = t.Composite([
154923
+ PaginationSchema,
154924
+ t.Partial(t.Object({
154925
+ id: t.String({ format: "uuid" })
154926
+ }))
154927
+ ]);
154891
154928
  })(MachineModel ||= {});
154892
154929
  var model_default34 = MachineModel;
154893
154930
 
@@ -154958,11 +154995,12 @@ var PmTemplateProductLogic;
154958
154995
  ((PmTemplateProductLogic) => {
154959
154996
  PmTemplateProductLogic.select = async (query) => {
154960
154997
  const filter = and(softDeletedFilter(pmTemplateProductTable), eq(pmTemplateProductTable.pmTemplateId, query.pmTemplateId));
154961
- const columns = getTableColumns(pmTemplateProductTable);
154962
154998
  const baseQuery = db_default.select({
154963
- ...columns,
154999
+ product: pmTemplateProductTable,
155000
+ productKind: techdocProductKindTable,
155001
+ uom: uomTable,
154964
155002
  totalCount: totalCountSql
154965
- }).from(pmTemplateProductTable).where(filter).$dynamic();
155003
+ }).from(pmTemplateProductTable).leftJoin(techdocProductKindTable, eq(techdocProductKindTable.id, pmTemplateProductTable.productKindId)).leftJoin(uomTable, eq(uomTable.id, pmTemplateProductTable.uomId)).where(filter).$dynamic();
154966
155004
  const result = await pagination_helper_default(baseQuery, query.pagination);
154967
155005
  return getPaginationContent(result, query.pagination.size);
154968
155006
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.41",
3
+ "version": "1.2.43",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",