autosync_backend2 1.2.27 → 1.2.29

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
@@ -3984,8 +3984,8 @@ export declare const app: Elysia<"", {
3984
3984
  body: {
3985
3985
  phone?: string | undefined;
3986
3986
  licensePlate?: string | undefined;
3987
- vehicleKindId?: string | undefined;
3988
3987
  vin?: string | undefined;
3988
+ vehicleKindId?: string | undefined;
3989
3989
  };
3990
3990
  params: {};
3991
3991
  query: unknown;
@@ -5161,8 +5161,8 @@ export declare const app: Elysia<"", {
5161
5161
  body: {
5162
5162
  customerId?: string | undefined;
5163
5163
  licensePlate?: string | undefined;
5164
- vehicleKindId?: string | undefined;
5165
5164
  vin?: string | undefined;
5165
+ vehicleKindId?: string | undefined;
5166
5166
  };
5167
5167
  params: {};
5168
5168
  query: unknown;
@@ -5177,7 +5177,6 @@ export declare const app: Elysia<"", {
5177
5177
  oldId: number | null;
5178
5178
  customerId: string | null;
5179
5179
  licensePlate: string | null;
5180
- vehicleKindId: string;
5181
5180
  vin: string | null;
5182
5181
  color: string | null;
5183
5182
  engineCc: string | null;
@@ -5193,6 +5192,7 @@ export declare const app: Elysia<"", {
5193
5192
  driveTrain: string | null;
5194
5193
  km: number;
5195
5194
  customData: unknown;
5195
+ vehicleKindId: string;
5196
5196
  };
5197
5197
  400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
5198
5198
  401: "Session not found";
@@ -5317,7 +5317,6 @@ export declare const app: Elysia<"", {
5317
5317
  oldId?: number | null | undefined;
5318
5318
  customerId?: string | null | undefined;
5319
5319
  licensePlate?: string | null | undefined;
5320
- vehicleKindId?: string | undefined;
5321
5320
  vin?: string | null | undefined;
5322
5321
  color?: string | null | undefined;
5323
5322
  engineCc?: string | null | undefined;
@@ -5333,6 +5332,7 @@ export declare const app: Elysia<"", {
5333
5332
  driveTrain?: string | null | undefined;
5334
5333
  km?: number | undefined;
5335
5334
  customData?: import("drizzle-typebox").Json | undefined;
5335
+ vehicleKindId?: string | undefined;
5336
5336
  };
5337
5337
  params: {
5338
5338
  id: string;
@@ -5480,7 +5480,6 @@ export declare const app: Elysia<"", {
5480
5480
  oldId: number | null;
5481
5481
  customerId: string | null;
5482
5482
  licensePlate: string | null;
5483
- vehicleKindId: string;
5484
5483
  vin: string | null;
5485
5484
  color: string | null;
5486
5485
  engineCc: string | null;
@@ -5496,6 +5495,7 @@ export declare const app: Elysia<"", {
5496
5495
  driveTrain: string | null;
5497
5496
  km: number;
5498
5497
  customData: unknown;
5498
+ vehicleKindId: string;
5499
5499
  }[];
5500
5500
  }[];
5501
5501
  };
@@ -8042,18 +8042,48 @@ export declare const app: Elysia<"", {
8042
8042
  totalCount: number;
8043
8043
  totalPage: number;
8044
8044
  result: Omit<{
8045
+ schedule: {
8046
+ companyId: string;
8047
+ machineId: string;
8048
+ templateId: string;
8049
+ daysInterval: number | null;
8050
+ timeNextDue: Date | null;
8051
+ isActive: boolean;
8052
+ id: string;
8053
+ createdAt: string;
8054
+ updatedAt: string;
8055
+ deletedAt: string | null;
8056
+ oldId: number | null;
8057
+ };
8058
+ machine: {
8059
+ companyId: string | null;
8060
+ machineKindId: string;
8061
+ customerId: string | null;
8062
+ name: string | null;
8063
+ assetCode: string | null;
8064
+ vin: string | null;
8065
+ licensePlate: string | null;
8066
+ color: string | null;
8067
+ engineCc: string | null;
8068
+ cylinder: string | null;
8069
+ gasType: string | null;
8070
+ transmissionType: string | null;
8071
+ vehicleType: string | null;
8072
+ yearManufacture: number | null;
8073
+ yearImport: number | null;
8074
+ steering: string | null;
8075
+ engineCode: string | null;
8076
+ transmissionCode: string | null;
8077
+ driveTrain: string | null;
8078
+ km: number;
8079
+ customData: unknown;
8080
+ id: string;
8081
+ createdAt: string;
8082
+ updatedAt: string;
8083
+ deletedAt: string | null;
8084
+ oldId: number | null;
8085
+ } | null;
8045
8086
  totalCount: number;
8046
- companyId: string;
8047
- machineId: string;
8048
- templateId: string;
8049
- daysInterval: number | null;
8050
- timeNextDue: Date | null;
8051
- isActive: boolean;
8052
- id: string;
8053
- createdAt: string;
8054
- updatedAt: string;
8055
- deletedAt: string | null;
8056
- oldId: number | null;
8057
8087
  }, "totalCount">[];
8058
8088
  };
8059
8089
  401: "Session not found";
@@ -8254,6 +8284,448 @@ export declare const app: Elysia<"", {
8254
8284
  };
8255
8285
  };
8256
8286
  };
8287
+ } & {
8288
+ fleet: {
8289
+ pm: {
8290
+ template: {};
8291
+ } & {
8292
+ template: {
8293
+ product: {};
8294
+ } & {
8295
+ product: {
8296
+ get: {
8297
+ body: unknown;
8298
+ params: {};
8299
+ query: {
8300
+ pagination: {
8301
+ size: number;
8302
+ page: number;
8303
+ };
8304
+ pmTemplateId: string;
8305
+ };
8306
+ headers: unknown;
8307
+ response: {
8308
+ 200: {
8309
+ totalCount: number;
8310
+ totalPage: number;
8311
+ result: Omit<{
8312
+ totalCount: number;
8313
+ pmTemplateId: string;
8314
+ productKindId: string;
8315
+ quantity: number | null;
8316
+ uomId: string;
8317
+ id: string;
8318
+ createdAt: string;
8319
+ updatedAt: string;
8320
+ deletedAt: string | null;
8321
+ oldId: number | null;
8322
+ }, "totalCount">[];
8323
+ };
8324
+ 422: {
8325
+ type: "validation";
8326
+ on: string;
8327
+ summary?: string;
8328
+ message?: string;
8329
+ found?: unknown;
8330
+ property?: string;
8331
+ expected?: string;
8332
+ };
8333
+ };
8334
+ };
8335
+ };
8336
+ } & {
8337
+ product: {
8338
+ post: {
8339
+ body: {
8340
+ oldId?: number | null | undefined;
8341
+ quantity?: number | null | undefined;
8342
+ uomId: string;
8343
+ pmTemplateId: string;
8344
+ productKindId: string;
8345
+ };
8346
+ params: {};
8347
+ query: unknown;
8348
+ headers: unknown;
8349
+ response: {
8350
+ 422: {
8351
+ type: "validation";
8352
+ on: string;
8353
+ summary?: string;
8354
+ message?: string;
8355
+ found?: unknown;
8356
+ property?: string;
8357
+ expected?: string;
8358
+ };
8359
+ };
8360
+ };
8361
+ };
8362
+ } & {
8363
+ product: {
8364
+ ":id": {
8365
+ put: {
8366
+ body: {
8367
+ oldId?: number | null | undefined;
8368
+ quantity?: number | null | undefined;
8369
+ uomId?: string | undefined;
8370
+ pmTemplateId?: string | undefined;
8371
+ productKindId?: string | undefined;
8372
+ };
8373
+ params: {
8374
+ id: string;
8375
+ };
8376
+ query: unknown;
8377
+ headers: unknown;
8378
+ response: {
8379
+ 422: {
8380
+ type: "validation";
8381
+ on: string;
8382
+ summary?: string;
8383
+ message?: string;
8384
+ found?: unknown;
8385
+ property?: string;
8386
+ expected?: string;
8387
+ };
8388
+ };
8389
+ };
8390
+ };
8391
+ };
8392
+ } & {
8393
+ product: {
8394
+ ":id": {
8395
+ delete: {
8396
+ body: unknown;
8397
+ params: {
8398
+ id: string;
8399
+ };
8400
+ query: unknown;
8401
+ headers: unknown;
8402
+ response: {
8403
+ 422: {
8404
+ type: "validation";
8405
+ on: string;
8406
+ summary?: string;
8407
+ message?: string;
8408
+ found?: unknown;
8409
+ property?: string;
8410
+ expected?: string;
8411
+ };
8412
+ };
8413
+ };
8414
+ };
8415
+ };
8416
+ };
8417
+ } & {
8418
+ template: {
8419
+ get: {
8420
+ body: unknown;
8421
+ params: {};
8422
+ query: {
8423
+ pagination: {
8424
+ size: number;
8425
+ page: number;
8426
+ };
8427
+ };
8428
+ headers: unknown;
8429
+ response: {
8430
+ 200: {
8431
+ totalCount: number;
8432
+ totalPage: number;
8433
+ result: Omit<{
8434
+ totalCount: number;
8435
+ machineKindId: string;
8436
+ companyId: string | null;
8437
+ operationAmount: number | null;
8438
+ uomId: string;
8439
+ serviceKindId: string;
8440
+ name: string;
8441
+ description: string | null;
8442
+ id: string;
8443
+ createdAt: string;
8444
+ updatedAt: string;
8445
+ deletedAt: string | null;
8446
+ oldId: number | null;
8447
+ }, "totalCount">[];
8448
+ };
8449
+ 422: {
8450
+ type: "validation";
8451
+ on: string;
8452
+ summary?: string;
8453
+ message?: string;
8454
+ found?: unknown;
8455
+ property?: string;
8456
+ expected?: string;
8457
+ };
8458
+ };
8459
+ };
8460
+ };
8461
+ } & {
8462
+ template: {
8463
+ post: {
8464
+ body: {
8465
+ companyId?: string | null | undefined;
8466
+ oldId?: number | null | undefined;
8467
+ description?: string | null | undefined;
8468
+ operationAmount?: number | null | undefined;
8469
+ name: string;
8470
+ serviceKindId: string;
8471
+ machineKindId: string;
8472
+ uomId: string;
8473
+ };
8474
+ params: {};
8475
+ query: unknown;
8476
+ headers: unknown;
8477
+ response: {
8478
+ 422: {
8479
+ type: "validation";
8480
+ on: string;
8481
+ summary?: string;
8482
+ message?: string;
8483
+ found?: unknown;
8484
+ property?: string;
8485
+ expected?: string;
8486
+ };
8487
+ };
8488
+ };
8489
+ };
8490
+ } & {
8491
+ template: {
8492
+ ":id": {
8493
+ put: {
8494
+ body: {
8495
+ name?: string | undefined;
8496
+ companyId?: string | null | undefined;
8497
+ oldId?: number | null | undefined;
8498
+ serviceKindId?: string | undefined;
8499
+ description?: string | null | undefined;
8500
+ machineKindId?: string | undefined;
8501
+ operationAmount?: number | null | undefined;
8502
+ uomId?: string | undefined;
8503
+ };
8504
+ params: {
8505
+ id: string;
8506
+ };
8507
+ query: unknown;
8508
+ headers: unknown;
8509
+ response: {
8510
+ 422: {
8511
+ type: "validation";
8512
+ on: string;
8513
+ summary?: string;
8514
+ message?: string;
8515
+ found?: unknown;
8516
+ property?: string;
8517
+ expected?: string;
8518
+ };
8519
+ };
8520
+ };
8521
+ };
8522
+ };
8523
+ } & {
8524
+ template: {
8525
+ ":id": {
8526
+ delete: {
8527
+ body: unknown;
8528
+ params: {
8529
+ id: string;
8530
+ };
8531
+ query: unknown;
8532
+ headers: unknown;
8533
+ response: {
8534
+ 422: {
8535
+ type: "validation";
8536
+ on: string;
8537
+ summary?: string;
8538
+ message?: string;
8539
+ found?: unknown;
8540
+ property?: string;
8541
+ expected?: string;
8542
+ };
8543
+ };
8544
+ };
8545
+ };
8546
+ };
8547
+ };
8548
+ };
8549
+ } & {
8550
+ fleet: {
8551
+ machine: {};
8552
+ } & {
8553
+ machine: {
8554
+ get: {
8555
+ body: unknown;
8556
+ params: {};
8557
+ query: {
8558
+ pagination: {
8559
+ size: number;
8560
+ page: number;
8561
+ };
8562
+ };
8563
+ headers: unknown;
8564
+ response: {
8565
+ 200: {
8566
+ totalCount: number;
8567
+ totalPage: number;
8568
+ result: Omit<{
8569
+ totalCount: number;
8570
+ companyId: string | null;
8571
+ machineKindId: string;
8572
+ customerId: string | null;
8573
+ name: string | null;
8574
+ assetCode: string | null;
8575
+ vin: string | null;
8576
+ licensePlate: string | null;
8577
+ color: string | null;
8578
+ engineCc: string | null;
8579
+ cylinder: string | null;
8580
+ gasType: string | null;
8581
+ transmissionType: string | null;
8582
+ vehicleType: string | null;
8583
+ yearManufacture: number | null;
8584
+ yearImport: number | null;
8585
+ steering: string | null;
8586
+ engineCode: string | null;
8587
+ transmissionCode: string | null;
8588
+ driveTrain: string | null;
8589
+ km: number;
8590
+ customData: unknown;
8591
+ id: string;
8592
+ createdAt: string;
8593
+ updatedAt: string;
8594
+ deletedAt: string | null;
8595
+ oldId: number | null;
8596
+ }, "totalCount">[];
8597
+ };
8598
+ 401: "Session not found";
8599
+ 422: {
8600
+ type: "validation";
8601
+ on: string;
8602
+ summary?: string;
8603
+ message?: string;
8604
+ found?: unknown;
8605
+ property?: string;
8606
+ expected?: string;
8607
+ };
8608
+ };
8609
+ };
8610
+ };
8611
+ } & {
8612
+ machine: {
8613
+ post: {
8614
+ body: {
8615
+ name?: string | null | undefined;
8616
+ companyId?: string | null | undefined;
8617
+ oldId?: number | null | undefined;
8618
+ customerId?: string | null | undefined;
8619
+ licensePlate?: string | null | undefined;
8620
+ assetCode?: string | null | undefined;
8621
+ vin?: string | null | undefined;
8622
+ color?: string | null | undefined;
8623
+ engineCc?: string | null | undefined;
8624
+ cylinder?: string | null | undefined;
8625
+ gasType?: string | null | undefined;
8626
+ transmissionType?: string | null | undefined;
8627
+ vehicleType?: string | null | undefined;
8628
+ yearManufacture?: number | null | undefined;
8629
+ yearImport?: number | null | undefined;
8630
+ steering?: string | null | undefined;
8631
+ engineCode?: string | null | undefined;
8632
+ transmissionCode?: string | null | undefined;
8633
+ driveTrain?: string | null | undefined;
8634
+ km?: number | undefined;
8635
+ customData?: import("drizzle-typebox").Json | undefined;
8636
+ machineKindId: string;
8637
+ };
8638
+ params: {};
8639
+ query: unknown;
8640
+ headers: unknown;
8641
+ response: {
8642
+ 401: "Session not found";
8643
+ 422: {
8644
+ type: "validation";
8645
+ on: string;
8646
+ summary?: string;
8647
+ message?: string;
8648
+ found?: unknown;
8649
+ property?: string;
8650
+ expected?: string;
8651
+ };
8652
+ };
8653
+ };
8654
+ };
8655
+ } & {
8656
+ machine: {
8657
+ ":id": {
8658
+ put: {
8659
+ body: {
8660
+ name?: string | null | undefined;
8661
+ companyId?: string | null | undefined;
8662
+ oldId?: number | null | undefined;
8663
+ customerId?: string | null | undefined;
8664
+ licensePlate?: string | null | undefined;
8665
+ machineKindId?: string | undefined;
8666
+ assetCode?: string | null | undefined;
8667
+ vin?: string | null | undefined;
8668
+ color?: string | null | undefined;
8669
+ engineCc?: string | null | undefined;
8670
+ cylinder?: string | null | undefined;
8671
+ gasType?: string | null | undefined;
8672
+ transmissionType?: string | null | undefined;
8673
+ vehicleType?: string | null | undefined;
8674
+ yearManufacture?: number | null | undefined;
8675
+ yearImport?: number | null | undefined;
8676
+ steering?: string | null | undefined;
8677
+ engineCode?: string | null | undefined;
8678
+ transmissionCode?: string | null | undefined;
8679
+ driveTrain?: string | null | undefined;
8680
+ km?: number | undefined;
8681
+ customData?: import("drizzle-typebox").Json | undefined;
8682
+ };
8683
+ params: {
8684
+ id: string;
8685
+ };
8686
+ query: unknown;
8687
+ headers: unknown;
8688
+ response: {
8689
+ 401: "Session not found";
8690
+ 422: {
8691
+ type: "validation";
8692
+ on: string;
8693
+ summary?: string;
8694
+ message?: string;
8695
+ found?: unknown;
8696
+ property?: string;
8697
+ expected?: string;
8698
+ };
8699
+ };
8700
+ };
8701
+ };
8702
+ };
8703
+ } & {
8704
+ machine: {
8705
+ ":id": {
8706
+ delete: {
8707
+ body: unknown;
8708
+ params: {
8709
+ id: string;
8710
+ };
8711
+ query: unknown;
8712
+ headers: unknown;
8713
+ response: {
8714
+ 401: "Session not found";
8715
+ 422: {
8716
+ type: "validation";
8717
+ on: string;
8718
+ summary?: string;
8719
+ message?: string;
8720
+ found?: unknown;
8721
+ property?: string;
8722
+ expected?: string;
8723
+ };
8724
+ };
8725
+ };
8726
+ };
8727
+ };
8728
+ };
8257
8729
  };
8258
8730
  }, {
8259
8731
  derive: {};
package/dist/index.js CHANGED
@@ -142503,6 +142503,7 @@ __export(exports_schema, {
142503
142503
  companyServiceBookingTable: () => companyServiceBookingTable,
142504
142504
  companySchema: () => companySchema,
142505
142505
  companyPackageTable: () => companyPackageTable,
142506
+ companyMachineTable: () => companyMachineTable,
142506
142507
  companyEmployeeTable: () => companyEmployeeTable,
142507
142508
  companyCompanyTable: () => companyCompanyTable,
142508
142509
  companyBranchWorkSchdedule: () => companyBranchWorkSchdedule,
@@ -142749,6 +142750,30 @@ var companyAccountTable = companySchema.table("account", {
142749
142750
  account: varchar().notNull(),
142750
142751
  description: varchar()
142751
142752
  });
142753
+ var companyMachineTable = companySchema.table("machine", {
142754
+ ...base_schema_helper_default,
142755
+ companyId: uuid5(),
142756
+ machineKindId: uuid5().notNull(),
142757
+ customerId: uuid5(),
142758
+ name: varchar(),
142759
+ assetCode: varchar(),
142760
+ vin: varchar(),
142761
+ licensePlate: varchar(),
142762
+ color: varchar(),
142763
+ engineCc: varchar(),
142764
+ cylinder: varchar(),
142765
+ gasType: varchar(),
142766
+ transmissionType: varchar(),
142767
+ vehicleType: varchar(),
142768
+ yearManufacture: integer2(),
142769
+ yearImport: integer2(),
142770
+ steering: varchar(),
142771
+ engineCode: varchar(),
142772
+ transmissionCode: varchar(),
142773
+ driveTrain: varchar(),
142774
+ km: integer2().notNull().default(0),
142775
+ customData: jsonb()
142776
+ });
142752
142777
  // src/lib/db/schema/crm.schema.ts
142753
142778
  var crmSchema = pgSchema("crm");
142754
142779
  var crmCustomerTable = crmSchema.table("customer", {
@@ -147455,7 +147480,7 @@ var WarehouseItemLogic;
147455
147480
  name: user.name,
147456
147481
  kind: user.kind
147457
147482
  }
147458
- }).from(warehouseItemTransactionTable).where(filter).leftJoin(warehouseProductTable, eq(warehouseItemTransactionTable.productId, warehouseProductTable.id)).leftJoin(warehouseItemTable, eq(warehouseItemTransactionTable.itemId, warehouseItemTable.id)).leftJoin(user, eq(warehouseItemTransactionTable.userId, user.id)).$dynamic();
147483
+ }).from(warehouseItemTransactionTable).where(filter).leftJoin(warehouseProductTable, eq(warehouseItemTransactionTable.productId, warehouseProductTable.id)).leftJoin(warehouseItemTable, eq(warehouseItemTransactionTable.itemId, warehouseItemTable.id)).leftJoin(user, eq(warehouseItemTransactionTable.userId, user.id)).orderBy(desc(warehouseItemTransactionTable.createdAt)).$dynamic();
147459
147484
  const result = await pagination_helper_default(baseQuery, query.pagination);
