autosync_backend2 1.1.53 → 1.1.55

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +156 -156
  2. package/dist/index.js +77 -75
  3. package/package.json +1 -1
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,27 +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
- }>;
711
- employeeId: import("@sinclair/typebox").TString;
712
- description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
713
- isApproved: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
707
+ description: import("@sinclair/typebox").TString;
708
+ }>>;
714
709
  }>>;
715
- experience: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
716
- rank: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
717
710
  licensePlate: import("@sinclair/typebox").TString;
718
- status: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
719
- CREATED: "CREATED";
720
- APPROVED: "APPROVED";
721
- CANCELLED: "CANCELLED";
722
- }>>;
711
+ description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
712
+ employeeId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
723
713
  }>;
724
714
  readonly "CrmInspectionModel.select": import("@sinclair/typebox").TObject<{
725
715
  search: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -730,6 +720,9 @@ export declare const app: Elysia<"", {
730
720
  size: import("@sinclair/typebox").TInteger;
731
721
  }>;
732
722
  }>;
723
+ readonly "CrmInspectionModel.selectUbCab": import("@sinclair/typebox").TObject<{
724
+ licensePlate: import("@sinclair/typebox").TString;
725
+ }>;
733
726
  readonly "TechdocSupplierModel.select": import("@sinclair/typebox").TObject<{
734
727
  pagination: import("@sinclair/typebox").TObject<{
735
728
  page: import("@sinclair/typebox").TInteger;
@@ -4733,9 +4726,9 @@ export declare const app: Elysia<"", {
4733
4726
  body: {
4734
4727
  companyId?: string | undefined;
4735
4728
  isNoat?: boolean | null | undefined;
4736
- vehicleId?: string | undefined;
4737
4729
  customerId?: string | null | undefined;
4738
4730
  km?: number | undefined;
4731
+ vehicleId?: string | undefined;
4739
4732
  companyBranchId?: string | undefined;
4740
4733
  orderId?: string | undefined;
4741
4734
  state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
@@ -5548,24 +5541,10 @@ export declare const app: Elysia<"", {
5548
5541
  fleet: {
5549
5542
  post: {
5550
5543
  body: {
5551
- companyId?: string | null | undefined;
5552
- licensePlate?: string | null | undefined;
5553
- customerId?: string | null | undefined;
5554
- vin?: string | null | undefined;
5555
- color?: string | null | undefined;
5556
- engineCc?: string | null | undefined;
5557
- cylinder?: string | null | undefined;
5558
- gasType?: string | null | undefined;
5559
- transmissionType?: string | null | undefined;
5560
- vehicleType?: string | null | undefined;
5561
- yearManufacture?: number | null | undefined;
5562
- yearImport?: number | null | undefined;
5563
- steering?: string | null | undefined;
5564
- engineCode?: string | null | undefined;
5565
- transmissionCode?: string | null | undefined;
5566
- driveTrain?: string | null | undefined;
5567
- km?: number | undefined;
5568
- vehicleKindId: string;
5544
+ licensePlate?: string | undefined;
5545
+ customerId?: string | undefined;
5546
+ vehicleKindId?: string | undefined;
5547
+ vin?: string | undefined;
5569
5548
  };
5570
5549
  params: {};
5571
5550
  query: unknown;
@@ -5595,6 +5574,8 @@ export declare const app: Elysia<"", {
5595
5574
  driveTrain: string | null;
5596
5575
  km: number;
5597
5576
  };
5577
+ 502: string;
5578
+ 400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
5598
5579
  422: {
5599
5580
  type: "validation";
5600
5581
  on: string;
@@ -6391,38 +6372,27 @@ export declare const app: Elysia<"", {
6391
6372
  inspection: {};
6392
6373
  } & {
6393
6374
  inspection: {
6394
- get: {
6395
- body: unknown;
6396
- params: {};
6397
- query: {
6398
- search?: string | undefined;
6399
- licensePlate?: string | undefined;
6400
- status?: string | undefined;
6401
- pagination: {
6402
- size: number;
6403
- page: number;
6375
+ ubcab: {
6376
+ get: {
6377
+ body: unknown;
6378
+ params: {};
6379
+ query: {
6380
+ licensePlate: string;
6404
6381
  };
6405
- };
6406
- headers: unknown;
6407
- response: {
6408
- 200: {
6409
- totalCount: number;
6410
- totalPage: number;
6411
- result: {
6382
+ headers: unknown;
6383
+ response: {
6384
+ 200: {
6412
6385
  inspection: {
6413
6386
  companyId: string;
6414
6387
  branchId: string;
6415
6388
  vehicleId: string;
6416
6389
  inspection: {
6417
- description?: string | undefined;
6418
- isApproved?: boolean | undefined;
6419
6390
  type: string;
6420
- employeeId: string;
6421
6391
  values: {
6422
- description?: string | undefined;
6392
+ description: string;
6423
6393
  question: string;
6424
6394
  answer: string;
6425
- };
6395
+ }[];
6426
6396
  }[] | null;
6427
6397
  employeeId: string | null;
6428
6398
  expireAt: Date;
@@ -6436,70 +6406,60 @@ export declare const app: Elysia<"", {
6436
6406
  updatedAt: string;
6437
6407
  deletedAt: string | null;
6438
6408
  };
6439
- vehicle: {
6440
- customerId: string | null;
6441
- vehicleKindId: string;
6442
- vin: string | null;
6443
- licensePlate: string | null;
6444
- color: string | null;
6445
- engineCc: string | null;
6446
- cylinder: string | null;
6447
- gasType: string | null;
6448
- transmissionType: string | null;
6449
- vehicleType: string | null;
6450
- yearManufacture: number | null;
6451
- yearImport: number | null;
6452
- steering: string | null;
6453
- engineCode: string | null;
6454
- transmissionCode: string | null;
6455
- driveTrain: string | null;
6456
- km: number;
6457
- companyId: string | null;
6409
+ company: {
6458
6410
  id: string;
6459
- createdAt: string;
6460
- updatedAt: string;
6461
- deletedAt: string | null;
6462
- } | null;
6411
+ name: string;
6412
+ logo: string;
6413
+ };
6414
+ branch: {
6415
+ id: string;
6416
+ name: string;
6417
+ };
6463
6418
  }[];
6464
- };
6465
- 422: {
6466
- type: "validation";
6467
- on: string;
6468
- summary?: string;
6469
- message?: string;
6470
- found?: unknown;
6471
- property?: string;
6472
- expected?: string;
6419
+ 422: {
6420
+ type: "validation";
6421
+ on: string;
6422
+ summary?: string;
6423
+ message?: string;
6424
+ found?: unknown;
6425
+ property?: string;
6426
+ expected?: string;
6427
+ };
6473
6428
  };
6474
6429
  };
6475
6430
  };
6476
6431
  };
6477
6432
  } & {
6478
6433
  inspection: {
6479
- ":id": {
6480
- get: {
6481
- body: unknown;
6482
- params: {
6483
- id: string;
6434
+ get: {
6435
+ body: unknown;
6436
+ params: {};
6437
+ query: {
6438
+ search?: string | undefined;
6439
+ licensePlate?: string | undefined;
6440
+ status?: string | undefined;
6441
+ pagination: {
6442
+ size: number;
6443
+ page: number;
6484
6444
  };
6485
- query: unknown;
6486
- headers: unknown;
6487
- response: {
6488
- 200: {
6445
+ };
6446
+ headers: unknown;
6447
+ response: {
6448
+ 200: {
6449
+ totalCount: number;
6450
+ totalPage: number;
6451
+ result: {
6489
6452
  inspection: {
6490
6453
  companyId: string;
6491
6454
  branchId: string;
6492
6455
  vehicleId: string;
6493
6456
  inspection: {
6494
- description?: string | undefined;
6495
- isApproved?: boolean | undefined;
6496
6457
  type: string;
6497
- employeeId: string;
6498
6458
  values: {
6499
- description?: string | undefined;
6459
+ description: string;
6500
6460
  question: string;
6501
6461
  answer: string;
6502
- };
6462
+ }[];
6503
6463
  }[] | null;
6504
6464
  employeeId: string | null;
6505
6465
  expireAt: Date;
@@ -6513,41 +6473,16 @@ export declare const app: Elysia<"", {
6513
6473
  updatedAt: string;
6514
6474
  deletedAt: string | null;
6515
6475
  };
6516
- vehicle: {
6517
- customerId: string | null;
6518
- vehicleKindId: string;
6519
- vin: string | null;
6520
- licensePlate: string | null;
6521
- color: string | null;
6522
- engineCc: string | null;
6523
- cylinder: string | null;
6524
- gasType: string | null;
6525
- transmissionType: string | null;
6526
- vehicleType: string | null;
6527
- yearManufacture: number | null;
6528
- yearImport: number | null;
6529
- steering: string | null;
6530
- engineCode: string | null;
6531
- transmissionCode: string | null;
6532
- driveTrain: string | null;
6533
- km: number;
6534
- companyId: string | null;
6535
- id: string;
6536
- createdAt: string;
6537
- updatedAt: string;
6538
- deletedAt: string | null;
6539
- } | null;
6540
- };
6541
- 404: "Үзлэг олдсонгүй.";
6542
- 422: {
6543
- type: "validation";
6544
- on: string;
6545
- summary?: string;
6546
- message?: string;
6547
- found?: unknown;
6548
- property?: string;
6549
- expected?: string;
6550
- };
6476
+ }[];
6477
+ };
6478
+ 422: {
6479
+ type: "validation";
6480
+ on: string;
6481
+ summary?: string;
6482
+ message?: string;
6483
+ found?: unknown;
6484
+ property?: string;
6485
+ expected?: string;
6551
6486
  };
6552
6487
  };
6553
6488
  };
@@ -6556,21 +6491,15 @@ export declare const app: Elysia<"", {
6556
6491
  inspection: {
6557
6492
  post: {
6558
6493
  body: {
6559
- employeeId?: string | null | undefined;
6560
- description?: string | null | undefined;
6561
- experience?: string | null | undefined;
6562
- rank?: string | null | undefined;
6563
- status?: "CREATED" | "APPROVED" | "CANCELLED" | undefined;
6494
+ employeeId?: string | undefined;
6495
+ description?: string | undefined;
6564
6496
  inspection: {
6565
- description?: string | undefined;
6566
- isApproved?: boolean | undefined;
6567
6497
  type: string;
6568
- employeeId: string;
6569
6498
  values: {
6570
- description?: string | undefined;
6499
+ description: string;
6571
6500
  question: string;
6572
6501
  answer: string;
6573
- };
6502
+ }[];
6574
6503
  }[];
6575
6504
  licensePlate: string;
6576
6505
  };
@@ -6587,23 +6516,20 @@ export declare const app: Elysia<"", {
6587
6516
  employeeId: string | null;
6588
6517
  deletedAt: string | null;
6589
6518
  description: string | null;
6590
- vehicleId: string;
6591
6519
  inspection: {
6592
- description?: string | undefined;
6593
- isApproved?: boolean | undefined;
6594
6520
  type: string;
6595
- employeeId: string;
6596
6521
  values: {
6597
- description?: string | undefined;
6522
+ description: string;
6598
6523
  question: string;
6599
6524
  answer: string;
6600
- };
6525
+ }[];
6601
6526
  }[] | null;
6527
+ licensePlate: string;
6528
+ status: "CREATED" | "APPROVED" | "CANCELLED";
6529
+ vehicleId: string;
6602
6530
  expireAt: Date;
6603
6531
  experience: string | null;
6604
6532
  rank: string | null;
6605
- licensePlate: string;
6606
- status: "CREATED" | "APPROVED" | "CANCELLED";
6607
6533
  };
6608
6534
  502: string;
6609
6535
  400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
@@ -6619,6 +6545,80 @@ export declare const app: Elysia<"", {
6619
6545
  };
6620
6546
  };
6621
6547
  };
6548
+ } & {
6549
+ inspection: {
6550
+ ":id": {
6551
+ get: {
6552
+ body: unknown;
6553
+ params: {
6554
+ id: string;
6555
+ };
6556
+ query: unknown;
6557
+ headers: unknown;
6558
+ response: {
6559
+ 200: {
6560
+ companyId: string;
6561
+ branchId: string;
6562
+ vehicleId: string;
6563
+ inspection: {
6564
+ type: string;
6565
+ values: {
6566
+ description: string;
6567
+ question: string;
6568
+ answer: string;
6569
+ }[];
6570
+ }[] | null;
6571
+ employeeId: string | null;
6572
+ expireAt: Date;
6573
+ experience: string | null;
6574
+ rank: string | null;
6575
+ licensePlate: string;
6576
+ description: string | null;
6577
+ status: "CREATED" | "APPROVED" | "CANCELLED";
6578
+ id: string;
6579
+ createdAt: string;
6580
+ updatedAt: string;
6581
+ deletedAt: string | null;
6582
+ };
6583
+ 404: "Үзлэг олдсонгүй.";
6584
+ 422: {
6585
+ type: "validation";
6586
+ on: string;
6587
+ summary?: string;
6588
+ message?: string;
6589
+ found?: unknown;
6590
+ property?: string;
6591
+ expected?: string;
6592
+ };
6593
+ };
6594
+ };
6595
+ };
6596
+ };
6597
+ } & {
6598
+ inspection: {
6599
+ ":id": {
6600
+ post: {
6601
+ body: unknown;
6602
+ params: {
6603
+ id: string;
6604
+ };
6605
+ query: unknown;
6606
+ headers: unknown;
6607
+ response: {
6608
+ 200: void;
6609
+ 422: {
6610
+ type: "validation";
6611
+ on: string;
6612
+ summary?: string;
6613
+ message?: string;
6614
+ found?: unknown;
6615
+ property?: string;
6616
+ expected?: string;
6617
+ };
6618
+ };
6619
+ };
6620
+ };
6621
+ };
6622
6622
  } & {
6623
6623
  inspection: {
6624
6624
  ":id": {
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,9 +146210,8 @@ var CrmInspectionLogic;
146222
146210
  CrmInspectionLogic.select = async (query, user2) => {
146223
146211
  const baseQuery = db_default.select({
146224
146212
  inspection: crmInspectionTable,
146225
- vehicle: crmVehicleTable,
146226
146213
  totalCount: totalCountSql
146227
- }).from(crmInspectionTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).$dynamic();
146214
+ }).from(crmInspectionTable).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).$dynamic();
146228
146215
  const result = await pagination_helper_default(baseQuery, query.pagination);
146229
146216
  const content = {
146230
146217
  totalCount: result[0]?.totalCount ?? 0,
@@ -146236,10 +146223,7 @@ var CrmInspectionLogic;
146236
146223
  };
146237
146224
  };
146238
146225
  CrmInspectionLogic.getById = async (id, user2) => {
146239
- const [inspection] = await db_default.select({
146240
- inspection: crmInspectionTable,
146241
- vehicle: crmVehicleTable
146242
- }).from(crmInspectionTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"), softDeletedFilter(crmInspectionTable)));
146226
+ const [inspection] = await db_default.select().from(crmInspectionTable).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"), softDeletedFilter(crmInspectionTable)));
146243
146227
  if (!inspection) {
146244
146228
  return status("Not Found", "\u04AE\u0437\u043B\u044D\u0433 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
146245
146229
  }
@@ -146293,9 +146277,28 @@ var CrmInspectionLogic;
146293
146277
  };
146294
146278
  };
146295
146279
  CrmInspectionLogic.approve = async (id, user2) => {
146296
- await db_default.update(crmInspectionTable).set({
146280
+ const [inspection] = await db_default.update(crmInspectionTable).set({
146297
146281
  status: "APPROVED"
146298
- }).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER")));
146282
+ }).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"))).returning();
146283
+ await distribution_default.post("https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection", {
146284
+ json: inspection,
146285
+ retry: 3
146286
+ });
146287
+ };
146288
+ CrmInspectionLogic.selectUbCab = async (licensePlate) => {
146289
+ const inspections = await db_default.select({
146290
+ inspection: crmInspectionTable,
146291
+ company: {
146292
+ id: companyCompanyTable.id,
146293
+ name: companyCompanyTable.name,
146294
+ logo: companyCompanyTable.logoUrl
146295
+ },
146296
+ branch: {
146297
+ id: companyBranchTable.id,
146298
+ name: companyBranchTable.name
146299
+ }
146300
+ }).from(crmInspectionTable).innerJoin(companyCompanyTable, eq(crmInspectionTable.companyId, companyCompanyTable.id)).innerJoin(companyBranchTable, eq(crmInspectionTable.branchId, companyBranchTable.id)).where(eq(crmInspectionTable.licensePlate, licensePlate));
146301
+ return inspections;
146299
146302
  };
146300
146303
  })(CrmInspectionLogic ||= {});
146301
146304
  var logic_default13 = CrmInspectionLogic;
@@ -146303,28 +146306,19 @@ var logic_default13 = CrmInspectionLogic;
146303
146306
  // src/routes/crm/inspection/model.ts
146304
146307
  var CrmInspectionModel;
146305
146308
  ((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
- employeeId: t.String({ format: "uuid" }),
146309
+ CrmInspectionModel.create = t.Object({
146310
+ inspection: t.Array(t.Object({
146311
+ type: t.String(),
146312
+ values: t.Array(t.Object({
146313
+ question: t.String(),
146314
+ answer: t.String(),
146315
+ description: t.String()
146316
+ }))
146317
+ })),
146318
+ licensePlate: t.String(),
146314
146319
  description: t.Optional(t.String()),
146315
- isApproved: t.Optional(t.Boolean())
146320
+ employeeId: t.Optional(t.String({ format: "uuid" }))
146316
146321
  });
146317
- const createSchema = createInsertSchema(crmInspectionTable, {
146318
- inspection: t.Array(inspectionSchema, {
146319
- minItems: 1
146320
- })
146321
- });
146322
- CrmInspectionModel.create = t.Omit(OmitBaseSchema(createSchema), [
146323
- "expireAt",
146324
- "companyId",
146325
- "branchId",
146326
- "vehicleId"
146327
- ]);
146328
146322
  CrmInspectionModel.select = t.Composite([
146329
146323
  t.Partial(t.Object({
146330
146324
  search: t.String(),
@@ -146333,6 +146327,9 @@ var CrmInspectionModel;
146333
146327
  })),
146334
146328
  PaginationSchema
146335
146329
  ]);
146330
+ CrmInspectionModel.selectUbCab = t.Object({
146331
+ licensePlate: t.String()
146332
+ });
146336
146333
  })(CrmInspectionModel ||= {});
146337
146334
  var model_default11 = CrmInspectionModel;
146338
146335
 
@@ -146340,21 +146337,22 @@ var model_default11 = CrmInspectionModel;
146340
146337
  var inspectionRoutes = new Elysia({
146341
146338
  prefix: "/inspection",
146342
146339
  tags: ["CrmInspection"]
146343
- }).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("CrmInspectionModel", model_default11)).get("/", async ({ query, user: user2 }) => logic_default13.select(query, user2), {
146340
+ }).use(better_auth_default).model(prefix_model_default("CrmInspectionModel", model_default11)).get("/ubcab", async ({ query: { licensePlate } }) => logic_default13.selectUbCab(licensePlate), {
146341
+ query: "CrmInspectionModel.selectUbCab",
146342
+ auth: false
146343
+ }).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default13.select(query, user2), {
146344
146344
  query: "CrmInspectionModel.select"
146345
- }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default13.getById(id, user2), {
146346
- params: IdSchema
146347
146345
  }).post("/", async ({ body, user: user2 }) => logic_default13.create(body, user2), {
146348
146346
  body: "CrmInspectionModel.create"
146349
- }).post("/:id/service-order", async ({ params: { id }, user: user2 }) => logic_default13.createCpOrder(id, user2), {
146347
+ }).guard({
146350
146348
  params: IdSchema
146351
- });
146349
+ }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default13.getById(id, user2)).post("/:id", async ({ params: { id }, user: user2 }) => logic_default13.approve(id, user2)).post("/:id/service-order", async ({ params: { id }, user: user2 }) => logic_default13.createCpOrder(id, user2));
146352
146350
  var inspection_default = inspectionRoutes;
146353
146351
 
146354
146352
  // src/routes/crm/spPackage/model.ts
146355
146353
  var CrmSpPackageModel;
146356
146354
  ((CrmSpPackageModel) => {
146357
- const createSchema = createInsertSchema2(crmSpPackageTable);
146355
+ const createSchema = createInsertSchema(crmSpPackageTable);
146358
146356
  const updateSchema = createUpdateSchema(crmSpPackageTable);
146359
146357
  const selectSchema = createSelectSchema(crmSpPackageTable);
146360
146358
  CrmSpPackageModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
@@ -146415,7 +146413,7 @@ var logic_default14 = CrmSpPackageProductLogic;
146415
146413
  // src/routes/crm/spPackage/product/model.ts
146416
146414
  var CrmSpPackageProductModel;
146417
146415
  ((CrmSpPackageProductModel) => {
146418
- const createSchema = createInsertSchema2(crmSpPackageProductTable);
146416
+ const createSchema = createInsertSchema(crmSpPackageProductTable);
146419
146417
  const updateSchema = createUpdateSchema(crmSpPackageProductTable);
146420
146418
  const selectSchema = createSelectSchema(crmSpPackageProductTable);
146421
146419
  CrmSpPackageProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["priceTotal"]);
@@ -146488,7 +146486,7 @@ var logic_default15 = CrmSpPackageServiceLogic;
146488
146486
  // src/routes/crm/spPackage/service/model.ts
146489
146487
  var CrmSpPackageServiceModel;
146490
146488
  ((CrmSpPackageServiceModel) => {
146491
- const createSchema = createInsertSchema2(crmSpPackageServiceTable);
146489
+ const createSchema = createInsertSchema(crmSpPackageServiceTable);
146492
146490
  const updateSchema = createUpdateSchema(crmSpPackageServiceTable);
146493
146491
  const selectSchema = createSelectSchema(crmSpPackageServiceTable);
146494
146492
  CrmSpPackageServiceModel.create = OmitBaseSchema(createSchema);
@@ -146534,8 +146532,12 @@ var spPackage_default = spPackageRoutes;
146534
146532
  // src/routes/crm/vehicle/model.ts
146535
146533
  var CrmVehicleModel;
146536
146534
  ((CrmVehicleModel) => {
146537
- const createSchema = createInsertSchema(crmVehicleTable);
146538
- CrmVehicleModel.create = OmitBaseSchema(createSchema);
146535
+ CrmVehicleModel.create = t.Object({
146536
+ vin: t.Optional(t.String()),
146537
+ licensePlate: t.Optional(t.String()),
146538
+ vehicleKindId: t.Optional(t.String({ format: "uuid" })),
146539
+ customerId: t.Optional(t.String())
146540
+ });
146539
146541
  const updateSchema = createUpdateSchema(crmVehicleTable);
146540
146542
  CrmVehicleModel.update = t.Partial(OmitBaseSchema(updateSchema));
146541
146543
  CrmVehicleModel.select = t.Composite([
@@ -146847,7 +146849,7 @@ var logic_default16 = PermissionLogic;
146847
146849
  // src/routes/permission/model.ts
146848
146850
  var PermissionModel;
146849
146851
  ((PermissionModel) => {
146850
- const createSchema = createInsertSchema2(permissionGroupTable);
146852
+ const createSchema = createInsertSchema(permissionGroupTable);
146851
146853
  const updateSchema = createUpdateSchema(permissionGroupTable);
146852
146854
  PermissionModel.create = OmitBaseSchema(createSchema);
146853
146855
  PermissionModel.update = OmitBaseSchema(updateSchema);
@@ -146944,7 +146946,7 @@ var TechdocSupplierModel;
146944
146946
  byCompany: t.Boolean()
146945
146947
  }))
146946
146948
  ]);
146947
- const createSchema = createInsertSchema2(techdocSupplierTable);
146949
+ const createSchema = createInsertSchema(techdocSupplierTable);
146948
146950
  TechdocSupplierModel.create = OmitBaseSchema(createSchema);
146949
146951
  const updateSchema = createUpdateSchema(techdocSupplierTable);
146950
146952
  TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
@@ -147184,7 +147186,7 @@ var logic_default18 = UserLogic;
147184
147186
 
147185
147187
  // src/routes/user/schema.ts
147186
147188
  var select = createSelectSchema(user);
147187
- var create2 = createInsertSchema2(user);
147189
+ var create2 = createInsertSchema(user);
147188
147190
  var update = createUpdateSchema(user);
147189
147191
  var selectUserSchema = t.Composite([
147190
147192
  PaginationSchema,
@@ -147236,7 +147238,7 @@ var user_default2 = userRoutes;
147236
147238
  // src/routes/warehouse/product/model.ts
147237
147239
  var WarehouseProductModel;
147238
147240
  ((WarehouseProductModel) => {
147239
- const createSchema = createInsertSchema2(warehouseProductTable);
147241
+ const createSchema = createInsertSchema(warehouseProductTable);
147240
147242
  const updateSchema = createUpdateSchema(warehouseProductTable);
147241
147243
  WarehouseProductModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
147242
147244
  WarehouseProductModel.update = OmitBaseSchema(updateSchema);
@@ -147262,7 +147264,7 @@ var model_default19 = WarehouseProductModel;
147262
147264
  // src/routes/warehouse/item/model.ts
147263
147265
  var WarehouseItemModel;
147264
147266
  ((WarehouseItemModel) => {
147265
- const createSchema = createInsertSchema2(warehouseItemTable);
147267
+ const createSchema = createInsertSchema(warehouseItemTable);
147266
147268
  const updateSchema = createUpdateSchema(warehouseItemTable);
147267
147269
  WarehouseItemModel.create = OmitBaseSchema(createSchema);
147268
147270
  WarehouseItemModel.update = t.Omit(OmitBaseSchema(updateSchema), ["quantity"]);
@@ -147297,7 +147299,7 @@ var WarehouseItemModel;
147297
147299
  maxQuantity: t.Number({ minimum: 0 })
147298
147300
  }))
147299
147301
  ]);
147300
- const createTransactionSchema = createInsertSchema2(warehouseItemTransactionTable);
147302
+ const createTransactionSchema = createInsertSchema(warehouseItemTransactionTable);
147301
147303
  const transactionDetails = t.Pick(createTransactionSchema, [
147302
147304
  "transactionType",
147303
147305
  "transactionKind",
@@ -147400,7 +147402,7 @@ var logic_default19 = WarehouseWarehouseLogic;
147400
147402
  // src/routes/warehouse/warehouse/model.ts
147401
147403
  var WarehouseWarehouseModel;
147402
147404
  ((WarehouseWarehouseModel) => {
147403
- const createSchema = createInsertSchema2(warehouseWarehouseTable);
147405
+ const createSchema = createInsertSchema(warehouseWarehouseTable);
147404
147406
  const updateSchema = createUpdateSchema(warehouseWarehouseTable);
147405
147407
  WarehouseWarehouseModel.create = t.Omit(OmitBaseSchema(createSchema), ["companyId"]);
147406
147408
  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.53",
3
+ "version": "1.1.55",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",