autosync_backend2 1.1.51 → 1.1.52
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 +154 -41
- package/dist/index.js +244 -70
- 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>;
|
468
469
|
customerId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
469
470
|
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<{
|
@@ -486,8 +486,8 @@ export declare const app: Elysia<"", {
|
|
486
486
|
createdAt: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
487
487
|
phone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
488
488
|
orderId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
489
|
-
vin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
490
489
|
licensePlate: import("@sinclair/typebox").TOptional<import("elysia/dist/type-system/types").TTransform<import("@sinclair/typebox").TString, string>>;
|
490
|
+
vin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
491
491
|
state: import("@sinclair/typebox").TOptional<import("elysia/dist/type-system/types").TUnionEnum<["CREATED", "PROGRESSING", "COMPLETE"]>>;
|
492
492
|
timeCompleted: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
493
493
|
model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
@@ -698,6 +698,24 @@ export declare const app: Elysia<"", {
|
|
698
698
|
note: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
|
699
699
|
authUserId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
700
700
|
}>;
|
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
|
+
inspection: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
705
|
+
type: import("@sinclair/typebox").TString;
|
706
|
+
values: import("@sinclair/typebox").TObject<{
|
707
|
+
question: import("@sinclair/typebox").TString;
|
708
|
+
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>;
|
714
|
+
}>>;
|
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
|
+
licensePlate: import("@sinclair/typebox").TString;
|
718
|
+
}>;
|
701
719
|
readonly "TechdocSupplierModel.select": import("@sinclair/typebox").TObject<{
|
702
720
|
pagination: import("@sinclair/typebox").TObject<{
|
703
721
|
page: import("@sinclair/typebox").TInteger;
|
@@ -756,7 +774,7 @@ export declare const app: Elysia<"", {
|
|
756
774
|
route: string;
|
757
775
|
request: Request;
|
758
776
|
store: {};
|
759
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
777
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
760
778
|
readonly 100: "Continue";
|
761
779
|
readonly 101: "Switching Protocols";
|
762
780
|
readonly 102: "Processing";
|
@@ -879,7 +897,7 @@ export declare const app: Elysia<"", {
|
|
879
897
|
readonly "Not Extended": 510;
|
880
898
|
readonly "Network Authentication Required": 511;
|
881
899
|
}[Code] : Code>;
|
882
|
-
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
900
|
+
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
883
901
|
readonly 100: "Continue";
|
884
902
|
readonly 101: "Switching Protocols";
|
885
903
|
readonly 102: "Processing";
|
@@ -1047,7 +1065,7 @@ export declare const app: Elysia<"", {
|
|
1047
1065
|
route: string;
|
1048
1066
|
request: Request;
|
1049
1067
|
store: {};
|
1050
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
1068
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
1051
1069
|
readonly 100: "Continue";
|
1052
1070
|
readonly 101: "Switching Protocols";
|
1053
1071
|
readonly 102: "Processing";
|
@@ -1170,7 +1188,7 @@ export declare const app: Elysia<"", {
|
|
1170
1188
|
readonly "Not Extended": 510;
|
1171
1189
|
readonly "Network Authentication Required": 511;
|
1172
1190
|
}[Code] : Code>;
|
1173
|
-
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
1191
|
+
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
1174
1192
|
readonly 100: "Continue";
|
1175
1193
|
readonly 101: "Switching Protocols";
|
1176
1194
|
readonly 102: "Processing";
|
@@ -1338,7 +1356,7 @@ export declare const app: Elysia<"", {
|
|
1338
1356
|
route: string;
|
1339
1357
|
request: Request;
|
1340
1358
|
store: {};
|
1341
|
-
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
1359
|
+
status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
1342
1360
|
readonly 100: "Continue";
|
1343
1361
|
readonly 101: "Switching Protocols";
|
1344
1362
|
readonly 102: "Processing";
|
@@ -1461,7 +1479,7 @@ export declare const app: Elysia<"", {
|
|
1461
1479
|
readonly "Not Extended": 510;
|
1462
1480
|
readonly "Network Authentication Required": 511;
|
1463
1481
|
}[Code] : Code>;
|
1464
|
-
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 200 | 400 | 301 | 302 | 303 | 307 | 308 |
|
1482
|
+
error: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 100 | 200 | 400 | 301 | 302 | 303 | 307 | 308 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 300 | 304 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
|
1465
1483
|
readonly 100: "Continue";
|
1466
1484
|
readonly 101: "Switching Protocols";
|
1467
1485
|
readonly 102: "Processing";
|
@@ -2218,10 +2236,11 @@ export declare const app: Elysia<"", {
|
|
2218
2236
|
query: unknown;
|
2219
2237
|
headers: unknown;
|
2220
2238
|
response: {
|
2221
|
-
200: AsyncGenerator<{
|
2239
|
+
200: AsyncGenerator<import("elysia/dist/error").ElysiaCustomStatusResponse<"Not Found", "Агуулахын бараа олдсонгүй.", 404> | import("elysia/dist/error").ElysiaCustomStatusResponse<"Bad Request", "Ажилтны мэдээлэл шаардлагатай.", 400> | import("elysia/dist/error").ElysiaCustomStatusResponse<"Bad Request", "Барааны үлдэгдэл хүрэлцэхгүй байна.", 400> | {
|
2222
2240
|
percent: number;
|
2223
2241
|
count: number;
|
2224
2242
|
total: number;
|
2243
|
+
type: string;
|
2225
2244
|
}, void, unknown>;
|
2226
2245
|
422: {
|
2227
2246
|
type: "validation";
|
@@ -3620,15 +3639,9 @@ export declare const app: Elysia<"", {
|
|
3620
3639
|
emailVerified: boolean;
|
3621
3640
|
createdAt: Date;
|
3622
3641
|
updatedAt: Date;
|
3623
|
-
} | {
|
3624
|
-
id: string;
|
3625
|
-
email: string;
|
3626
|
-
name: string;
|
3627
|
-
image: string | null | undefined;
|
3628
|
-
emailVerified: boolean;
|
3629
|
-
createdAt: Date;
|
3630
|
-
updatedAt: Date;
|
3631
3642
|
};
|
3643
|
+
400: string;
|
3644
|
+
500: "Хэрэглэгч бүртгэхэд алдаа гарлаа.";
|
3632
3645
|
422: {
|
3633
3646
|
type: "validation";
|
3634
3647
|
on: string;
|
@@ -4378,8 +4391,8 @@ export declare const app: Elysia<"", {
|
|
4378
4391
|
id?: string | undefined;
|
4379
4392
|
createdAt?: string | undefined;
|
4380
4393
|
phone?: string | undefined;
|
4381
|
-
vin?: string | undefined;
|
4382
4394
|
licensePlate?: string | undefined;
|
4395
|
+
vin?: string | undefined;
|
4383
4396
|
orderId?: string | undefined;
|
4384
4397
|
state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
|
4385
4398
|
timeCompleted?: string | undefined;
|
@@ -4494,9 +4507,9 @@ export declare const app: Elysia<"", {
|
|
4494
4507
|
post: {
|
4495
4508
|
body: {
|
4496
4509
|
phone?: string | undefined;
|
4510
|
+
licensePlate?: string | undefined;
|
4497
4511
|
vehicleKindId?: string | undefined;
|
4498
4512
|
vin?: string | undefined;
|
4499
|
-
licensePlate?: string | undefined;
|
4500
4513
|
};
|
4501
4514
|
params: {};
|
4502
4515
|
query: unknown;
|
@@ -4633,22 +4646,13 @@ export declare const app: Elysia<"", {
|
|
4633
4646
|
};
|
4634
4647
|
} & {
|
4635
4648
|
"cp-order": {
|
4636
|
-
|
4637
|
-
|
4649
|
+
complete: {
|
4650
|
+
post: {
|
4638
4651
|
body: {
|
4639
|
-
companyId?: string | undefined;
|
4640
|
-
isNoat?: boolean | null | undefined;
|
4641
|
-
customerId?: string | null | undefined;
|
4642
|
-
km?: number | undefined;
|
4643
|
-
vehicleId?: string | undefined;
|
4644
|
-
companyBranchId?: string | undefined;
|
4645
|
-
orderId?: string | undefined;
|
4646
|
-
state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
|
4647
|
-
timeCompleted?: string | null | undefined;
|
4648
|
-
};
|
4649
|
-
params: {
|
4650
4652
|
id: string;
|
4653
|
+
km: number;
|
4651
4654
|
};
|
4655
|
+
params: {};
|
4652
4656
|
query: unknown;
|
4653
4657
|
headers: unknown;
|
4654
4658
|
response: {
|
@@ -4683,11 +4687,18 @@ export declare const app: Elysia<"", {
|
|
4683
4687
|
};
|
4684
4688
|
} & {
|
4685
4689
|
"cp-order": {
|
4686
|
-
|
4687
|
-
|
4690
|
+
":id": {
|
4691
|
+
put: {
|
4688
4692
|
body: {
|
4689
|
-
|
4690
|
-
|
4693
|
+
companyId?: string | undefined;
|
4694
|
+
isNoat?: boolean | null | undefined;
|
4695
|
+
vehicleId?: string | undefined;
|
4696
|
+
customerId?: string | null | undefined;
|
4697
|
+
km?: number | undefined;
|
4698
|
+
companyBranchId?: string | undefined;
|
4699
|
+
orderId?: string | undefined;
|
4700
|
+
state?: "CREATED" | "PROGRESSING" | "COMPLETE" | undefined;
|
4701
|
+
timeCompleted?: string | null | undefined;
|
4691
4702
|
};
|
4692
4703
|
params: {
|
4693
4704
|
id: string;
|
@@ -5415,8 +5426,8 @@ export declare const app: Elysia<"", {
|
|
5415
5426
|
params: {};
|
5416
5427
|
query: {
|
5417
5428
|
id?: string | undefined;
|
5418
|
-
vin?: string | undefined;
|
5419
5429
|
licensePlate?: string | undefined;
|
5430
|
+
vin?: string | undefined;
|
5420
5431
|
pagination: {
|
5421
5432
|
size: number;
|
5422
5433
|
page: number;
|
@@ -5497,9 +5508,9 @@ export declare const app: Elysia<"", {
|
|
5497
5508
|
post: {
|
5498
5509
|
body: {
|
5499
5510
|
companyId?: string | null | undefined;
|
5511
|
+
licensePlate?: string | null | undefined;
|
5500
5512
|
customerId?: string | null | undefined;
|
5501
5513
|
vin?: string | null | undefined;
|
5502
|
-
licensePlate?: string | null | undefined;
|
5503
5514
|
color?: string | null | undefined;
|
5504
5515
|
engineCc?: string | null | undefined;
|
5505
5516
|
cylinder?: string | null | undefined;
|
@@ -5525,10 +5536,10 @@ export declare const app: Elysia<"", {
|
|
5525
5536
|
updatedAt: string;
|
5526
5537
|
companyId: string | null;
|
5527
5538
|
deletedAt: string | null;
|
5539
|
+
licensePlate: string | null;
|
5528
5540
|
customerId: string | null;
|
5529
5541
|
vehicleKindId: string;
|
5530
5542
|
vin: string | null;
|
5531
|
-
licensePlate: string | null;
|
5532
5543
|
color: string | null;
|
5533
5544
|
engineCc: string | null;
|
5534
5545
|
cylinder: string | null;
|
@@ -5650,10 +5661,10 @@ export declare const app: Elysia<"", {
|
|
5650
5661
|
put: {
|
5651
5662
|
body: {
|
5652
5663
|
companyId?: string | null | undefined;
|
5664
|
+
licensePlate?: string | null | undefined;
|
5653
5665
|
customerId?: string | null | undefined;
|
5654
5666
|
vehicleKindId?: string | undefined;
|
5655
5667
|
vin?: string | null | undefined;
|
5656
|
-
licensePlate?: string | null | undefined;
|
5657
5668
|
color?: string | null | undefined;
|
5658
5669
|
engineCc?: string | null | undefined;
|
5659
5670
|
cylinder?: string | null | undefined;
|
@@ -5802,10 +5813,10 @@ export declare const app: Elysia<"", {
|
|
5802
5813
|
updatedAt: string;
|
5803
5814
|
companyId: string | null;
|
5804
5815
|
deletedAt: string | null;
|
5816
|
+
licensePlate: string | null;
|
5805
5817
|
customerId: string | null;
|
5806
5818
|
vehicleKindId: string;
|
5807
5819
|
vin: string | null;
|
5808
|
-
licensePlate: string | null;
|
5809
5820
|
color: string | null;
|
5810
5821
|
engineCc: string | null;
|
5811
5822
|
cylinder: string | null;
|
@@ -6334,6 +6345,108 @@ export declare const app: Elysia<"", {
|
|
6334
6345
|
};
|
6335
6346
|
};
|
6336
6347
|
};
|
6348
|
+
} & {
|
6349
|
+
crm: {
|
6350
|
+
inspection: {};
|
6351
|
+
} & {
|
6352
|
+
inspection: {
|
6353
|
+
post: {
|
6354
|
+
body: {
|
6355
|
+
employeeId?: string | null | undefined;
|
6356
|
+
description?: string | null | undefined;
|
6357
|
+
experience?: string | null | undefined;
|
6358
|
+
rank?: string | null | undefined;
|
6359
|
+
inspection: {
|
6360
|
+
description?: string | undefined;
|
6361
|
+
isApproved?: boolean | undefined;
|
6362
|
+
type: string;
|
6363
|
+
employeeId: string;
|
6364
|
+
values: {
|
6365
|
+
description?: string | undefined;
|
6366
|
+
question: string;
|
6367
|
+
answer: string;
|
6368
|
+
};
|
6369
|
+
}[];
|
6370
|
+
licensePlate: string;
|
6371
|
+
};
|
6372
|
+
params: {};
|
6373
|
+
query: unknown;
|
6374
|
+
headers: unknown;
|
6375
|
+
response: {
|
6376
|
+
200: {
|
6377
|
+
id: string;
|
6378
|
+
createdAt: string;
|
6379
|
+
updatedAt: string;
|
6380
|
+
companyId: string;
|
6381
|
+
branchId: string;
|
6382
|
+
employeeId: string | null;
|
6383
|
+
deletedAt: string | null;
|
6384
|
+
description: string | null;
|
6385
|
+
vehicleId: string;
|
6386
|
+
inspection: {
|
6387
|
+
description?: string | undefined;
|
6388
|
+
isApproved?: boolean | undefined;
|
6389
|
+
type: string;
|
6390
|
+
employeeId: string;
|
6391
|
+
values: {
|
6392
|
+
description?: string | undefined;
|
6393
|
+
question: string;
|
6394
|
+
answer: string;
|
6395
|
+
};
|
6396
|
+
}[] | null;
|
6397
|
+
expireAt: Date;
|
6398
|
+
experience: string | null;
|
6399
|
+
rank: string | null;
|
6400
|
+
licensePlate: string;
|
6401
|
+
};
|
6402
|
+
502: string;
|
6403
|
+
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
6404
|
+
422: {
|
6405
|
+
type: "validation";
|
6406
|
+
on: string;
|
6407
|
+
summary?: string;
|
6408
|
+
message?: string;
|
6409
|
+
found?: unknown;
|
6410
|
+
property?: string;
|
6411
|
+
expected?: string;
|
6412
|
+
};
|
6413
|
+
};
|
6414
|
+
};
|
6415
|
+
};
|
6416
|
+
} & {
|
6417
|
+
inspection: {
|
6418
|
+
":id": {
|
6419
|
+
"service-order": {
|
6420
|
+
post: {
|
6421
|
+
body: unknown;
|
6422
|
+
params: {
|
6423
|
+
id: string;
|
6424
|
+
};
|
6425
|
+
query: unknown;
|
6426
|
+
headers: unknown;
|
6427
|
+
response: {
|
6428
|
+
200: {
|
6429
|
+
cpOrderId: string;
|
6430
|
+
};
|
6431
|
+
502: string;
|
6432
|
+
400: string;
|
6433
|
+
404: "Үзлэг олдсонгүй.";
|
6434
|
+
500: "Алдаа гарлаа. Дахин оролдоно уу.";
|
6435
|
+
422: {
|
6436
|
+
type: "validation";
|
6437
|
+
on: string;
|
6438
|
+
summary?: string;
|
6439
|
+
message?: string;
|
6440
|
+
found?: unknown;
|
6441
|
+
property?: string;
|
6442
|
+
expected?: string;
|
6443
|
+
};
|
6444
|
+
};
|
6445
|
+
};
|
6446
|
+
};
|
6447
|
+
};
|
6448
|
+
};
|
6449
|
+
};
|
6337
6450
|
};
|
6338
6451
|
} & {
|
6339
6452
|
api: {
|
package/dist/index.js
CHANGED
@@ -137477,6 +137477,7 @@ __export(exports_schema, {
|
|
137477
137477
|
crmSchema: () => crmSchema,
|
137478
137478
|
crmPaymentTypeEnum: () => crmPaymentTypeEnum,
|
137479
137479
|
crmPaymentTable: () => crmPaymentTable,
|
137480
|
+
crmInspectionTable: () => crmInspectionTable,
|
137480
137481
|
crmDiscountTypeEnum: () => crmDiscountTypeEnum,
|
137481
137482
|
crmDiscountTable: () => crmDiscountTable,
|
137482
137483
|
crmDiscountStateEnum: () => crmDiscountStateEnum,
|
@@ -137885,6 +137886,19 @@ var crmDiscountApplyTable = crmSchema.table("discount_apply", {
|
|
137885
137886
|
authUserId: text().notNull(),
|
137886
137887
|
employeeId: uuid().notNull()
|
137887
137888
|
});
|
137889
|
+
var crmInspectionTable = crmSchema.table("inspections", {
|
137890
|
+
...base_schema_helper_default,
|
137891
|
+
companyId: uuid().notNull(),
|
137892
|
+
branchId: uuid().notNull(),
|
137893
|
+
vehicleId: uuid().notNull(),
|
137894
|
+
inspection: jsonb().$type(),
|
137895
|
+
employeeId: uuid(),
|
137896
|
+
expireAt: timestamp().notNull().default(sql3`now() + interval '6 month'`),
|
137897
|
+
experience: varchar(),
|
137898
|
+
rank: varchar(),
|
137899
|
+
licensePlate: varchar().notNull(),
|
137900
|
+
description: text()
|
137901
|
+
});
|
137888
137902
|
// src/lib/db/schema/techdoc.schema.ts
|
137889
137903
|
var techdocSchema = pgSchema("techdoc");
|
137890
137904
|
var techdocVehicleKindEnum = pgEnum("vehicle_kind_enum", [
|
@@ -141713,6 +141727,19 @@ var CompanyServiceKindLogic;
|
|
141713
141727
|
}).returning();
|
141714
141728
|
return result;
|
141715
141729
|
};
|
141730
|
+
CompanyServiceKindLogic.getInspection = async (user2, tdb = db_default) => {
|
141731
|
+
const [serviceKind] = await tdb.select().from(companyServiceKindTable).where(and(eq(companyServiceKindTable.name, "UBCAB \u0445\u044F\u043D\u0430\u043B\u0442\u0438\u0439\u043D \u04AF\u0437\u043B\u044D\u0433"), eq(companyServiceKindTable.companyId, user2.companyId)));
|
141732
|
+
if (serviceKind) {
|
141733
|
+
return serviceKind;
|
141734
|
+
}
|
141735
|
+
const [res] = await tdb.insert(companyServiceKindTable).values({
|
141736
|
+
name: "UBCAB \u0445\u044F\u043D\u0430\u043B\u0442\u0438\u0439\u043D \u04AF\u0437\u043B\u044D\u0433",
|
141737
|
+
companyId: user2.companyId,
|
141738
|
+
enabled: true,
|
141739
|
+
price: 30000
|
141740
|
+
}).returning();
|
141741
|
+
return res;
|
141742
|
+
};
|
141716
141743
|
CompanyServiceKindLogic.update = async (id, body, user2) => {
|
141717
141744
|
const [result] = await db_default.update(companyServiceKindTable).set(body).where(and(eq(companyServiceKindTable.id, id), eq(companyServiceKindTable.companyId, user2.companyId), eq(companyServiceKindTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"))).returning();
|
141718
141745
|
if (!result) {
|
@@ -141973,16 +142000,56 @@ var WarehouseItemLogic;
|
|
141973
142000
|
});
|
141974
142001
|
return result;
|
141975
142002
|
};
|
141976
|
-
WarehouseItemLogic.createMany = async function* (body) {
|
142003
|
+
WarehouseItemLogic.createMany = async function* (body, user2) {
|
142004
|
+
if (!user2.employeeId) {
|
142005
|
+
throw status("Bad Request", "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439.");
|
142006
|
+
}
|
141977
142007
|
const BATCH_SIZE = 1000;
|
142008
|
+
const currentItems = await db_default.select().from(warehouseItemTable).where(inArray(warehouseItemTable.productId, body.map((item) => item.productId)));
|
142009
|
+
const newItems = body.filter((item) => !currentItems.map((i2) => i2.productId).includes(item.productId));
|
141978
142010
|
for (let i2 = 0;i2 < body.length; i2 += BATCH_SIZE) {
|
141979
|
-
const batch =
|
141980
|
-
await db_default.insert(warehouseItemTable).values(batch);
|
141981
|
-
|
142011
|
+
const batch = newItems.slice(i2, i2 + BATCH_SIZE);
|
142012
|
+
const inserted = await db_default.insert(warehouseItemTable).values(batch).returning();
|
142013
|
+
await db_default.insert(warehouseItemTransactionTable).values(inserted.map((i3) => ({
|
142014
|
+
itemId: i3.id,
|
142015
|
+
productId: i3.productId,
|
142016
|
+
transactionType: "IN",
|
142017
|
+
transactionKind: "TRANSFER",
|
142018
|
+
quantity: i3.quantity,
|
142019
|
+
quantityBefore: 0,
|
142020
|
+
quantityAfter: i3.quantity,
|
142021
|
+
description: "\u0411\u0430\u0440\u0430\u0430 \u043E\u0440\u043B\u043E\u0433\u0434\u043E\u0445",
|
142022
|
+
employeeId: user2.employeeId ?? "",
|
142023
|
+
userId: user2.id
|
142024
|
+
})));
|
142025
|
+
const percent = Math.round((i2 * BATCH_SIZE + batch.length) / newItems.length * 100);
|
141982
142026
|
yield {
|
141983
142027
|
percent: percent >= 100 ? 100 : percent,
|
141984
142028
|
count: i2,
|
141985
|
-
total: body.length
|
142029
|
+
total: body.length,
|
142030
|
+
type: "New Items"
|
142031
|
+
};
|
142032
|
+
}
|
142033
|
+
for (const [index2, item] of currentItems.entries()) {
|
142034
|
+
const bodyItem = body.find((i2) => i2.productId === item.productId);
|
142035
|
+
const res = await WarehouseItemLogic.changeQuantity({
|
142036
|
+
itemId: item.id,
|
142037
|
+
quantityChange: bodyItem?.quantity ?? 0,
|
142038
|
+
transactionDetails: {
|
142039
|
+
transactionType: "IN",
|
142040
|
+
transactionKind: "TRANSFER",
|
142041
|
+
description: "\u0411\u0430\u0440\u0430\u0430 \u043E\u0440\u043B\u043E\u0433\u0434\u043E\u0445"
|
142042
|
+
}
|
142043
|
+
}, user2);
|
142044
|
+
if ("code" in res) {
|
142045
|
+
yield res;
|
142046
|
+
}
|
142047
|
+
const percent = Math.round(index2 / currentItems.length * 100);
|
142048
|
+
yield {
|
142049
|
+
percent: percent >= 100 ? 100 : percent,
|
142050
|
+
count: index2,
|
142051
|
+
total: currentItems.length,
|
142052
|
+
type: "Current Items"
|
141986
142053
|
};
|
141987
142054
|
}
|
141988
142055
|
};
|
@@ -142183,23 +142250,28 @@ var CrmCpOrderItemLogic;
|
|
142183
142250
|
if (body.priceUnit && body.quantity) {
|
142184
142251
|
priceTotal = body.priceUnit * body.quantity;
|
142185
142252
|
}
|
142186
|
-
|
142187
|
-
|
142188
|
-
|
142189
|
-
|
142190
|
-
|
142191
|
-
|
142192
|
-
|
142193
|
-
|
142194
|
-
|
142195
|
-
|
142196
|
-
|
142197
|
-
|
142198
|
-
|
142199
|
-
|
142253
|
+
return db_default.transaction(async (db2) => {
|
142254
|
+
const [result] = await db2.update(crmCpOrderItemTable).set({
|
142255
|
+
...body,
|
142256
|
+
priceTotal
|
142257
|
+
}).where(eq(crmCpOrderItemTable.id, id)).returning();
|
142258
|
+
if (!result) {
|
142259
|
+
return status("Not Found", "\u04AE\u0439\u043B\u0447\u0438\u043B\u0433\u044D\u044D \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
142260
|
+
}
|
142261
|
+
if (body.quantity && currentItem.companyProductId) {
|
142262
|
+
const quantityDifference = body.quantity - currentItem.quantity;
|
142263
|
+
if (quantityDifference !== 0) {
|
142264
|
+
const res = await CrmCpOrderItemLogic.handleWarehouseQuantityChange(currentItem.companyProductId, quantityDifference, user2, {
|
142265
|
+
orderId: currentItem.cpOrderId,
|
142266
|
+
description: `\u0411\u043E\u0440\u043B\u0443\u0443\u043B\u0430\u043B\u0442\u044B\u043D \u0431\u0430\u0440\u0430\u0430\u043D\u044B \u0442\u043E\u043E \u04E9\u04E9\u0440\u0447\u043B\u04E9\u0433\u0434\u0441\u04E9\u043D: ${currentItem.quantity} -> ${body.quantity}`
|
142267
|
+
});
|
142268
|
+
if ("code" in res) {
|
142269
|
+
throw res;
|
142270
|
+
}
|
142271
|
+
}
|
142200
142272
|
}
|
142201
|
-
|
142202
|
-
|
142273
|
+
return result;
|
142274
|
+
});
|
142203
142275
|
};
|
142204
142276
|
CrmCpOrderItemLogic.remove = async (id, user2) => {
|
142205
142277
|
const [currentItem] = await db_default.select().from(crmCpOrderItemTable).where(eq(crmCpOrderItemTable.id, id)).limit(1);
|
@@ -145345,7 +145417,7 @@ var CrmCpOrderLogic;
|
|
145345
145417
|
...content
|
145346
145418
|
};
|
145347
145419
|
};
|
145348
|
-
CrmCpOrderLogic.create = async (body, user2) => {
|
145420
|
+
CrmCpOrderLogic.create = async (body, user2, tdb = db_default) => {
|
145349
145421
|
return db_default.transaction(async (db2) => {
|
145350
145422
|
let customerId;
|
145351
145423
|
if (body.phone) {
|
@@ -145483,6 +145555,9 @@ var CrmCpOrderLogic;
|
|
145483
145555
|
deletedAt: nowSql_helper_default
|
145484
145556
|
}).where(eq(crmCpOrderTable.id, id));
|
145485
145557
|
};
|
145558
|
+
CrmCpOrderLogic.hardRemove = async (id, user2) => {
|
145559
|
+
await db_default.delete(crmCpOrderTable).where(and(eq(crmCpOrderTable.id, id), eq(crmCpOrderTable.companyId, user2.companyId)));
|
145560
|
+
};
|
145486
145561
|
CrmCpOrderLogic.selectPayments = async (id) => {
|
145487
145562
|
const [totalAmount] = await logic_default5.selectAmountTotal(id);
|
145488
145563
|
const [packageAmount] = await logic_default7.selectAmountTotal(id);
|
@@ -145972,12 +146047,12 @@ var cpOrderRoutes = new Elysia({
|
|
145972
146047
|
body: "CrmCpOrderModel.create"
|
145973
146048
|
}).post("/package", async ({ body, user: user2 }) => logic_default12.addPackage(body, user2), {
|
145974
146049
|
body: "CrmCpOrderModel.addPackage"
|
146050
|
+
}).post("/complete", async ({ user: user2, body }) => logic_default12.complete(body, user2), {
|
146051
|
+
body: "CrmCpOrderModel.complete"
|
145975
146052
|
}).guard({
|
145976
146053
|
params: IdSchema
|
145977
146054
|
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default12.update(id, body, user2), {
|
145978
146055
|
body: "CrmCpOrderModel.update"
|
145979
|
-
}).post("/complete", async ({ user: user2, body }) => logic_default12.complete(body, user2), {
|
145980
|
-
body: "CrmCpOrderModel.complete"
|
145981
146056
|
}).delete("/:id", async ({ user: user2, params: { id } }) => logic_default12.remove(id, user2)).get("/:id/payment", async ({ params: { id } }) => logic_default12.selectPayments(id), {
|
145982
146057
|
tags: ["CrmCpOrderPayment", "CrmCpOrder"]
|
145983
146058
|
});
|
@@ -146349,10 +146424,102 @@ var vehicleRoutes = new Elysia({
|
|
146349
146424
|
}).delete("/:id", async ({ params, user: user2 }) => logic_default9.remove(params.id, user2)));
|
146350
146425
|
var vehicle_default = vehicleRoutes;
|
146351
146426
|
|
146427
|
+
// src/routes/crm/inspection/logic.ts
|
146428
|
+
var CrmInspectionLogic;
|
146429
|
+
((CrmInspectionLogic) => {
|
146430
|
+
CrmInspectionLogic.create = async (body, user2) => {
|
146431
|
+
const vehicle = await logic_default9.findOrCreate({
|
146432
|
+
licensePlate: body.licensePlate
|
146433
|
+
});
|
146434
|
+
if ("code" in vehicle) {
|
146435
|
+
return vehicle;
|
146436
|
+
}
|
146437
|
+
const [res] = await db_default.insert(crmInspectionTable).values({
|
146438
|
+
companyId: user2.companyId,
|
146439
|
+
branchId: user2.branchId,
|
146440
|
+
vehicleId: vehicle.id,
|
146441
|
+
employeeId: user2.employeeId,
|
146442
|
+
...body
|
146443
|
+
}).returning();
|
146444
|
+
return res;
|
146445
|
+
};
|
146446
|
+
CrmInspectionLogic.createCpOrder = async (id, user2) => {
|
146447
|
+
const [inspection] = await db_default.select().from(crmInspectionTable).where(eq(crmInspectionTable.id, id));
|
146448
|
+
if (!inspection) {
|
146449
|
+
return status("Not Found", "\u04AE\u0437\u043B\u044D\u0433 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
146450
|
+
}
|
146451
|
+
const cpOrder = await logic_default12.create({
|
146452
|
+
licensePlate: inspection.licensePlate
|
146453
|
+
}, user2, db_default);
|
146454
|
+
if ("code" in cpOrder) {
|
146455
|
+
return cpOrder;
|
146456
|
+
}
|
146457
|
+
try {
|
146458
|
+
await db_default.transaction(async (db2) => {
|
146459
|
+
const serviceKind = await logic_default2.getInspection(user2, db2);
|
146460
|
+
await logic_default5.create({
|
146461
|
+
quantity: 1,
|
146462
|
+
cpOrderId: cpOrder.id,
|
146463
|
+
companyServiceKindId: serviceKind.id
|
146464
|
+
}, user2);
|
146465
|
+
});
|
146466
|
+
} catch (err2) {
|
146467
|
+
await logic_default12.hardRemove(cpOrder.id, user2);
|
146468
|
+
if (err2 instanceof Error) {
|
146469
|
+
return status("Bad Request", err2.message);
|
146470
|
+
}
|
146471
|
+
return status("Internal Server Error", "\u0410\u043B\u0434\u0430\u0430 \u0433\u0430\u0440\u043B\u0430\u0430. \u0414\u0430\u0445\u0438\u043D \u043E\u0440\u043E\u043B\u0434\u043E\u043D\u043E \u0443\u0443.");
|
146472
|
+
}
|
146473
|
+
return {
|
146474
|
+
cpOrderId: cpOrder.id
|
146475
|
+
};
|
146476
|
+
};
|
146477
|
+
})(CrmInspectionLogic ||= {});
|
146478
|
+
var logic_default15 = CrmInspectionLogic;
|
146479
|
+
|
146480
|
+
// src/routes/crm/inspection/model.ts
|
146481
|
+
var CrmInspectionModel;
|
146482
|
+
((CrmInspectionModel) => {
|
146483
|
+
const inspectionSchema = t.Object({
|
146484
|
+
type: t.String(),
|
146485
|
+
values: t.Object({
|
146486
|
+
question: t.String(),
|
146487
|
+
answer: t.String(),
|
146488
|
+
description: t.Optional(t.String())
|
146489
|
+
}),
|
146490
|
+
employeeId: t.String({ format: "uuid" }),
|
146491
|
+
description: t.Optional(t.String()),
|
146492
|
+
isApproved: t.Optional(t.Boolean())
|
146493
|
+
});
|
146494
|
+
const createSchema = createInsertSchema(crmInspectionTable, {
|
146495
|
+
inspection: t.Array(inspectionSchema, {
|
146496
|
+
minItems: 1
|
146497
|
+
})
|
146498
|
+
});
|
146499
|
+
CrmInspectionModel.create = t.Omit(OmitBaseSchema(createSchema), [
|
146500
|
+
"expireAt",
|
146501
|
+
"companyId",
|
146502
|
+
"branchId",
|
146503
|
+
"vehicleId"
|
146504
|
+
]);
|
146505
|
+
})(CrmInspectionModel ||= {});
|
146506
|
+
var model_default15 = CrmInspectionModel;
|
146507
|
+
|
146508
|
+
// src/routes/crm/inspection/index.ts
|
146509
|
+
var inspectionRoutes = new Elysia({
|
146510
|
+
prefix: "/inspection",
|
146511
|
+
tags: ["CrmInspection"]
|
146512
|
+
}).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("CrmInspectionModel", model_default15)).post("/", async ({ body, user: user2 }) => logic_default15.create(body, user2), {
|
146513
|
+
body: "CrmInspectionModel.create"
|
146514
|
+
}).post("/:id/service-order", async ({ params: { id }, user: user2 }) => logic_default15.createCpOrder(id, user2), {
|
146515
|
+
params: IdSchema
|
146516
|
+
});
|
146517
|
+
var inspection_default = inspectionRoutes;
|
146518
|
+
|
146352
146519
|
// src/routes/crm/index.ts
|
146353
146520
|
var crmSchemaRoutes = new Elysia({
|
146354
146521
|
prefix: "/crm"
|
146355
|
-
}).use(cpOrder_default).use(spPackage_default).use(vehicle_default).use(customer_default).use(discount_default);
|
146522
|
+
}).use(cpOrder_default).use(spPackage_default).use(vehicle_default).use(customer_default).use(discount_default).use(inspection_default);
|
146356
146523
|
var crm_default = crmSchemaRoutes;
|
146357
146524
|
|
146358
146525
|
// src/lib/s3Client.ts
|
@@ -146621,7 +146788,7 @@ var PermissionLogic;
|
|
146621
146788
|
return permissions;
|
146622
146789
|
};
|
146623
146790
|
})(PermissionLogic ||= {});
|
146624
|
-
var
|
146791
|
+
var logic_default16 = PermissionLogic;
|
146625
146792
|
|
146626
146793
|
// src/routes/permission/model.ts
|
146627
146794
|
var PermissionModel;
|
@@ -146636,13 +146803,13 @@ var PermissionModel;
|
|
146636
146803
|
permissions: t.Array(t.String())
|
146637
146804
|
});
|
146638
146805
|
})(PermissionModel ||= {});
|
146639
|
-
var
|
146806
|
+
var model_default16 = PermissionModel;
|
146640
146807
|
|
146641
146808
|
// src/routes/permission/index.ts
|
146642
146809
|
var groupService = new CrudHelper(permissionGroupTable, "\u042D\u0440\u0445\u0438\u0439\u043D \u0431\u0430\u0433\u0446 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
146643
146810
|
var permissionRoutes = new Elysia({
|
146644
146811
|
prefix: "/permission"
|
146645
|
-
}).decorate("publicPermissions", permissionList.filter((permission) => permission?.requiresAdmin !== undefined ? permission.requiresAdmin === false : true)).model(prefix_model_default("PermissionModel",
|
146812
|
+
}).decorate("publicPermissions", permissionList.filter((permission) => permission?.requiresAdmin !== undefined ? permission.requiresAdmin === false : true)).model(prefix_model_default("PermissionModel", model_default16)).use(better_auth_default).guard({
|
146646
146813
|
auth: true,
|
146647
146814
|
tags: ["PermissionGroup"]
|
146648
146815
|
}).get("/", ({ permissions, publicPermissions }) => {
|
@@ -146652,7 +146819,7 @@ var permissionRoutes = new Elysia({
|
|
146652
146819
|
return permissionList;
|
146653
146820
|
}, {
|
146654
146821
|
permission: "PERMISSION_ADD"
|
146655
|
-
}).post("/", ({ body }) =>
|
146822
|
+
}).post("/", ({ body }) => logic_default16.addPermission(body), {
|
146656
146823
|
body: "PermissionModel.addPermission",
|
146657
146824
|
permission: "PERMISSION_ADD",
|
146658
146825
|
beforeHandle({ status: status2, body, permissions, publicPermissions }) {
|
@@ -146662,7 +146829,7 @@ var permissionRoutes = new Elysia({
|
|
146662
146829
|
}
|
146663
146830
|
}).group("/group", (app2) => app2.guard({
|
146664
146831
|
permission: "PERMISSION_GROUP_ALL"
|
146665
|
-
}).get("/", async ({ query }) => await
|
146832
|
+
}).get("/", async ({ query }) => await logic_default16.selectGroups(query), {
|
146666
146833
|
query: "PermissionModel.select"
|
146667
146834
|
}).post("/", async ({ body }) => await groupService.create(body), {
|
146668
146835
|
body: "PermissionModel.create"
|
@@ -146710,7 +146877,7 @@ var TechdocSupplierLogic;
|
|
146710
146877
|
}).where(eq(techdocSupplierTable.id, id));
|
146711
146878
|
};
|
146712
146879
|
})(TechdocSupplierLogic ||= {});
|
146713
|
-
var
|
146880
|
+
var logic_default17 = TechdocSupplierLogic;
|
146714
146881
|
|
146715
146882
|
// src/routes/techdoc/supplier/model.ts
|
146716
146883
|
var TechdocSupplierModel;
|
@@ -146728,24 +146895,24 @@ var TechdocSupplierModel;
|
|
146728
146895
|
const updateSchema = createUpdateSchema(techdocSupplierTable);
|
146729
146896
|
TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
|
146730
146897
|
})(TechdocSupplierModel ||= {});
|
146731
|
-
var
|
146898
|
+
var model_default17 = TechdocSupplierModel;
|
146732
146899
|
|
146733
146900
|
// src/routes/techdoc/supplier/index.ts
|
146734
146901
|
var supplierRoutes = new Elysia({
|
146735
146902
|
prefix: "/supplier",
|
146736
146903
|
tags: ["TechdocSupplier"]
|
146737
|
-
}).use(better_auth_default).model(prefix_model_default("TechdocSupplierModel",
|
146904
|
+
}).use(better_auth_default).model(prefix_model_default("TechdocSupplierModel", model_default17)).get("/", async ({ query, user: user2 }) => logic_default17.select(query, user2), {
|
146738
146905
|
query: "TechdocSupplierModel.select",
|
146739
146906
|
auth: true
|
146740
146907
|
}).guard({
|
146741
146908
|
userKind: "ADMIN"
|
146742
|
-
}).post("/", async ({ body }) =>
|
146909
|
+
}).post("/", async ({ body }) => logic_default17.create(body), {
|
146743
146910
|
body: "TechdocSupplierModel.create"
|
146744
146911
|
}).guard({
|
146745
146912
|
params: IdSchema
|
146746
|
-
}).put("/:id", ({ body, params: { id } }) =>
|
146913
|
+
}).put("/:id", ({ body, params: { id } }) => logic_default17.update(id, body), {
|
146747
146914
|
body: "TechdocSupplierModel.update"
|
146748
|
-
}).delete("/:id", ({ params: { id } }) =>
|
146915
|
+
}).delete("/:id", ({ params: { id } }) => logic_default17.remove(id));
|
146749
146916
|
var supplier_default = supplierRoutes;
|
146750
146917
|
|
146751
146918
|
// src/routes/techdoc/vehicleKind/model.ts
|
@@ -146759,7 +146926,7 @@ var TechdocVehicleKindModel;
|
|
146759
146926
|
const updateSchema = createUpdateSchema(techdocVehicleKindTable);
|
146760
146927
|
TechdocVehicleKindModel.update = OmitBaseSchema(updateSchema);
|
146761
146928
|
})(TechdocVehicleKindModel ||= {});
|
146762
|
-
var
|
146929
|
+
var model_default18 = TechdocVehicleKindModel;
|
146763
146930
|
|
146764
146931
|
// src/routes/techdoc/vehicleKind/index.ts
|
146765
146932
|
var vehicleKindRoutes = new Elysia({
|
@@ -146768,9 +146935,9 @@ var vehicleKindRoutes = new Elysia({
|
|
146768
146935
|
}).use(better_auth_default).guard({
|
146769
146936
|
auth: true
|
146770
146937
|
}).get("/", async ({ query }) => logic_default8.select(query), {
|
146771
|
-
query:
|
146938
|
+
query: model_default18.select
|
146772
146939
|
}).put("/:id", async ({ body, params: { id } }) => logic_default8.update(id, body), {
|
146773
|
-
body:
|
146940
|
+
body: model_default18.update,
|
146774
146941
|
params: IdSchema,
|
146775
146942
|
userKind: "ADMIN"
|
146776
146943
|
});
|
@@ -146901,7 +147068,7 @@ var UserLogic;
|
|
146901
147068
|
totalCount: totalCountSql
|
146902
147069
|
}).from(user).where(filter).$dynamic();
|
146903
147070
|
const users = await pagination_helper_default(baseQuery, query.pagination);
|
146904
|
-
const userPermissions2 = await
|
147071
|
+
const userPermissions2 = await logic_default16.selectByUserId(users.map((u) => u.id));
|
146905
147072
|
const content = {
|
146906
147073
|
totalCount: users[0]?.totalCount ?? 0,
|
146907
147074
|
totalPage: users.length === 0 ? 0 : Math.ceil(users[0].totalCount / query.pagination.size)
|
@@ -146929,20 +147096,27 @@ var UserLogic;
|
|
146929
147096
|
branchId = body.branchId;
|
146930
147097
|
}
|
146931
147098
|
}
|
146932
|
-
|
146933
|
-
|
146934
|
-
|
146935
|
-
|
146936
|
-
|
146937
|
-
|
146938
|
-
|
146939
|
-
|
146940
|
-
|
146941
|
-
|
146942
|
-
|
147099
|
+
try {
|
147100
|
+
const result = await auth2.api.signUpEmail({
|
147101
|
+
body: {
|
147102
|
+
name: body.name,
|
147103
|
+
email: body.email,
|
147104
|
+
password: body.password ?? $generate({
|
147105
|
+
length: 10,
|
147106
|
+
numbers: true
|
147107
|
+
}),
|
147108
|
+
companyId,
|
147109
|
+
branchId,
|
147110
|
+
kind: body.kind
|
147111
|
+
}
|
147112
|
+
});
|
147113
|
+
return result.user;
|
147114
|
+
} catch (err2) {
|
147115
|
+
if (err2 instanceof Error) {
|
147116
|
+
return status("Bad Request", err2.message);
|
146943
147117
|
}
|
146944
|
-
|
146945
|
-
|
147118
|
+
return status("Internal Server Error", "\u0425\u044D\u0440\u044D\u0433\u043B\u044D\u0433\u0447 \u0431\u04AF\u0440\u0442\u0433\u044D\u0445\u044D\u0434 \u0430\u043B\u0434\u0430\u0430 \u0433\u0430\u0440\u043B\u0430\u0430.");
|
147119
|
+
}
|
146946
147120
|
};
|
146947
147121
|
UserLogic.update = async (id, body, user2) => {
|
146948
147122
|
return await db_default.transaction(async (db2) => {
|
@@ -146955,7 +147129,7 @@ var UserLogic;
|
|
146955
147129
|
});
|
146956
147130
|
};
|
146957
147131
|
})(UserLogic ||= {});
|
146958
|
-
var
|
147132
|
+
var logic_default18 = UserLogic;
|
146959
147133
|
|
146960
147134
|
// src/routes/user/schema.ts
|
146961
147135
|
var select = createSelectSchema(user);
|
@@ -146987,13 +147161,13 @@ var userRoutes = new Elysia({
|
|
146987
147161
|
}).use(better_auth_default).guard({
|
146988
147162
|
auth: true,
|
146989
147163
|
tags: ["User"]
|
146990
|
-
}).get("/", async ({ query, user: user2 }) =>
|
147164
|
+
}).get("/", async ({ query, user: user2 }) => logic_default18.select(query, user2), {
|
146991
147165
|
query: selectUserSchema,
|
146992
147166
|
userKind: "COMPANY_ADMIN"
|
146993
|
-
}).get("/me", async ({ user: user2 }) => user2).post("/", async ({ body, user: user2 }) =>
|
147167
|
+
}).get("/me", async ({ user: user2 }) => user2).post("/", async ({ body, user: user2 }) => logic_default18.registerUser(body, user2), {
|
146994
147168
|
body: createUserSchema,
|
146995
147169
|
userKind: "COMPANY_ADMIN"
|
146996
|
-
}).put("/:id", async ({ body, user: user2, params: { id } }) =>
|
147170
|
+
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default18.update(id, body, user2), {
|
146997
147171
|
body: updateUserSchema,
|
146998
147172
|
userKind: "COMPANY_ADMIN"
|
146999
147173
|
});
|
@@ -147023,7 +147197,7 @@ var WarehouseProductModel;
|
|
147023
147197
|
PaginationSchema
|
147024
147198
|
]);
|
147025
147199
|
})(WarehouseProductModel ||= {});
|
147026
|
-
var
|
147200
|
+
var model_default19 = WarehouseProductModel;
|
147027
147201
|
|
147028
147202
|
// src/routes/warehouse/item/model.ts
|
147029
147203
|
var WarehouseItemModel;
|
@@ -147038,7 +147212,7 @@ var WarehouseItemModel;
|
|
147038
147212
|
WarehouseItemModel.select = t.Composite([
|
147039
147213
|
PaginationSchema,
|
147040
147214
|
t.Partial(t.Object({
|
147041
|
-
product:
|
147215
|
+
product: model_default19.select,
|
147042
147216
|
shelfNumber: t.String(),
|
147043
147217
|
safetyStock: t.Number()
|
147044
147218
|
}))
|
@@ -147055,7 +147229,7 @@ var WarehouseItemModel;
|
|
147055
147229
|
transferId: t.String({ format: "uuid", default: undefined })
|
147056
147230
|
})),
|
147057
147231
|
t.Partial(t.Object({
|
147058
|
-
product: t.Omit(
|
147232
|
+
product: t.Omit(model_default19.select, ["pagination"]),
|
147059
147233
|
itemId: t.String({ format: "uuid", default: undefined }),
|
147060
147234
|
dateFrom: t.String({ format: "date-time", default: undefined }),
|
147061
147235
|
dateTo: t.String({ format: "date-time", default: undefined }),
|
@@ -147079,19 +147253,19 @@ var WarehouseItemModel;
|
|
147079
147253
|
transactionDetails
|
147080
147254
|
});
|
147081
147255
|
})(WarehouseItemModel ||= {});
|
147082
|
-
var
|
147256
|
+
var model_default20 = WarehouseItemModel;
|
147083
147257
|
|
147084
147258
|
// src/routes/warehouse/item/index.ts
|
147085
147259
|
var itemRoutes2 = new Elysia({
|
147086
147260
|
prefix: "/item",
|
147087
147261
|
tags: ["WarehouseItem"]
|
147088
|
-
}).use(better_auth_default).model(prefix_model_default("WarehouseItemModel",
|
147262
|
+
}).use(better_auth_default).model(prefix_model_default("WarehouseItemModel", model_default20)).guard({
|
147089
147263
|
userKind: "CUSTOMER"
|
147090
147264
|
}).get("/", async ({ query, user: user2 }) => logic_default4.select(query, user2), {
|
147091
147265
|
query: "WarehouseItemModel.select"
|
147092
147266
|
}).post("/", async ({ body }) => logic_default4.create(body), {
|
147093
147267
|
body: "WarehouseItemModel.create"
|
147094
|
-
}).post("/many", async ({ body }) => logic_default4.createMany(body), {
|
147268
|
+
}).post("/many", async ({ body, user: user2 }) => logic_default4.createMany(body, user2), {
|
147095
147269
|
body: "WarehouseItemModel.createMany"
|
147096
147270
|
}).get("/transaction", async ({ query, user: user2 }) => logic_default4.selectTransaction(query, user2), {
|
147097
147271
|
query: "WarehouseItemModel.selectTransaction"
|
@@ -147108,7 +147282,7 @@ var item_default3 = itemRoutes2;
|
|
147108
147282
|
var productRoutes2 = new Elysia({
|
147109
147283
|
prefix: "/product",
|
147110
147284
|
tags: ["WarehouseProduct"]
|
147111
|
-
}).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("WarehouseProductModel",
|
147285
|
+
}).use(better_auth_default).guard({ auth: true }).model(prefix_model_default("WarehouseProductModel", model_default19)).get("/", async ({ query, user: user2 }) => {
|
147112
147286
|
return logic_default3.select(query, user2);
|
147113
147287
|
}, {
|
147114
147288
|
query: "WarehouseProductModel.select"
|
@@ -147161,7 +147335,7 @@ var WarehouseWarehouseLogic;
|
|
147161
147335
|
}).where(and(eq(warehouseWarehouseTable.id, id), eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, user2.branchId).if(user2.kind !== "COMPANY_ADMIN")));
|
147162
147336
|
};
|
147163
147337
|
})(WarehouseWarehouseLogic ||= {});
|
147164
|
-
var
|
147338
|
+
var logic_default19 = WarehouseWarehouseLogic;
|
147165
147339
|
|
147166
147340
|
// src/routes/warehouse/warehouse/model.ts
|
147167
147341
|
var WarehouseWarehouseModel;
|
@@ -147180,21 +147354,21 @@ var WarehouseWarehouseModel;
|
|
147180
147354
|
PaginationSchema
|
147181
147355
|
]);
|
147182
147356
|
})(WarehouseWarehouseModel ||= {});
|
147183
|
-
var
|
147357
|
+
var model_default21 = WarehouseWarehouseModel;
|
147184
147358
|
|
147185
147359
|
// src/routes/warehouse/warehouse/index.ts
|
147186
147360
|
var warehouseRoutes = new Elysia({
|
147187
147361
|
prefix: "/warehouse",
|
147188
147362
|
tags: ["Warehouse"]
|
147189
|
-
}).use(better_auth_default).guard({ userKind: "COMPANY_ADMIN" }).model(prefix_model_default("Warehouse",
|
147363
|
+
}).use(better_auth_default).guard({ userKind: "COMPANY_ADMIN" }).model(prefix_model_default("Warehouse", model_default21)).get("/", async ({ query, user: user2 }) => logic_default19.select(query, user2), {
|
147190
147364
|
query: "Warehouse.select"
|
147191
|
-
}).post("/", async ({ body, user: user2 }) =>
|
147365
|
+
}).post("/", async ({ body, user: user2 }) => logic_default19.create(body, user2), {
|
147192
147366
|
body: "Warehouse.create"
|
147193
147367
|
}).guard({
|
147194
147368
|
params: IdSchema
|
147195
|
-
}).put("/:id", async ({ params: { id }, body, user: user2 }) =>
|
147369
|
+
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default19.update(id, body, user2), {
|
147196
147370
|
body: "Warehouse.update"
|
147197
|
-
}).delete("/:id", async ({ params: { id }, user: user2 }) =>
|
147371
|
+
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default19.remove(id, user2));
|
147198
147372
|
var warehouse_default = warehouseRoutes;
|
147199
147373
|
|
147200
147374
|
// src/routes/warehouse/index.ts
|