autosync_backend2 1.1.53 → 1.1.54

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
@@ -708,9 +708,6 @@ export declare const app: Elysia<"", {
708
708
  answer: import("@sinclair/typebox").TString;
709
709
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
710
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>;
714
711
  }>>;
715
712
  experience: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
716
713
  rank: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
@@ -6414,10 +6411,7 @@ export declare const app: Elysia<"", {
6414
6411
  branchId: string;
6415
6412
  vehicleId: string;
6416
6413
  inspection: {
6417
- description?: string | undefined;
6418
- isApproved?: boolean | undefined;
6419
6414
  type: string;
6420
- employeeId: string;
6421
6415
  values: {
6422
6416
  description?: string | undefined;
6423
6417
  question: string;
@@ -6436,30 +6430,6 @@ export declare const app: Elysia<"", {
6436
6430
  updatedAt: string;
6437
6431
  deletedAt: string | null;
6438
6432
  };
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;
6458
- id: string;
6459
- createdAt: string;
6460
- updatedAt: string;
6461
- deletedAt: string | null;
6462
- } | null;
6463
6433
  }[];
6464
6434
  };
6465
6435
  422: {
@@ -6474,84 +6444,6 @@ export declare const app: Elysia<"", {
6474
6444
  };
6475
6445
  };
6476
6446
  };
