autosync_backend2 1.2.42 → 1.2.44

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;
@@ -9057,6 +9063,7 @@ export declare const app: Elysia<"", {
9057
9063
  query: unknown;
9058
9064
  headers: unknown;
9059
9065
  response: {
9066
+ 200: string;
9060
9067
  422: {
9061
9068
  type: "validation";
9062
9069
  on: string;
@@ -9955,6 +9962,7 @@ export declare const app: Elysia<"", {
9955
9962
  body: unknown;
9956
9963
  params: {};
9957
9964
  query: {
9965
+ id?: string | undefined;
9958
9966
  pagination: {
9959
9967
  size: number;
9960
9968
  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({
@@ -154764,10 +154796,13 @@ var InspectionTemplateLogic;
154764
154796
  return result;
154765
154797
  };
154766
154798
  InspectionTemplateLogic.create = async (body, user2) => {
154767
- await db_default.insert(inspectionTemplateTable).values({
154799
+ const [res] = await db_default.insert(inspectionTemplateTable).values({
154768
154800
  ...body,
154769
154801
  companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154802
+ }).returning({
154803
+ id: inspectionTemplateTable.id
154770
154804
  });
154805
+ return res.id;
154771
154806
  };
154772
154807
  InspectionTemplateLogic.update = async (id, body, user2) => {
154773
154808
  const [res] = await db_default.update(inspectionTemplateTable).set(body).where(and(eq(inspectionTemplateTable.id, id), eq(inspectionTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN"))).returning({
@@ -154852,7 +154887,7 @@ var inspection_default2 = inspectionRoutes2;
154852
154887
  var MachineLogic;
154853
154888
  ((MachineLogic) => {
154854
154889
  MachineLogic.select = async (query, user2) => {
154855
- const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")), softDeletedFilter(companyMachineTable));
154890
+ 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
154891
  const columns = getTableColumns(companyMachineTable);
154857
154892
  const baseQuery = db_default.select({
154858
154893
  ...columns,
@@ -154887,7 +154922,12 @@ var MachineModel;
154887
154922
  const updateSchema = createUpdateSchema(companyMachineTable);
154888
154923
  MachineModel.create = OmitBaseSchema(createSchema);
154889
154924
  MachineModel.update = OmitBaseSchema(updateSchema);
154890
- MachineModel.select = t.Composite([PaginationSchema]);
154925
+ MachineModel.select = t.Composite([
154926
+ PaginationSchema,
154927
+ t.Partial(t.Object({
154928
+ id: t.String({ format: "uuid" })
154929
+ }))
154930
+ ]);
154891
154931
  })(MachineModel ||= {});
154892
154932
  var model_default34 = MachineModel;
154893
154933
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.42",
3
+ "version": "1.2.44",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",