autosync_backend2 1.1.54 → 1.1.56

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
@@ -465,9 +465,9 @@ export declare const app: Elysia<"", {
465
465
  readonly "CrmCpOrderModel.update": import("@sinclair/typebox").TObject<{
466
466
  companyId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
467
467
  isNoat: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TBoolean, import("@sinclair/typebox").TNull]>>;
468
- vehicleId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
469
468
  customerId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
470
469
  km: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
470
+ vehicleId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
471
471
  companyBranchId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
472
472
  orderId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
473
473
  state: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
@@ -699,24 +699,17 @@ export declare const app: Elysia<"", {
699
699
  authUserId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
700
700
  }>;
701
701
  readonly "CrmInspectionModel.create": import("@sinclair/typebox").TObject<{
702
- employeeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
703
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
704
702
  inspection: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
705
703
  type: import("@sinclair/typebox").TString;
706
- values: import("@sinclair/typebox").TObject<{
704
+ values: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
707
705
  question: import("@sinclair/typebox").TString;
708
706
  answer: import("@sinclair/typebox").TString;
709
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
710
- }>;
707
+ description: import("@sinclair/typebox").TString;
708
+ }>>;
711
709
  }>>;
712
- experience: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
713
- rank: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
714
710
  licensePlate: import("@sinclair/typebox").TString;
715
- status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
716
- CREATED: "CREATED";
717
- APPROVED: "APPROVED";
718
- CANCELLED: "CANCELLED";
719
- }>>;
711
+ description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
712
+ employeeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
720
713
  }>;
721
714
  readonly "CrmInspectionModel.select": import("@sinclair/typebox").TObject<{
722
715
  search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -727,6 +720,9 @@ export declare const app: Elysia<"", {
727
720
  size: import("@sinclair/typebox").TInteger;
728
721
  }>;
729
722
  }>;