6477
- } & {
6478
- inspection: {
6479
- ":id": {
6480
- get: {
6481
- body: unknown;
6482
- params: {
6483
- id: string;
6484
- };
6485
- query: unknown;
6486
- headers: unknown;
6487
- response: {
6488
- 200: {
6489
- inspection: {
6490
- companyId: string;
6491
- branchId: string;
6492
- vehicleId: string;
6493
- inspection: {
6494
- description?: string | undefined;
6495
- isApproved?: boolean | undefined;
6496
- type: string;
6497
- employeeId: string;
6498
- values: {
6499
- description?: string | undefined;
6500
- question: string;
6501
- answer: string;
6502
- };
6503
- }[] | null;
6504
- employeeId: string | null;
6505
- expireAt: Date;
6506
- experience: string | null;
6507
- rank: string | null;
6508
- licensePlate: string;
6509
- description: string | null;
6510
- status: "CREATED" | "APPROVED" | "CANCELLED";
6511
- id: string;
6512
- createdAt: string;
6513
- updatedAt: string;
6514
- deletedAt: string | null;
6515
- };
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
- };
6551
- };
6552
- };
6553
- };
6554
- };
6555
6447
  } & {
6556
6448
  inspection: {
6557
6449
  post: {
@@ -6562,10 +6454,7 @@ export declare const app: Elysia<"", {
6562
6454
  rank?: string | null | undefined;
6563
6455
  status?: "CREATED" | "APPROVED" | "CANCELLED" | undefined;
6564
6456
  inspection: {
6565
- description?: string | undefined;
6566
- isApproved?: boolean | undefined;
6567
6457
  type: string;
6568
- employeeId: string;
6569
6458
  values: {
6570
6459
  description?: string | undefined;
6571
6460
  question: string;
@@ -6589,10 +6478,7 @@ export declare const app: Elysia<"", {
6589
6478
  description: string | null;
6590
6479
  vehicleId: string;
6591
6480
  inspection: {
6592
- description?: string | undefined;
6593
- isApproved?: boolean | undefined;
6594
6481
  type: string;
6595
- employeeId: string;
6596
6482
  values: {
6597
6483
  description?: string | undefined;
6598
6484
  question: string;
@@ -6619,6 +6505,80 @@ export declare const app: Elysia<"", {
6619
6505
  };
6620
6506
  };
6621
6507
  };
6508
+ } & {
6509
+ inspection: {
6510
+ ":id": {
6511
+ get: {
6512
+ body: unknown;
6513
+ params: {
6514
+ id: string;
6515
+ };
6516
+ query: unknown;
6517
+ headers: unknown;
6518
+ response: {
6519
+ 200: {
6520
+ companyId: string;
6521
+ branchId: string;
6522
+ vehicleId: string;
6523
+ inspection: {
6524
+ type: string;
6525
+ values: {
6526
+ description?: string | undefined;
6527
+ question: string;
6528
+ answer: string;
6529
+ };
6530
+ }[] | null;
6531
+ employeeId: string | null;
6532
+ expireAt: Date;
6533
+ experience: string | null;
6534
+ rank: string | null;
6535
+ licensePlate: string;
6536
+ description: string | null;
6537
+ status: "CREATED" | "APPROVED" | "CANCELLED";
6538
+ id: string;
6539
+ createdAt: string;
6540
+ updatedAt: string;
6541
+ deletedAt: string | null;
6542
+ };
6543
+ 404: "Үзлэг олдсонгүй.";
6544
+ 422: {
6545
+ type: "validation";
6546
+ on: string;
6547
+ summary?: string;
6548
+ message?: string;
6549
+ found?: unknown;
6550
+ property?: string;
6551
+ expected?: string;
6552
+ };
6553
+ };
6554
+ };
6555
+ };
6556
+ };
6557
+ } & {
6558
+ inspection: {
6559
+ ":id": {
6560
+ post: {
6561
+ body: unknown;
6562
+ params: {
6563
+ id: string;
6564
+ };
6565
+ query: unknown;
6566
+ headers: unknown;
6567
+ response: {
6568
+ 200: void;
6569
+ 422: {
6570
+ type: "validation";
6571
+ on: string;
6572
+ summary?: string;
6573
+ message?: string;
6574
+ found?: unknown;
6575
+ property?: string;
6576
+ expected?: string;
6577
+ };
6578
+ };
6579
+ };
6580
+ };
6581
+ };
6622
6582
  } & {
6623
6583
  inspection: {
6624
6584
  ":id": {
package/dist/index.js CHANGED
@@ -146222,9 +146222,8 @@ var CrmInspectionLogic;
146222
146222
  CrmInspectionLogic.select = async (query, user2) => {
146223
146223
  const baseQuery = db_default.select({
146224
146224
  inspection: crmInspectionTable,
146225
- vehicle: crmVehicleTable,
146226
146225
  totalCount: totalCountSql
146227
- }).from(crmInspectionTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).$dynamic();
146226
+ }).from(crmInspectionTable).where(CrmInspectionLogic.getFilter(query, user2)).orderBy(desc(crmInspectionTable.createdAt)).$dynamic();
146228
146227
  const result = await pagination_helper_default(baseQuery, query.pagination);
146229
146228
  const content = {
146230
146229
  totalCount: result[0]?.totalCount ?? 0,
@@ -146236,10 +146235,7 @@ var CrmInspectionLogic;
146236
146235
  };
146237
146236
  };
146238
146237
  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)));
146238
+ 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
146239
  if (!inspection) {
146244
146240
  return status("Not Found", "\u04AE\u0437\u043B\u044D\u0433 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
146245
146241
  }
@@ -146293,9 +146289,13 @@ var CrmInspectionLogic;
146293
146289
  };
146294
146290
  };
146295
146291
  CrmInspectionLogic.approve = async (id, user2) => {
146296
- await db_default.update(crmInspectionTable).set({
146292
+ const [inspection] = await db_default.update(crmInspectionTable).set({
146297
146293
  status: "APPROVED"
146298
- }).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER")));
146294
+ }).where(and(eq(crmInspectionTable.id, id), eq(crmInspectionTable.companyId, user2.companyId), eq(crmInspectionTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"))).returning();
146295
+ await distribution_default.post("https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection", {
146296
+ json: inspection,
146297
+ retry: 3
146298
+ });
146299
146299
  };
146300
146300
  })(CrmInspectionLogic ||= {});
146301
146301
  var logic_default13 = CrmInspectionLogic;
@@ -146309,10 +146309,7 @@ var CrmInspectionModel;
146309
146309
  question: t.String(),
146310
146310
  answer: t.String(),
146311
146311
  description: t.Optional(t.String())
146312
- }),
146313
- employeeId: t.String({ format: "uuid" }),
146314
- description: t.Optional(t.String()),
146315
- isApproved: t.Optional(t.Boolean())
146312
+ })
146316
146313
  });
146317
146314
  const createSchema = createInsertSchema(crmInspectionTable, {
146318
146315
  inspection: t.Array(inspectionSchema, {
@@ -146342,13 +146339,11 @@ var inspectionRoutes = new Elysia({
146342
146339
  tags: ["CrmInspection"]
146343
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), {
146344
146341
  query: "CrmInspectionModel.select"
146345
- }).get("/:id", async ({ params: { id }, user: user2 }) => logic_default13.getById(id, user2), {
146346
- params: IdSchema
146347
146342
  }).post("/", async ({ body, user: user2 }) => logic_default13.create(body, user2), {
146348
146343
  body: "CrmInspectionModel.create"
146349
- }).post("/:id/service-order", async ({ params: { id }, user: user2 }) => logic_default13.createCpOrder(id, user2), {
146344
+ }).guard({
146350
146345
  params: IdSchema
146351
- });
146346
+ }).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
146347
  var inspection_default = inspectionRoutes;
146353
146348
 
146354
146349
  // src/routes/crm/spPackage/model.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.1.53",
3
+ "version": "1.1.54",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",