autosync_backend2 1.2.26 → 1.2.28

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
@@ -41,7 +41,7 @@ export declare const app: Elysia<"", {
41
41
  route: string;
42
42
  request: Request;
43
43
  store: {};
44
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
44
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
45
45
  readonly 100: "Continue";
46
46
  readonly 101: "Switching Protocols";
47
47
  readonly 102: "Processing";
@@ -199,7 +199,7 @@ export declare const app: Elysia<"", {
199
199
  route: string;
200
200
  request: Request;
201
201
  store: {};
202
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
202
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
203
203
  readonly 100: "Continue";
204
204
  readonly 101: "Switching Protocols";
205
205
  readonly 102: "Processing";
@@ -357,7 +357,7 @@ export declare const app: Elysia<"", {
357
357
  route: string;
358
358
  request: Request;
359
359
  store: {};
360
- status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
360
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 100 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 301 | 302 | 303 | 304 | 307 | 308 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
361
361
  readonly 100: "Continue";
362
362
  readonly 101: "Switching Protocols";
363
363
  readonly 102: "Processing";
@@ -1335,6 +1335,18 @@ export declare const app: Elysia<"", {
1335
1335
  };
1336
1336
  };
1337
1337
  };
1338
+ } & {
1339
+ item: {
1340
+ order: {
1341
+ post: {
1342
+ body: unknown;
1343
+ params: {};
1344
+ query: unknown;
1345
+ headers: unknown;
1346
+ response: {};
1347
+ };
1348
+ };
1349
+ };
1338
1350
  } & {
1339
1351
  item: {
1340
1352
  ":id": {
@@ -3972,8 +3984,8 @@ export declare const app: Elysia<"", {
3972
3984
  body: {
3973
3985
  phone?: string | undefined;
3974
3986
  licensePlate?: string | undefined;
3975
- vehicleKindId?: string | undefined;
3976
3987
  vin?: string | undefined;
3988
+ vehicleKindId?: string | undefined;
3977
3989
  };
3978
3990
  params: {};
3979
3991
  query: unknown;
@@ -4779,6 +4791,7 @@ export declare const app: Elysia<"", {
4779
4791
  params: {};
4780
4792
  query: {
4781
4793
  name?: string | undefined;
4794
+ id?: string | undefined;
4782
4795
  companyBranchId?: string | null | undefined;
4783
4796
  priceTotal?: number | undefined;
4784
4797
  pagination: {
@@ -5148,8 +5161,8 @@ export declare const app: Elysia<"", {
5148
5161
  body: {
5149
5162
  customerId?: string | undefined;
5150
5163
  licensePlate?: string | undefined;
5151
- vehicleKindId?: string | undefined;
5152
5164
  vin?: string | undefined;
5165
+ vehicleKindId?: string | undefined;
5153
5166
  };
5154
5167
  params: {};
5155
5168
  query: unknown;
@@ -5164,7 +5177,6 @@ export declare const app: Elysia<"", {
5164
5177
  oldId: number | null;
5165
5178
  customerId: string | null;
5166
5179
  licensePlate: string | null;
5167
- vehicleKindId: string;
5168
5180
  vin: string | null;
5169
5181
  color: string | null;
5170
5182
  engineCc: string | null;
@@ -5180,6 +5192,7 @@ export declare const app: Elysia<"", {
5180
5192
  driveTrain: string | null;
5181
5193
  km: number;
5182
5194
  customData: unknown;
5195
+ vehicleKindId: string;
5183
5196
  };
5184
5197
  400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
5185
5198
  401: "Session not found";
@@ -5304,7 +5317,6 @@ export declare const app: Elysia<"", {
5304
5317
  oldId?: number | null | undefined;
5305
5318
  customerId?: string | null | undefined;
5306
5319
  licensePlate?: string | null | undefined;
5307
- vehicleKindId?: string | undefined;
5308
5320
  vin?: string | null | undefined;
5309
5321
  color?: string | null | undefined;
5310
5322
  engineCc?: string | null | undefined;
@@ -5320,6 +5332,7 @@ export declare const app: Elysia<"", {
5320
5332
  driveTrain?: string | null | undefined;
5321
5333
  km?: number | undefined;
5322
5334
  customData?: import("drizzle-typebox").Json | undefined;
5335
+ vehicleKindId?: string | undefined;
5323
5336
  };
5324
5337
  params: {
5325
5338
  id: string;
@@ -5467,7 +5480,6 @@ export declare const app: Elysia<"", {
5467
5480
  oldId: number | null;
5468
5481
  customerId: string | null;
5469
5482
  licensePlate: string | null;
5470
- vehicleKindId: string;
5471
5483
  vin: string | null;
5472
5484
  color: string | null;
5473
5485
  engineCc: string | null;
@@ -5483,6 +5495,7 @@ export declare const app: Elysia<"", {
5483
5495
  driveTrain: string | null;
5484
5496
  km: number;
5485
5497
  customData: unknown;
5498
+ vehicleKindId: string;
5486
5499
  }[];
5487
5500
  }[];
5488
5501
  };
@@ -8241,6 +8254,322 @@ export declare const app: Elysia<"", {
8241
8254
  };
8242
8255
  };
8243
8256
  };
8257
+ } & {
8258
+ fleet: {
8259
+ pm: {
8260
+ template: {};
8261
+ } & {
8262
+ template: {
8263
+ get: {
8264
+ body: unknown;
8265
+ params: {};
8266
+ query: {
8267
+ pagination: {
8268
+ size: number;
8269
+ page: number;
8270
+ };
8271
+ };
8272
+ headers: unknown;
8273
+ response: {
8274
+ 200: {
8275
+ totalCount: number;
8276
+ totalPage: number;
8277
+ result: Omit<{
8278
+ totalCount: number;
8279
+ machineKindId: string;
8280
+ companyId: string | null;
8281
+ operationAmount: number | null;
8282
+ uomId: string;
8283
+ serviceKindId: string;
8284
+ name: string;
8285
+ description: string | null;
8286
+ id: string;
8287
+ createdAt: string;
8288
+ updatedAt: string;
8289
+ deletedAt: string | null;
8290
+ oldId: number | null;
8291
+ }, "totalCount">[];
8292
+ };
8293
+ 422: {
8294
+ type: "validation";
8295
+ on: string;
8296
+ summary?: string;
8297
+ message?: string;
8298
+ found?: unknown;
8299
+ property?: string;
8300
+ expected?: string;
8301
+ };
8302
+ };
8303
+ };
8304
+ };
8305
+ } & {
8306
+ template: {
8307
+ post: {
8308
+ body: {
8309
+ companyId?: string | null | undefined;
8310
+ oldId?: number | null | undefined;
8311
+ description?: string | null | undefined;
8312
+ operationAmount?: number | null | undefined;
8313
+ name: string;
8314
+ serviceKindId: string;
8315
+ machineKindId: string;
8316
+ uomId: string;
8317
+ };
8318
+ params: {};
8319
+ query: unknown;
8320
+ headers: unknown;
8321
+ response: {
8322
+ 422: {
8323
+ type: "validation";
8324
+ on: string;
8325
+ summary?: string;
8326
+ message?: string;
8327
+ found?: unknown;
8328
+ property?: string;
8329
+ expected?: string;
8330
+ };
8331
+ };
8332
+ };
8333
+ };
8334
+ } & {
8335
+ template: {
8336
+ ":id": {
8337
+ put: {
8338
+ body: {
8339
+ name?: string | undefined;
8340
+ companyId?: string | null | undefined;
8341
+ oldId?: number | null | undefined;
8342
+ serviceKindId?: string | undefined;
8343
+ description?: string | null | undefined;
8344
+ machineKindId?: string | undefined;
8345
+ operationAmount?: number | null | undefined;
8346
+ uomId?: string | undefined;
8347
+ };
8348
+ params: {
8349
+ id: string;
8350
+ };
8351
+ query: unknown;
8352
+ headers: unknown;
8353
+ response: {
8354
+ 422: {
8355
+ type: "validation";
8356
+ on: string;
8357
+ summary?: string;
8358
+ message?: string;
8359
+ found?: unknown;
8360
+ property?: string;
8361
+ expected?: string;
8362
+ };
8363
+ };
8364
+ };
8365
+ };
8366
+ };
8367
+ } & {
8368
+ template: {
8369
+ ":id": {
8370
+ delete: {
8371
+ body: unknown;
8372
+ params: {
8373
+ id: string;
8374
+ };
8375
+ query: unknown;
8376
+ headers: unknown;
8377
+ response: {
8378
+ 422: {
8379
+ type: "validation";
8380
+ on: string;
8381
+ summary?: string;
8382
+ message?: string;
8383
+ found?: unknown;
8384
+ property?: string;
8385
+ expected?: string;
8386
+ };
8387
+ };
8388
+ };
8389
+ };
8390
+ };
8391
+ };
8392
+ };
8393
+ } & {
8394
+ fleet: {
8395
+ machine: {};
8396
+ } & {
8397
+ machine: {
8398
+ get: {
8399
+ body: unknown;
8400
+ params: {};
8401
+ query: {
8402
+ pagination: {
8403
+ size: number;
8404
+ page: number;
8405
+ };
8406
+ };
8407
+ headers: unknown;
8408
+ response: {
8409
+ 200: {
8410
+ totalCount: number;
8411
+ totalPage: number;
8412
+ result: Omit<{
8413
+ totalCount: number;
8414
+ companyId: string | null;
8415
+ machineKindId: string;
8416
+ customerId: string | null;
8417
+ name: string | null;
8418
+ assetCode: string | null;
8419
+ vin: string | null;
8420
+ licensePlate: string | null;
8421
+ color: string | null;
8422
+ engineCc: string | null;
8423
+ cylinder: string | null;
8424
+ gasType: string | null;
8425
+ transmissionType: string | null;
8426
+ vehicleType: string | null;
8427
+ yearManufacture: number | null;
8428
+ yearImport: number | null;
8429
+ steering: string | null;
8430
+ engineCode: string | null;
8431
+ transmissionCode: string | null;
8432
+ driveTrain: string | null;
8433
+ km: number;
8434
+ customData: unknown;
8435
+ id: string;
8436
+ createdAt: string;
8437
+ updatedAt: string;
8438
+ deletedAt: string | null;
8439
+ oldId: number | null;
8440
+ }, "totalCount">[];
8441
+ };
8442
+ 401: "Session not found";
8443
+ 422: {
8444
+ type: "validation";
8445
+ on: string;
8446
+ summary?: string;
8447
+ message?: string;
8448
+ found?: unknown;
8449
+ property?: string;
8450
+ expected?: string;
8451
+ };
8452
+ };
8453
+ };
8454
+ };
8455
+ } & {
8456
+ machine: {
8457
+ post: {
8458
+ body: {
8459
+ name?: string | null | undefined;
8460
+ companyId?: string | null | undefined;
8461
+ oldId?: number | null | undefined;
8462
+ customerId?: string | null | undefined;
8463
+ licensePlate?: string | null | undefined;
8464
+ assetCode?: string | null | undefined;
8465
+ vin?: string | null | undefined;
8466
+ color?: string | null | undefined;
8467
+ engineCc?: string | null | undefined;
8468
+ cylinder?: string | null | undefined;
8469
+ gasType?: string | null | undefined;
8470
+ transmissionType?: string | null | undefined;
8471
+ vehicleType?: string | null | undefined;
8472
+ yearManufacture?: number | null | undefined;
8473
+ yearImport?: number | null | undefined;
8474
+ steering?: string | null | undefined;
8475
+ engineCode?: string | null | undefined;
8476
+ transmissionCode?: string | null | undefined;
8477
+ driveTrain?: string | null | undefined;
8478
+ km?: number | undefined;
8479
+ customData?: import("drizzle-typebox").Json | undefined;
8480
+ machineKindId: string;
8481
+ };
8482
+ params: {};
8483
+ query: unknown;
8484
+ headers: unknown;
8485
+ response: {
8486
+ 401: "Session not found";
8487
+ 422: {
8488
+ type: "validation";
8489
+ on: string;
8490
+ summary?: string;
8491
+ message?: string;
8492
+ found?: unknown;
8493
+ property?: string;
8494
+ expected?: string;
8495
+ };
8496
+ };
8497
+ };
8498
+ };
8499
+ } & {
8500
+ machine: {
8501
+ ":id": {
8502
+ put: {
8503
+ body: {
8504
+ name?: string | null | undefined;
8505
+ companyId?: string | null | undefined;
8506
+ oldId?: number | null | undefined;
8507
+ customerId?: string | null | undefined;
8508
+ licensePlate?: string | null | undefined;
8509
+ machineKindId?: string | undefined;
8510
+ assetCode?: string | null | undefined;
8511
+ vin?: string | null | undefined;
8512
+ color?: string | null | undefined;
8513
+ engineCc?: string | null | undefined;
8514
+ cylinder?: string | null | undefined;
8515
+ gasType?: string | null | undefined;
8516
+ transmissionType?: string | null | undefined;
8517
+ vehicleType?: string | null | undefined;
8518
+ yearManufacture?: number | null | undefined;
8519
+ yearImport?: number | null | undefined;
8520
+ steering?: string | null | undefined;
8521
+ engineCode?: string | null | undefined;
8522
+ transmissionCode?: string | null | undefined;
8523
+ driveTrain?: string | null | undefined;
8524
+ km?: number | undefined;
8525
+ customData?: import("drizzle-typebox").Json | undefined;
8526
+ };
8527
+ params: {
8528
+ id: string;
8529
+ };
8530
+ query: unknown;
8531
+ headers: unknown;
8532
+ response: {
8533
+ 401: "Session not found";
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
+ machine: {
8549
+ ":id": {
8550
+ delete: {
8551
+ body: unknown;
8552
+ params: {
8553
+ id: string;
8554
+ };
8555
+ query: unknown;
8556
+ headers: unknown;
8557
+ response: {
8558
+ 401: "Session not found";
8559
+ 422: {
8560
+ type: "validation";
8561
+ on: string;
8562
+ summary?: string;
8563
+ message?: string;
8564
+ found?: unknown;
8565
+ property?: string;
8566
+ expected?: string;
8567
+ };
8568
+ };
8569
+ };
8570
+ };
8571
+ };
8572
+ };
8244
8573
  };
8245
8574
  }, {
8246
8575
  derive: {};
package/dist/index.js CHANGED
@@ -142447,6 +142447,12 @@ __export(exports_schema, {
142447
142447
  techdocSchema: () => techdocSchema,
142448
142448
  techdocProductTable: () => techdocProductTable,
142449
142449
  session: () => session,
142450
+ pmTemplateTable: () => pmTemplateTable,
142451
+ pmTemplateProductTable: () => pmTemplateProductTable,
142452
+ pmSchema: () => pmSchema,
142453
+ pmPlanTable: () => pmPlanTable,
142454
+ pmPlanProductTable: () => pmPlanProductTable,
142455
+ pmPlanMachineTable: () => pmPlanMachineTable,
142450
142456
  permissionTable: () => permissionTable,
142451
142457
  permissionGroupTable: () => permissionGroupTable,
142452
142458
  logTable: () => logTable,
@@ -142497,6 +142503,7 @@ __export(exports_schema, {
142497
142503
  companyServiceBookingTable: () => companyServiceBookingTable,
142498
142504
  companySchema: () => companySchema,
142499
142505
  companyPackageTable: () => companyPackageTable,
142506
+ companyMachineTable: () => companyMachineTable,
142500
142507
  companyEmployeeTable: () => companyEmployeeTable,
142501
142508
  companyCompanyTable: () => companyCompanyTable,
142502
142509
  companyBranchWorkSchdedule: () => companyBranchWorkSchdedule,
@@ -142743,6 +142750,30 @@ var companyAccountTable = companySchema.table("account", {
142743
142750
  account: varchar().notNull(),
142744
142751
  description: varchar()
142745
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().unique(),
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
+ });
142746
142777
  // src/lib/db/schema/crm.schema.ts
142747
142778
  var crmSchema = pgSchema("crm");
142748
142779
  var crmCustomerTable = crmSchema.table("customer", {
@@ -143078,6 +143109,53 @@ var inspectionScheduleTable = inspectionSchema.table("schedule", {
143078
143109
  timeNextDue: timestamp({ withTimezone: true }),
143079
143110
  isActive: boolean4().notNull().default(true)
143080
143111
  });
143112
+ var pmSchema = pgSchema("pm");
143113
+ var pmTemplateTable = pmSchema.table("template", {
143114
+ ...base_schema_helper_default,
143115
+ machineKindId: uuid5().notNull(),
143116
+ companyId: uuid5(),
143117
+ operationAmount: numeric({ mode: "number" }),
143118
+ uomId: uuid5().notNull(),
143119
+ serviceKindId: uuid5().notNull(),
143120
+ name: varchar().notNull(),
143121
+ description: text()
143122
+ });
143123
+ var pmTemplateProductTable = pmSchema.table("template_product", {
143124
+ ...base_schema_helper_default,
143125
+ pmTemplateId: uuid5().notNull(),
143126
+ productKindId: uuid5().notNull(),
143127
+ quantity: numeric({ mode: "number" }),
143128
+ uomId: uuid5().notNull()
143129
+ });
143130
+ var pmPlanTable = pmSchema.table("plan", {
143131
+ ...base_schema_helper_default,
143132
+ companyId: uuid5().notNull(),
143133
+ name: varchar().notNull(),
143134
+ description: text(),
143135
+ dateStart: timestamp({
143136
+ withTimezone: true
143137
+ }),
143138
+ dateEnd: timestamp({
143139
+ withTimezone: true
143140
+ })
143141
+ });
143142
+ var pmPlanMachineTable = pmSchema.table("plan_machine", {
143143
+ ...base_schema_helper_default,
143144
+ pmPlanId: uuid5().notNull(),
143145
+ pmTemplateId: uuid5().notNull(),
143146
+ machineId: uuid5().notNull(),
143147
+ employeeCreatedId: uuid5().notNull(),
143148
+ userCreatedId: uuid5().notNull(),
143149
+ note: text()
143150
+ });
143151
+ var pmPlanProductTable = pmSchema.table("plan_product", {
143152
+ ...base_schema_helper_default,
143153
+ pmPlanId: uuid5().notNull(),
143154
+ productKindId: uuid5().notNull(),
143155
+ uomId: uuid5().notNull(),
143156
+ quantity: numeric({ mode: "number" }),
143157
+ pmQuantity: uuid5().notNull()
143158
+ });
143081
143159
  // src/lib/db/schema/techdoc.schema.ts
143082
143160
  var techdocSchema = pgSchema("techdoc");
143083
143161
  var techdocVehicleKindEnum = pgEnum("vehicle_kind_enum", [
@@ -146125,7 +146203,10 @@ var auth2 = betterAuth({
146125
146203
  console[level](...args);
146126
146204
  }
146127
146205
  },
146128
- trustedOrigins: ["https://user.autosync.mn", "https://admin.autosync.mn"]
146206
+ trustedOrigins: ["https://user.autosync.mn", "https://admin.autosync.mn"],
146207
+ advanced: {
146208
+ useSecureCookies: false
146209
+ }
146129
146210
  });
146130
146211
  var _schema;
146131
146212
  var getSchema2 = async () => _schema ??= auth2.api.generateOpenAPISchema();
@@ -146390,7 +146471,6 @@ var PaginationSchema = t.Object({
146390
146471
  default: 1
146391
146472
  }),
146392
146473
  size: t.Integer({
146393
- maximum: 100,
146394
146474
  default: 25,
146395
146475
  minimum: 1
146396
146476
  })
@@ -147287,7 +147367,7 @@ var WarehouseItemLogic;
147287
147367
  supplier: techdocSupplierTable,
147288
147368
  product: warehouseProductTable,
147289
147369
  totalCount: totalCountSql
147290
- }).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).orderBy(desc(warehouseItemTable.createdAt)).$dynamic();
147370
+ }).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).orderBy(warehouseItemTable.order, desc(warehouseItemTable.createdAt)).$dynamic();
147291
147371
  const result = await pagination_helper_default(baseQuery, query.pagination);
147292
147372
  const content = {
147293
147373
  totalCount: result[0]?.totalCount ?? 0,
@@ -147400,7 +147480,7 @@ var WarehouseItemLogic;
147400
147480
  name: user.name,
147401
147481
  kind: user.kind
147402
147482
  }
147403
- }).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();
147404
147484
  const result = await pagination_helper_default(baseQuery, query.pagination);
147405
147485
  const content = {
147406
147486
  totalCount: result[0]?.totalCount ?? 0,
@@ -147772,7 +147852,7 @@ var CrmSpPackageLogic;
147772
147852
  };
147773
147853
  CrmSpPackageLogic.select = async (query, user2) => {
147774
147854
  const columns = getTableColumns(crmSpPackageTable);
147775
- const filter = and(eq(crmSpPackageTable.companyId, user2.companyId), ilike(crmSpPackageTable.name, `%${query.name}%`).if(query.name), eq(crmSpPackageTable.priceTotal, query.priceTotal ?? 0).if(query.priceTotal), or(isNull2(crmSpPackageTable.companyBranchId), eq(crmSpPackageTable.companyBranchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), eq(crmSpPackageTable.companyBranchId, query.companyBranchId ?? "").if(query.companyBranchId), softDeletedFilter(crmSpPackageTable));
147855
+ const filter = and(eq(crmSpPackageTable.companyId, user2.companyId), ilike(crmSpPackageTable.name, `%${query.name}%`).if(query.name), eq(crmSpPackageTable.priceTotal, query.priceTotal ?? 0).if(query.priceTotal), or(isNull2(crmSpPackageTable.companyBranchId), eq(crmSpPackageTable.companyBranchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), eq(crmSpPackageTable.companyBranchId, query.companyBranchId ?? "").if(query.companyBranchId), eq(crmSpPackageTable.id, query.id).if(query.id), softDeletedFilter(crmSpPackageTable));
147776
147856
  const baseQuery = db_default.select({
147777
147857
  ...columns,
147778
147858
  totalCount: totalCountSql,
@@ -151070,7 +151150,7 @@ var CrmCpOrderLogic;
151070
151150
  t2.make.id,
151071
151151
  t2.model.id,
151072
151152
  t2.customer.id
151073
- ]).orderBy(desc(crmCpOrderTable.createdAt), desc(crmCpOrderItemTable.createdAt)).$dynamic();
151153
+ ]).orderBy(desc(crmCpOrderTable.createdAt)).$dynamic();
151074
151154
  const result = await pagination_helper_default(baseQuery, query.pagination);
151075
151155
  const content = {
151076
151156
  totalCount: result[0]?.totalCount ?? 0,
@@ -152865,7 +152945,7 @@ var CrmSpPackageModel;
152865
152945
  CrmSpPackageModel.update = t.Omit(OmitBaseSchema(updateSchema), ["companyId"]);
152866
152946
  CrmSpPackageModel.select = t.Composite([
152867
152947
  PaginationSchema,
152868
- t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId"]))
152948
+ t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId", "id"]))
152869
152949
  ]);
152870
152950
  })(CrmSpPackageModel ||= {});
152871
152951
  var model_default15 = CrmSpPackageModel;
@@ -153909,6 +153989,15 @@ var itemRoutes2 = new Elysia({
153909
153989
  query: model_default23.selectTransaction
153910
153990
  }).post("/change-quantity", async ({ body, user: user2 }) => logic_default6.changeQuantity(body, user2), {
153911
153991
  body: model_default23.changeQuantity
153992
+ }).post("/order", async ({ user: user2 }) => {
153993
+ const current = await db_default.select({
153994
+ id: warehouseItemTable.id
153995
+ }).from(warehouseItemTable).innerJoin(warehouseProductTable, eq(warehouseItemTable.productId, warehouseProductTable.id)).where(eq(warehouseProductTable.companyId, user2.companyId)).orderBy(warehouseProductTable.oldId);
153996
+ for (const [index2, item] of current.entries()) {
153997
+ await db_default.update(warehouseItemTable).set({
153998
+ order: (index2 + 1) / 10
153999
+ }).where(eq(warehouseItemTable.id, item.id));
154000
+ }
153912
154001
  }).guard({
153913
154002
  params: IdSchema
153914
154003
  }).put("/:id", async ({ body, params: { id } }) => logic_default6.update(id, body), {
@@ -154335,8 +154424,134 @@ var inspectionRoutes2 = new Elysia({
154335
154424
  });
154336
154425
  var inspection_default2 = inspectionRoutes2;
154337
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")));
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/index.ts
154531
+ var templateRoutes2 = new Elysia({
154532
+ prefix: "/template",
154533
+ tags: ["PmTemplate"]
154534
+ }).use(better_auth_default).guard({
154535
+ userKind: "COMPANY_ADMIN"
154536
+ }).get("/", async ({ query, user: user2 }) => logic_default31.select(query, user2), {
154537
+ query: model_default31.select
154538
+ }).post("/", async ({ body, user: user2 }) => logic_default31.create(body, user2), {
154539
+ body: model_default31.create
154540
+ }).guard({
154541
+ params: IdSchema
154542
+ }).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default31.update(id, body, user2), {
154543
+ body: model_default31.update
154544
+ }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default31.remove(id, user2));
154545
+ var template_default2 = templateRoutes2;
154546
+
154547
+ // src/routes/fleet/pm/index.ts
154548
+ var pmRoutes = new Elysia({
154549
+ prefix: "/pm"
154550
+ }).use(template_default2);
154551
+ var pm_default = pmRoutes;
154552
+
154338
154553
  // src/routes/fleet/index.ts
154339
- var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2);
154554
+ var fleetRoutes = new Elysia({ prefix: "/fleet" }).use(inspection_default2).use(pm_default).use(machine_default);
154340
154555
  var fleet_default = fleetRoutes;
154341
154556
 
154342
154557
  // src/routes/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.2.26",
3
+ "version": "1.2.28",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",