147460
147485
  const content = {
147461
147486
  totalCount: result[0]?.totalCount ?? 0,
@@ -154249,11 +154274,11 @@ var InspectionScheduleLogic;
154249
154274
  ((InspectionScheduleLogic) => {
154250
154275
  InspectionScheduleLogic.select = async (query, user2) => {
154251
154276
  const filter = and(softDeletedFilter(inspectionScheduleTable), eq(inspectionScheduleTable.companyId, user2.companyId));
154252
- const columns = getTableColumns(inspectionScheduleTable);
154253
154277
  const baseQuery = db_default.select({
154254
- ...columns,
154278
+ schedule: inspectionScheduleTable,
154279
+ machine: companyMachineTable,
154255
154280
  totalCount: totalCountSql
154256
- }).from(inspectionScheduleTable).where(filter).$dynamic();
154281
+ }).from(inspectionScheduleTable).where(filter).leftJoin(companyMachineTable, eq(inspectionScheduleTable.machineId, companyMachineTable.id)).$dynamic();
154257
154282
  const result = await pagination_helper_default(baseQuery, query.pagination);
154258
154283
  return getPaginationContent(result, query.pagination.size);
154259
154284
  };
@@ -154399,8 +154424,198 @@ var inspectionRoutes2 = new Elysia({
154399
154424
  });
154400
154425
  var inspection_default2 = inspectionRoutes2;
154401
154426
 
154427
+ // src/routes/fleet/machine/logic.ts
154428
+ var MachineLogic;
154429
+ ((MachineLogic) => {
154430
+ MachineLogic.select = async (query, user2) => {
154431
+ const filter = and(or(isNull2(companyMachineTable.companyId), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")), softDeletedFilter(companyMachineTable));
154432
+ const columns = getTableColumns(companyMachineTable);
154433
+ const baseQuery = db_default.select({
154434
+ ...columns,
154435
+ totalCount: totalCountSql
154436
+ }).from(companyMachineTable).where(filter).$dynamic();
154437
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154438
+ return getPaginationContent(result, query.pagination.size);
154439
+ };
154440
+ MachineLogic.create = async (body, user2) => {
154441
+ await db_default.insert(companyMachineTable).values({
154442
+ ...body,
154443
+ companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154444
+ });
154445
+ };
154446
+ MachineLogic.update = async (id, body, user2) => {
154447
+ await db_default.update(companyMachineTable).set({
154448
+ ...body
154449
+ }).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154450
+ };
154451
+ MachineLogic.remove = async (id, user2) => {
154452
+ await db_default.update(companyMachineTable).set({
154453
+ deletedAt: nowSql_helper_default
154454
+ }).where(and(eq(companyMachineTable.id, id), eq(companyMachineTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154455
+ };
154456
+ })(MachineLogic ||= {});
154457
+ var logic_default30 = MachineLogic;
154458
+
154459
+ // src/routes/fleet/machine/model.ts
154460
+ var MachineModel;
154461
+ ((MachineModel) => {
154462
+ const createSchema = createInsertSchema2(companyMachineTable);
154463
+ const updateSchema = createUpdateSchema(companyMachineTable);
154464
+ MachineModel.create = OmitBaseSchema(createSchema);
154465
+ MachineModel.update = OmitBaseSchema(updateSchema);
154466
+ MachineModel.select = t.Composite([PaginationSchema]);
154467
+ })(MachineModel ||= {});
154468
+ var model_default30 = MachineModel;
154469
+
154470
+ // src/routes/fleet/machine/index.ts
154471
+ var machineRoutes = new Elysia({
154472
+ prefix: "/machine",
154473
+ tags: ["FleetMachine"]
154474
+ }).use(better_auth_default).guard({
154475
+ auth: true
154476
+ }).get("/", async ({ query, user: user2 }) => logic_default30.select(query, user2), {
154477
+ query: model_default30.select
154478
+ }).post("/", async ({ body, user: user2 }) => logic_default30.create(body, user2), {
154479
+ body: model_default30.create
154480
+ }).guard({
154481
+ params: IdSchema
154482
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default30.update(id, body, user2), {
154483
+ body: model_default30.update
154484
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default30.remove(id, user2));
154485
+ var machine_default = machineRoutes;
154486
+
154487
+ // src/routes/fleet/pm/template/logic.ts
154488
+ var PmTemplateLogic;
154489
+ ((PmTemplateLogic) => {
154490
+ PmTemplateLogic.select = async (query, user2) => {
154491
+ const filter = and(or(isNull2(pmTemplateTable.companyId), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154492
+ const columns = getTableColumns(pmTemplateTable);
154493
+ const baseQuery = db_default.select({
154494
+ ...columns,
154495
+ totalCount: totalCountSql
154496
+ }).from(pmTemplateTable).where(filter).$dynamic();
154497
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154498
+ return getPaginationContent(result, query.pagination.size);
154499
+ };
154500
+ PmTemplateLogic.create = async (body, user2) => {
154501
+ await db_default.insert(pmTemplateTable).values({
154502
+ ...body,
154503
+ companyId: user2.kind !== "ADMIN" ? user2.companyId : body.companyId
154504
+ });
154505
+ };
154506
+ PmTemplateLogic.update = async (id, body, user2) => {
154507
+ await db_default.update(pmTemplateTable).set({
154508
+ ...body
154509
+ }).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154510
+ };
154511
+ PmTemplateLogic.remove = async (id, user2) => {
154512
+ await db_default.update(pmTemplateTable).set({
154513
+ deletedAt: nowSql_helper_default
154514
+ }).where(and(eq(pmTemplateTable.id, id), eq(pmTemplateTable.companyId, user2.companyId).if(user2.kind !== "ADMIN")));
154515
+ };
154516
+ })(PmTemplateLogic ||= {});
154517
+ var logic_default31 = PmTemplateLogic;
154518
+
154519
+ // src/routes/fleet/pm/template/model.ts
154520
+ var PmTemplateModel;
154521
+ ((PmTemplateModel) => {
154522
+ const createSchema = createInsertSchema2(pmTemplateTable);
154523
+ const updateSchema = createUpdateSchema(pmTemplateTable);
154524
+ PmTemplateModel.create = OmitBaseSchema(createSchema);
154525
+ PmTemplateModel.update = OmitBaseSchema(updateSchema);
154526
+ PmTemplateModel.select = t.Composite([PaginationSchema]);
154527
+ })(PmTemplateModel ||= {});
154528
+ var model_default31 = PmTemplateModel;
154529
+
154530
+ // src/routes/fleet/pm/template/product/logic.ts
154531
+ var PmTemplateProductLogic;
154532
+ ((PmTemplateProductLogic) => {
154533
+ PmTemplateProductLogic.select = async (query) => {
154534
+ const filter = and(softDeletedFilter(pmTemplateProductTable), eq(pmTemplateProductTable.pmTemplateId, query.pmTemplateId));
154535
+ const columns = getTableColumns(pmTemplateProductTable);
154536
+ const baseQuery = db_default.select({
154537
+ ...columns,
154538
+ totalCount: totalCountSql
154539
+ }).from(pmTemplateProductTable).where(filter).$dynamic();
154540
+ const result = await pagination_helper_default(baseQuery, query.pagination);
154541
+ return getPaginationContent(result, query.pagination.size);
154542
+ };
154543
+ PmTemplateProductLogic.create = async (body) => {
154544
+ await db_default.insert(pmTemplateProductTable).values({
154545
+ ...body
154546
+ });
154547
+ };
154548
+ PmTemplateProductLogic.update = async (id, body) => {
154549
+ await db_default.update(pmTemplateProductTable).set({
154550
+ ...body
154551
+ }).where(and(eq(pmTemplateProductTable.id, id)));
154552
+ };
154553
+ PmTemplateProductLogic.remove = async (id) => {
154554
+ await db_default.update(pmTemplateProductTable).set({
154555
+ deletedAt: nowSql_helper_default
154556
+ }).where(and(eq(pmTemplateProductTable.id, id)));
154557
+ };
154558
+ })(PmTemplateProductLogic ||= {});
154559
+ var logic_default32 = PmTemplateProductLogic;
154560
+
154561
+ // src/routes/fleet/pm/template/product/model.ts
154562
+ var PmTemplateProductModel;
154563
+ ((PmTemplateProductModel) => {
154564
+ const createSchema = createInsertSchema2(pmTemplateProductTable);
154565
+ const updateSchema = createUpdateSchema(pmTemplateProductTable);
154566
+ PmTemplateProductModel.create = OmitBaseSchema(createSchema);
154567
+ PmTemplateProductModel.update = OmitBaseSchema(updateSchema);
154568
+ PmTemplateProductModel.select = t.Composite([
154569
+ PaginationSchema,
154570
+ t.Object({
154571
+ pmTemplateId: t.String({ format: "uuid" })
154572
+ })
154573
+ ]);
154574
+ })(PmTemplateProductModel ||= {});
154575
+ var model_default32 = PmTemplateProductModel;
154576
+
154577
+ // src/routes/fleet/pm/template/product/index.ts
154578
+ var productRoutes4 = new Elysia({
154579
+ prefix: "/product",
154580
+ tags: ["PmTemplateProduct"]
154581
+ }).use(better_auth_default).guard({
154582
+ userKind: "COMPANY_ADMIN"
154583
+ }).get("/", async ({ query }) => logic_default32.select(query), {
154584
+ query: model_default32.select
154585
+ }).post("/", async ({ body }) => logic_default32.create(body), {
154586
+ body: model_default32.create
154587
+ }).guard({
154588
+ params: IdSchema
154589
+ }).put("/:id", async ({ body, params: { id } }) => logic_default32.update(id, body), {
154590
+ body: model_default32.update
154591
+ }).delete("/:id", async ({ params: { id } }) => logic_default32.remove(id));
154592
+ var product_default4 = productRoutes4;
154593
+
154594
+ // src/routes/fleet/pm/template/index.ts
154595
+ var templateRoutes2 = new Elysia({
154596
+ prefix: "/template",
154597
+ tags: ["PmTemplate"]
154598
+ }).use(better_auth_default).use(product_default4).guard({
154599
+ userKind: "COMPANY_ADMIN"
154600
+ }).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
154601
+ query: model_default31.select
154602
+ }).post("/", async ({ body, user: user2 }) => logic_default31.create(body, user2), {
154603
+ body: model_default31.create
154604
+ }).guard({
154605
+ params: IdSchema
154606
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default31.update(id, body, user2), {
154607
+ body: model_default31.update
154608
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default31.remove(id, user2));
154609
+ var template_default2 = templateRoutes2;
154610
+
154611
+ // src/routes/fleet/pm/index.ts
154612
+ var pmRoutes = new Elysia({
154613
+ prefix: "/pm"
154614
+ }).use(template_default2);
154615
+ var pm_default = pmRoutes;
154616
+
154402
154617
  // src/routes/fleet/index.ts
154403
- var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2);
154618
+ var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2).use(pm_default).use(machine_default);
154404
154619
  var fleet_default = fleetRoutes;
154405
154620
 
154406
154621
  // src/routes/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.27",
3
+ "version": "1.2.29",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",