723
+ readonly "CrmInspectionModel.selectUbCab": import("@sinclair/typebox").TObject<{
724
+ licensePlate: import("@sinclair/typebox").TString;
725
+ }>;
730
726
  readonly "TechdocSupplierModel.select": import("@sinclair/typebox").TObject<{
731
727
  pagination: import("@sinclair/typebox").TObject<{
732
728
  page: import("@sinclair/typebox").TInteger;
@@ -4730,9 +4726,9 @@ export declare const app: Elysia<"", {
4730
4726
  body: {
4731
4727
  companyId?: string | undefined;
4732
4728
  isNoat?: boolean | null | undefined;
4733
- vehicleId?: string | undefined;
4734
4729
  customerId?: string | null | undefined;
4735
4730
  km?: number | undefined;
4731
+ vehicleId?: string | undefined;
4736
4732
  companyBranchId?: string | undefined;
4737
4733
  orderId?: string | undefined;
4738
4734
  state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
@@ -5545,24 +5541,10 @@ export declare const app: Elysia<"", {
5545
5541
  fleet: {
5546
5542
  post: {
5547
5543
  body: {
5548
- companyId?: string | null | undefined;
5549
- licensePlate?: string | null | undefined;
5550
- customerId?: string | null | undefined;
5551
- vin?: string | null | undefined;
5552
- color?: string | null | undefined;
5553
- engineCc?: string | null | undefined;
5554
- cylinder?: string | null | undefined;
5555
- gasType?: string | null | undefined;
5556
- transmissionType?: string | null | undefined;
5557
- vehicleType?: string | null | undefined;
5558
- yearManufacture?: number | null | undefined;
5559
- yearImport?: number | null | undefined;
5560
- steering?: string | null | undefined;
5561
- engineCode?: string | null | undefined;
5562
- transmissionCode?: string | null | undefined;
5563
- driveTrain?: string | null | undefined;
5564
- km?: number | undefined;
5565
- vehicleKindId: string;
5544
+ licensePlate?: string | undefined;
5545
+ customerId?: string | undefined;
5546
+ vehicleKindId?: string | undefined;
5547
+ vin?: string | undefined;
5566
5548
  };
5567
5549
  params: {};
5568
5550
  query: unknown;
@@ -5592,6 +5574,8 @@ export declare const app: Elysia<"", {
5592
5574
  driveTrain: string | null;
5593
5575
  km: number;
5594
5576
  };
5577
+ 502: string;
5578
+ 400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
5595
5579
  422: {
5596
5580
  type: "validation";
5597
5581
  on: string;
@@ -6386,6 +6370,65 @@ export declare const app: Elysia<"", {
6386
6370
  } & {
6387
6371
  crm: {
6388
6372
  inspection: {};
6373
+ } & {
6374
+ inspection: {
6375
+ ubcab: {
6376
+ get: {
6377
+ body: unknown;
6378
+ params: {};
6379
+ query: {
6380
+ licensePlate: string;
6381
+ };
6382
+ headers: unknown;
6383
+ response: {
6384
+ 200: {
6385
+ inspection: {
6386
+ companyId: string;
6387
+ branchId: string;
6388
+ vehicleId: string;
6389
+ inspection: {
6390
+ type: string;
6391
+ values: {
6392
+ description: string;
6393
+ question: string;
6394
+ answer: string;
6395
+ }[];
6396
+ }[] | null;
6397
+ employeeId: string | null;
6398
+ expireAt: Date;
6399
+ experience: string | null;
6400
+ rank: string | null;
6401
+ licensePlate: string;
6402
+ description: string | null;
6403
+ status: "CREATED" | "APPROVED" | "CANCELLED";
6404
+ id: string;
6405
+ createdAt: string;
6406
+ updatedAt: string;
6407
+ deletedAt: string | null;
6408
+ };
6409
+ company: {
6410
+ id: string;
6411
+ name: string;
6412
+ logo: string;
6413
+ };
6414
+ branch: {
6415
+ id: string;
6416
+ name: string;
6417
+ };
6418
+ }[];
6419
+ 422: {
6420
+ type: "validation";
6421
+ on: string;
6422
+ summary?: string;
6423
+ message?: string;
6424
+ found?: unknown;
6425
+ property?: string;
6426
+ expected?: string;
6427
+ };
6428
+ };
6429
+ };
6430
+ };
6431
+ };
6389
6432
  } & {
6390
6433
  inspection: {
6391
6434
  get: {
@@ -6413,10 +6456,10 @@ export declare const app: Elysia<"", {
6413
6456
  inspection: {
6414
6457
  type: string;
6415
6458
  values: {
6416
- description?: string | undefined;
6459
+ description: string;
6417
6460
  question: string;
6418
6461
  answer: string;
6419
- };
6462
+ }[];
6420
6463
  }[] | null;
6421
6464
  employeeId: string | null;
6422
6465
  expireAt: Date;
@@ -6430,6 +6473,30 @@ export declare const app: Elysia<"", {
6430
6473
  updatedAt: string;
6431
6474
  deletedAt: string | null;
6432
6475
  };
6476
+ vehicle: {
6477
+ customerId: string | null;
6478
+ vehicleKindId: string;
6479
+ vin: string | null;
6480
+ licensePlate: string | null;
6481
+ color: string | null;
6482
+ engineCc: string | null;
6483
+ cylinder: string | null;
6484
+ gasType: string | null;
6485
+ transmissionType: string | null;
6486
+ vehicleType: string | null;
6487
+ yearManufacture: number | null;
6488
+ yearImport: number | null;
6489
+ steering: string | null;
6490
+ engineCode: string | null;
6491
+ transmissionCode: string | null;
6492
+ driveTrain: string | null;
6493
+ km: number;
6494
+ companyId: string | null;
6495
+ id: string;
6496
+ createdAt: string;
6497
+ updatedAt: string;
6498
+ deletedAt: string | null;
6499
+ };
6433
6500
  }[];
6434
6501
  };
6435
6502
  422: {
@@ -6448,18 +6515,15 @@ export declare const app: Elysia<"", {
6448
6515
  inspection: {
6449
6516
  post: {
6450
6517
  body: {
6451
- employeeId?: string | null | undefined;
6452
- description?: string | null | undefined;
6453
- experience?: string | null | undefined;
6454
- rank?: string | null | undefined;
6455
- status?: "CREATED" | "APPROVED" | "CANCELLED" | undefined;
6518
+ employeeId?: string | undefined;
6519
+ description?: string | undefined;
6456
6520
  inspection: {
6457
6521
  type: string;
6458
6522
  values: {
6459
- description?: string | undefined;
6523
+ description: string;
6460
6524
  question: string;
6461
6525
  answer: string;
6462
- };
6526
+ }[];
6463
6527
  }[];
6464
6528
  licensePlate: string;
6465
6529
  };
@@ -6476,20 +6540,20 @@ export declare const app: Elysia<"", {
6476
6540
  employeeId: string | null;
6477
6541
  deletedAt: string | null;
6478
6542
  description: string | null;
6479
- vehicleId: string;
6480
6543
  inspection: {
6481
6544
  type: string;
6482
6545
  values: {
6483
- description?: string | undefined;
6546
+ description: string;
6484
6547
  question: string;
6485
6548
  answer: string;
6486
- };
6549
+ }[];
6487
6550
  }[] | null;
6551
+ licensePlate: string;
6552
+ status: "CREATED" | "APPROVED" | "CANCELLED";
6553
+ vehicleId: string;
6488
6554
  expireAt: Date;
6489
6555
  experience: string | null;
6490
6556
  rank: string | null;
6491
- licensePlate: string;
6492
- status: "CREATED" | "APPROVED" | "CANCELLED";
6493
6557
  };
6494
6558
  502: string;
6495
6559
  400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
@@ -6523,10 +6587,10 @@ export declare const app: Elysia<"", {
6523
6587
  inspection: {
6524
6588
  type: string;
6525
6589
  values: {
6526
- description?: string | undefined;
6590
+ description: string;
6527
6591
  question: string;
6528
6592
  answer: string;
6529
- };
6593
+ }[];
6530
6594
  }[] | null;
6531
6595
  employeeId: string | null;
6532
6596
  expireAt: Date;
package/dist/index.js CHANGED
@@ -141540,10 +141540,6 @@ var updateConditions = {
141540
141540
  optional: () => true,
141541
141541
  nullable: (column) => !column.notNull
141542
141542
  };
141543
- var createInsertSchema = (entity, refine) => {
141544
- const columns = getColumns(entity);
141545
- return handleColumns(columns, refine ?? {}, insertConditions);
141546
- };
141547
141543
  function createSchemaFactory(options) {
141548
141544
  const createSelectSchema = (entity, refine) => {
141549
141545
  if (isPgEnum2(entity)) {
@@ -141552,7 +141548,7 @@ function createSchemaFactory(options) {
141552
141548
  const columns = getColumns(entity);
141553
141549
  return handleColumns(columns, refine ?? {}, selectConditions, options);
141554
141550
  };
141555
- const createInsertSchema2 = (entity, refine) => {
141551
+ const createInsertSchema = (entity, refine) => {
141556
141552
  const columns = getColumns(entity);
141557
141553
  return handleColumns(columns, refine ?? {}, insertConditions, options);
141558
141554
  };
@@ -141560,11 +141556,11 @@ function createSchemaFactory(options) {
141560
141556
  const columns = getColumns(entity);
141561
141557
  return handleColumns(columns, refine ?? {}, updateConditions, options);
141562
141558
  };
141563
- return { createSelectSchema, createInsertSchema: createInsertSchema2, createUpdateSchema };
141559
+ return { createSelectSchema, createInsertSchema, createUpdateSchema };
141564
141560
  }
141565
141561
 
141566
141562
  // src/lib/validation-factory.ts
141567
- var { createSelectSchema, createUpdateSchema, createInsertSchema: createInsertSchema2 } = createSchemaFactory({
141563
+ var { createSelectSchema, createUpdateSchema, createInsertSchema } = createSchemaFactory({
141568
141564
  typeboxInstance: t
141569
141565
  });
141570
141566
 
@@ -141572,7 +141568,7 @@ var { createSelectSchema, createUpdateSchema, createInsertSchema: createInsertSc
141572
141568
  var phoneRegex = /^\d{8}$/;
141573
141569
  var CompanyBranchModel;
141574
141570
  ((CompanyBranchModel) => {
141575
- const createSchema = createInsertSchema2(companyBranchTable, {
141571
+ const createSchema = createInsertSchema(companyBranchTable, {
141576
141572
  phone: (schema5) => t.RegExp(phoneRegex, { ...schema5 }),
141577
141573
  email: (schema5) => t.String({ ...schema5, format: "email" }),
141578
141574
  merchantId: (schema5) => t.Optional(schema5)
@@ -141614,7 +141610,7 @@ var branch_default = branchRoutes;
141614
141610
  // src/routes/company/company/model.ts
141615
141611
  var CompanyCompanyModel;
141616
141612
  ((CompanyCompanyModel) => {
141617
- const createSchema = createInsertSchema2(companyCompanyTable);
141613
+ const createSchema = createInsertSchema(companyCompanyTable);
141618
141614
  const updateSchema = createUpdateSchema(companyCompanyTable);
141619
141615
  const selectSchema = createSelectSchema(companyCompanyTable, {
141620
141616
  phone: t.RegExp(/^\d{8}$/),
@@ -141663,7 +141659,7 @@ var company_default = companyRoutes;
141663
141659
  // src/routes/company/employee/model.ts
141664
141660
  var CompanyEmployeeModel;
141665
141661
  ((CompanyEmployeeModel) => {
141666
- const createSchema = createInsertSchema2(companyEmployeeTable);
141662
+ const createSchema = createInsertSchema(companyEmployeeTable);
141667
141663
  const updateSchema = createUpdateSchema(companyEmployeeTable);
141668
141664
  const selectSchema = createSelectSchema(companyEmployeeTable, {
141669
141665
  phone: t.RegExp(/^\d{8}$/),
@@ -141701,7 +141697,7 @@ var employee_default = companyRoutes2;
141701
141697
  // src/routes/company/package/model.ts
141702
141698
  var CompanyPackageModel;
141703
141699
  ((CompanyPackageModel) => {
141704
- const createSchema = createInsertSchema2(companyPackageTable);
141700
+ const createSchema = createInsertSchema(companyPackageTable);
141705
141701
  const updateSchema = createUpdateSchema(companyPackageTable);
141706
141702
  CompanyPackageModel.create = OmitBaseSchema(createSchema);
141707
141703
  CompanyPackageModel.update = OmitBaseSchema(updateSchema);
@@ -141782,7 +141778,7 @@ var logic_default2 = CompanyServiceKindLogic;
141782
141778
  // src/routes/company/serviceKind/model.ts
141783
141779
  var CompanyServiceKindModel;
141784
141780
  ((CompanyServiceKindModel) => {
141785
- const createSchema = createInsertSchema2(companyServiceKindTable);
141781
+ const createSchema = createInsertSchema(companyServiceKindTable);
141786
141782
  const updateSchema = createUpdateSchema(companyServiceKindTable);
141787
141783
  const selectSchema = createSelectSchema(companyServiceKindTable);
141788
141784
  CompanyServiceKindModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
@@ -144572,19 +144568,11 @@ var CrmVehicleLogic;
144572
144568
  };
144573
144569
  };
144574
144570
  CrmVehicleLogic.create = async (body, user2) => {
144575
- const [result] = await db_default.insert(crmVehicleTable).values({
144576
- ...body,
144571
+ const vehicle = await CrmVehicleLogic.findOrCreate(body);
144572
+ await db_default.update(crmVehicleTable).set({
144577
144573
  companyId: user2.companyId
144578
- }).returning();
144579
- if (result.licensePlate) {
144580
- await redis_client_default.set(`crm_vehicle.licensePlate:${result.licensePlate}`, result, { ex: CACHE_TTL });
144581
- }
144582
- if (result.vin) {
144583
- await redis_client_default.set(`crm_vehicle.vin:${result.vin}`, result, {
144584
- ex: CACHE_TTL
144585
- });
144586
- }
144587
- return result;
144574
+ });
144575
+ return vehicle;
144588
144576
  };
144589
144577
  CrmVehicleLogic.update = async (id, body, user2) => {
144590
144578
  const [result] = await db_default.update(crmVehicleTable).set(body).where(and(eq(crmVehicleTable.id, id), eq(crmVehicleTable.companyId, user2.companyId), softDeletedFilter(crmVehicleTable))).returning();
@@ -145835,7 +145823,7 @@ var logic_default11 = DiscountLogic;
145835
145823
  // src/routes/crm/cpOrder/item/model.ts
145836
145824
  var CrmCpOrderItemModel;
145837
145825
  ((CrmCpOrderItemModel) => {
145838
- const createSchema = createInsertSchema2(crmCpOrderItemTable);
145826
+ const createSchema = createInsertSchema(crmCpOrderItemTable);
145839
145827
  const updateSchema = createUpdateSchema(crmCpOrderItemTable);
145840
145828
  CrmCpOrderItemModel.create = t.Composite([
145841
145829
  t.Pick(OmitBaseSchema(createSchema), [
@@ -145943,7 +145931,7 @@ var model_default7 = CrmCpOrderModel;
145943
145931
  // src/routes/crm/cpOrder/payment/model.ts
145944
145932
  var CrmCpOrderPaymentModel;
145945
145933
  ((CrmCpOrderPaymentModel) => {
145946
- const createSchema = createInsertSchema2(crmCpOrderPaymentTable);
145934
+ const createSchema = createInsertSchema(crmCpOrderPaymentTable);
145947
145935
  CrmCpOrderPaymentModel.create = t.Omit(OmitBaseSchema(createSchema), ["invoiceNumber"]);
145948
145936
  CrmCpOrderPaymentModel.storepay = t.Composite([
145949
145937
  t.Omit(CrmCpOrderPaymentModel.create, ["paymentMethod", "paymentChannel", "state"]),
@@ -146068,7 +146056,7 @@ var cpOrder_default = cpOrderRoutes;
146068
146056
  // src/routes/crm/customer/model.ts
146069
146057
  var CrmCustomerModel;
146070
146058
  ((CrmCustomerModel) => {
146071
- const createSchema = createInsertSchema2(crmCustomerTable);
146059
+ const createSchema = createInsertSchema(crmCustomerTable);
146072
146060
  CrmCustomerModel.create = OmitBaseSchema(createSchema);
146073
146061
  const updateSchema = createUpdateSchema(crmCustomerTable);
146074
146062
  CrmCustomerModel.update = OmitBaseSchema(updateSchema);
@@ -146095,7 +146083,7 @@ var customer_default = customerRoutes;
146095
146083
  // src/routes/crm/discount/model.ts
146096
146084
  var DiscountModel;
146097
146085
  ((DiscountModel) => {
146098
- const createSchema = createInsertSchema2(crmDiscountTable);
146086
+ const createSchema = createInsertSchema(crmDiscountTable);
146099
146087
  const updateSchema = createUpdateSchema(crmDiscountTable);
146100
146088
  DiscountModel.create = OmitBaseSchema(createSchema);
146101
146089
  DiscountModel.update = OmitBaseSchema(updateSchema);
@@ -146156,7 +146144,7 @@ var DiscountModel;
146156
146144
  ], {
146157
146145
  description: "Condition value based on the condition type selected"
146158
146146
  });
146159
- const createConditionSchema = createInsertSchema2(crmDiscountConditionTable);
146147
+ const createConditionSchema = createInsertSchema(crmDiscountConditionTable);
146160
146148
  const updateConditionSchema = createUpdateSchema(crmDiscountConditionTable);
146161
146149
  DiscountModel.createCondition = t.Composite([
146162
146150
  OmitBaseSchema(createConditionSchema),
@@ -146170,7 +146158,7 @@ var DiscountModel;
146170
146158
  conditionValue: ConditionValueUnion
146171
146159
  }))
146172
146160
  ]);
146173
- const createApplySchema = createInsertSchema2(crmDiscountApplyTable);
146161
+ const createApplySchema = createInsertSchema(crmDiscountApplyTable);
146174
146162
  DiscountModel.createApply = t.Omit(OmitBaseSchema(createApplySchema), [
146175
146163
  "authUserId",
146176
146164
  "employeeId"
@@ -146222,8 +146210,9 @@ var CrmInspectionLogic;
146222
146210
  CrmInspectionLogic.select = async (query, user2) => {
146223
146211
  const baseQuery = db_default.select({
146224
146212
  inspection: crmInspectionTable,
146213
+ vehicle: crmVehicleTable,
146225
146214
  totalCount: totalCountSql
146226
- }).from(crmInspectionTable).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).$dynamic();
146215
+ }).from(crmInspectionTable).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).innerJoin(crmVehicleTable, eq(crmInspectionTable.vehicleId, crmVehicleTable.id)).$dynamic();
146227
146216
  const result = await pagination_helper_default(baseQuery, query.pagination);
146228
146217
  const content = {
146229
146218
  totalCount: result[0]?.totalCount ?? 0,
@@ -146297,31 +146286,40 @@ var CrmInspectionLogic;
146297
146286
  retry: 3
146298
146287
  });
146299
146288
  };
146289
+ CrmInspectionLogic.selectUbCab = async (licensePlate) => {
146290
+ const inspections = await db_default.select({
146291
+ inspection: crmInspectionTable,
146292
+ company: {
146293
+ id: companyCompanyTable.id,
146294
+ name: companyCompanyTable.name,
146295
+ logo: companyCompanyTable.logoUrl
146296
+ },
146297
+ branch: {
146298
+ id: companyBranchTable.id,
146299
+ name: companyBranchTable.name
146300
+ }
146301
+ }).from(crmInspectionTable).innerJoin(companyCompanyTable, eq(crmInspectionTable.companyId, companyCompanyTable.id)).innerJoin(companyBranchTable, eq(crmInspectionTable.branchId, companyBranchTable.id)).where(eq(crmInspectionTable.licensePlate, licensePlate));
146302
+ return inspections;
146303
+ };
146300
146304
  })(CrmInspectionLogic ||= {});
146301
146305
  var logic_default13 = CrmInspectionLogic;
146302
146306
 
146303
146307
  // src/routes/crm/inspection/model.ts
146304
146308
  var CrmInspectionModel;
146305
146309
  ((CrmInspectionModel) => {
146306
- const inspectionSchema = t.Object({
146307
- type: t.String(),
146308
- values: t.Object({
146309
- question: t.String(),
146310
- answer: t.String(),
146311
- description: t.Optional(t.String())
146312
- })
146313
- });
146314
- const createSchema = createInsertSchema(crmInspectionTable, {
146315
- inspection: t.Array(inspectionSchema, {
146316
- minItems: 1
146317
- })
146310
+ CrmInspectionModel.create = t.Object({
146311
+ inspection: t.Array(t.Object({
146312
+ type: t.String(),
146313
+ values: t.Array(t.Object({
146314
+ question: t.String(),
146315
+ answer: t.String(),
146316
+ description: t.String()
146317
+ }))
146318
+ })),
146319
+ licensePlate: t.String(),
146320
+ description: t.Optional(t.String()),
146321
+ employeeId: t.Optional(t.String({ format: "uuid" }))
146318
146322
  });
146319
- CrmInspectionModel.create = t.Omit(OmitBaseSchema(createSchema), [
146320
- "expireAt",
146321
- "companyId",
146322
- "branchId",
146323
- "vehicleId"
146324
- ]);
146325
146323
  CrmInspectionModel.select = t.Composite([
146326
146324
  t.Partial(t.Object({
146327
146325
  search: t.String(),
@@ -146330,6 +146328,9 @@ var CrmInspectionModel;
146330
146328
  })),
146331
146329
  PaginationSchema
146332
146330
  ]);
146331
+ CrmInspectionModel.selectUbCab = t.Object({
146332
+ licensePlate: t.String()
146333
+ });
146333
146334
  })(CrmInspectionModel ||= {});
146334
146335
  var model_default11 = CrmInspectionModel;
146335
146336
 
@@ -146337,7 +146338,10 @@ var model_default11 = CrmInspectionModel;
146337
146338
  var inspectionRoutes = new Elysia({
146338
146339
  prefix: "/inspection",
146339
146340
  tags: ["CrmInspection"]
146340
- }).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("CrmInspectionModel", model_default11)).get("/", async ({ query, user: user2 }) => logic_default13.select(query, user2), {
146341
+ }).use(better_auth_default).model(prefix_model_default("CrmInspectionModel", model_default11)).get("/ubcab", async ({ query: { licensePlate } }) => logic_default13.selectUbCab(licensePlate), {
146342
+ query: "CrmInspectionModel.selectUbCab",
146343
+ auth: false
146344
+ }).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default13.select(query, user2), {
146341
146345
  query: "CrmInspectionModel.select"
146342
146346
  }).post("/", async ({ body, user: user2 }) => logic_default13.create(body, user2), {
146343
146347
  body: "CrmInspectionModel.create"
@@ -146349,7 +146353,7 @@ var inspection_default = inspectionRoutes;
146349
146353
  // src/routes/crm/spPackage/model.ts
146350
146354
  var CrmSpPackageModel;
146351
146355
  ((CrmSpPackageModel) => {
146352
- const createSchema = createInsertSchema2(crmSpPackageTable);
146356
+ const createSchema = createInsertSchema(crmSpPackageTable);
146353
146357
  const updateSchema = createUpdateSchema(crmSpPackageTable);
146354
146358
  const selectSchema = createSelectSchema(crmSpPackageTable);
146355
146359
  CrmSpPackageModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
@@ -146410,7 +146414,7 @@ var logic_default14 = CrmSpPackageProductLogic;
146410
146414
  // src/routes/crm/spPackage/product/model.ts
146411
146415
  var CrmSpPackageProductModel;
146412
146416
  ((CrmSpPackageProductModel) => {
146413
- const createSchema = createInsertSchema2(crmSpPackageProductTable);
146417
+ const createSchema = createInsertSchema(crmSpPackageProductTable);
146414
146418
  const updateSchema = createUpdateSchema(crmSpPackageProductTable);
146415
146419
  const selectSchema = createSelectSchema(crmSpPackageProductTable);
146416
146420
  CrmSpPackageProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["priceTotal"]);
@@ -146483,7 +146487,7 @@ var logic_default15 = CrmSpPackageServiceLogic;
146483
146487
  // src/routes/crm/spPackage/service/model.ts
146484
146488
  var CrmSpPackageServiceModel;
146485
146489
  ((CrmSpPackageServiceModel) => {
146486
- const createSchema = createInsertSchema2(crmSpPackageServiceTable);
146490
+ const createSchema = createInsertSchema(crmSpPackageServiceTable);
146487
146491
  const updateSchema = createUpdateSchema(crmSpPackageServiceTable);
146488
146492
  const selectSchema = createSelectSchema(crmSpPackageServiceTable);
146489
146493
  CrmSpPackageServiceModel.create = OmitBaseSchema(createSchema);
@@ -146529,8 +146533,12 @@ var spPackage_default = spPackageRoutes;
146529
146533
  // src/routes/crm/vehicle/model.ts
146530
146534
  var CrmVehicleModel;
146531
146535
  ((CrmVehicleModel) => {
146532
- const createSchema = createInsertSchema(crmVehicleTable);
146533
- CrmVehicleModel.create = OmitBaseSchema(createSchema);
146536
+ CrmVehicleModel.create = t.Object({
146537
+ vin: t.Optional(t.String()),
146538
+ licensePlate: t.Optional(t.String()),
146539
+ vehicleKindId: t.Optional(t.String({ format: "uuid" })),
146540
+ customerId: t.Optional(t.String())
146541
+ });
146534
146542
  const updateSchema = createUpdateSchema(crmVehicleTable);
146535
146543
  CrmVehicleModel.update = t.Partial(OmitBaseSchema(updateSchema));
146536
146544
  CrmVehicleModel.select = t.Composite([
@@ -146842,7 +146850,7 @@ var logic_default16 = PermissionLogic;
146842
146850
  // src/routes/permission/model.ts
146843
146851
  var PermissionModel;
146844
146852
  ((PermissionModel) => {
146845
- const createSchema = createInsertSchema2(permissionGroupTable);
146853
+ const createSchema = createInsertSchema(permissionGroupTable);
146846
146854
  const updateSchema = createUpdateSchema(permissionGroupTable);
146847
146855
  PermissionModel.create = OmitBaseSchema(createSchema);
146848
146856
  PermissionModel.update = OmitBaseSchema(updateSchema);
@@ -146939,7 +146947,7 @@ var TechdocSupplierModel;
146939
146947
  byCompany: t.Boolean()
146940
146948
  }))
146941
146949
  ]);
146942
- const createSchema = createInsertSchema2(techdocSupplierTable);
146950
+ const createSchema = createInsertSchema(techdocSupplierTable);
146943
146951
  TechdocSupplierModel.create = OmitBaseSchema(createSchema);
146944
146952
  const updateSchema = createUpdateSchema(techdocSupplierTable);
146945
146953
  TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
@@ -147179,7 +147187,7 @@ var logic_default18 = UserLogic;
147179
147187
 
147180
147188
  // src/routes/user/schema.ts
147181
147189
  var select = createSelectSchema(user);
147182
- var create2 = createInsertSchema2(user);
147190
+ var create2 = createInsertSchema(user);
147183
147191
  var update = createUpdateSchema(user);
147184
147192
  var selectUserSchema = t.Composite([
147185
147193
  PaginationSchema,
@@ -147231,7 +147239,7 @@ var user_default2 = userRoutes;
147231
147239
  // src/routes/warehouse/product/model.ts
147232
147240
  var WarehouseProductModel;
147233
147241
  ((WarehouseProductModel) => {
147234
- const createSchema = createInsertSchema2(warehouseProductTable);
147242
+ const createSchema = createInsertSchema(warehouseProductTable);
147235
147243
  const updateSchema = createUpdateSchema(warehouseProductTable);
147236
147244
  WarehouseProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
147237
147245
  WarehouseProductModel.update = OmitBaseSchema(updateSchema);
@@ -147257,7 +147265,7 @@ var model_default19 = WarehouseProductModel;
147257
147265
  // src/routes/warehouse/item/model.ts
147258
147266
  var WarehouseItemModel;
147259
147267
  ((WarehouseItemModel) => {
147260
- const createSchema = createInsertSchema2(warehouseItemTable);
147268
+ const createSchema = createInsertSchema(warehouseItemTable);
147261
147269
  const updateSchema = createUpdateSchema(warehouseItemTable);
147262
147270
  WarehouseItemModel.create = OmitBaseSchema(createSchema);
147263
147271
  WarehouseItemModel.update = t.Omit(OmitBaseSchema(updateSchema), ["quantity"]);
@@ -147292,7 +147300,7 @@ var WarehouseItemModel;
147292
147300
  maxQuantity: t.Number({ minimum: 0 })
147293
147301
  }))
147294
147302
  ]);
147295
- const createTransactionSchema = createInsertSchema2(warehouseItemTransactionTable);
147303
+ const createTransactionSchema = createInsertSchema(warehouseItemTransactionTable);
147296
147304
  const transactionDetails = t.Pick(createTransactionSchema, [
147297
147305
  "transactionType",
147298
147306
  "transactionKind",
@@ -147395,7 +147403,7 @@ var logic_default19 = WarehouseWarehouseLogic;
147395
147403
  // src/routes/warehouse/warehouse/model.ts
147396
147404
  var WarehouseWarehouseModel;
147397
147405
  ((WarehouseWarehouseModel) => {
147398
- const createSchema = createInsertSchema2(warehouseWarehouseTable);
147406
+ const createSchema = createInsertSchema(warehouseWarehouseTable);
147399
147407
  const updateSchema = createUpdateSchema(warehouseWarehouseTable);
147400
147408
  WarehouseWarehouseModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
147401
147409
  WarehouseWarehouseModel.update = t.Omit(OmitBaseSchema(updateSchema), [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.1.54",
3
+ "version": "1.1.56",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",