autosync_backend2 1.1.65 → 1.1.67
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 +156 -20
- package/dist/index.js +228 -133
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -984,7 +984,6 @@ export declare const app: Elysia<"", {
|
|
984
984
|
type?: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор" | undefined;
|
985
985
|
id?: string | undefined;
|
986
986
|
search?: string | undefined;
|
987
|
-
branchId?: string | undefined;
|
988
987
|
supplierId?: string | undefined;
|
989
988
|
productId?: string | undefined;
|
990
989
|
priceSell?: number | undefined;
|
@@ -1028,7 +1027,7 @@ export declare const app: Elysia<"", {
|
|
1028
1027
|
createdAt: string;
|
1029
1028
|
updatedAt: string;
|
1030
1029
|
deletedAt: string | null;
|
1031
|
-
};
|
1030
|
+
} | null;
|
1032
1031
|
}[];
|
1033
1032
|
};
|
1034
1033
|
422: {
|
@@ -1142,7 +1141,6 @@ export declare const app: Elysia<"", {
|
|
1142
1141
|
type?: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор" | undefined;
|
1143
1142
|
id?: string | undefined;
|
1144
1143
|
search?: string | undefined;
|
1145
|
-
branchId?: string | undefined;
|
1146
1144
|
supplierId?: string | undefined;
|
1147
1145
|
productId?: string | undefined;
|
1148
1146
|
priceSell?: number | undefined;
|
@@ -1381,7 +1379,6 @@ export declare const app: Elysia<"", {
|
|
1381
1379
|
type?: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор" | undefined;
|
1382
1380
|
id?: string | undefined;
|
1383
1381
|
search?: string | undefined;
|
1384
|
-
branchId?: string | undefined;
|
1385
1382
|
supplierId?: string | undefined;
|
1386
1383
|
productId?: string | undefined;
|
1387
1384
|
priceSell?: number | undefined;
|
@@ -1392,6 +1389,7 @@ export declare const app: Elysia<"", {
|
|
1392
1389
|
page: number;
|
1393
1390
|
};
|
1394
1391
|
} | undefined;
|
1392
|
+
warehouseId?: string | undefined;
|
1395
1393
|
safetyStock?: number | undefined;
|
1396
1394
|
shelfNumber?: string | undefined;
|
1397
1395
|
pagination: {
|
@@ -1425,7 +1423,7 @@ export declare const app: Elysia<"", {
|
|
1425
1423
|
createdAt: string;
|
1426
1424
|
updatedAt: string;
|
1427
1425
|
deletedAt: string | null;
|
1428
|
-
};
|
1426
|
+
} | null;
|
1429
1427
|
product: {
|
1430
1428
|
supplierId: string;
|
1431
1429
|
productId: string | null;
|
@@ -1543,7 +1541,6 @@ export declare const app: Elysia<"", {
|
|
1543
1541
|
type?: "Сэлбэг" | "Тос" | "Дугуй" | "Будаг" | "Аккумлятор" | undefined;
|
1544
1542
|
id?: string | undefined;
|
1545
1543
|
search?: string | undefined;
|
1546
|
-
branchId?: string | undefined;
|
1547
1544
|
supplierId?: string | undefined;
|
1548
1545
|
productId?: string | undefined;
|
1549
1546
|
priceSell?: number | undefined;
|
@@ -3210,6 +3207,139 @@ export declare const app: Elysia<"", {
|
|
3210
3207
|
};
|
3211
3208
|
};
|
3212
3209
|
};
|
3210
|
+
} & {
|
3211
|
+
item: {
|
3212
|
+
employee: {};
|
3213
|
+
} & {
|
3214
|
+
employee: {
|
3215
|
+
get: {
|
3216
|
+
body: unknown;
|
3217
|
+
params: {};
|
3218
|
+
query: {
|
3219
|
+
cpOrderItemId: string;
|
3220
|
+
};
|
3221
|
+
headers: unknown;
|
3222
|
+
response: {
|
3223
|
+
200: {
|
3224
|
+
cpOrderItemId: string;
|
3225
|
+
employeeId: string;
|
3226
|
+
amount: number;
|
3227
|
+
id: string;
|
3228
|
+
createdAt: string;
|
3229
|
+
updatedAt: string;
|
3230
|
+
deletedAt: string | null;
|
3231
|
+
}[];
|
3232
|
+
422: {
|
3233
|
+
type: "validation";
|
3234
|
+
on: string;
|
3235
|
+
summary?: string;
|
3236
|
+
message?: string;
|
3237
|
+
found?: unknown;
|
3238
|
+
property?: string;
|
3239
|
+
expected?: string;
|
3240
|
+
};
|
3241
|
+
};
|
3242
|
+
};
|
3243
|
+
};
|
3244
|
+
} & {
|
3245
|
+
employee: {
|
3246
|
+
post: {
|
3247
|
+
body: {
|
3248
|
+
amount?: number | undefined;
|
3249
|
+
employeeId: string;
|
3250
|
+
cpOrderItemId: string;
|
3251
|
+
};
|
3252
|
+
params: {};
|
3253
|
+
query: unknown;
|
3254
|
+
headers: unknown;
|
3255
|
+
response: {
|
3256
|
+
200: {
|
3257
|
+
id: string;
|
3258
|
+
createdAt: string;
|
3259
|
+
updatedAt: string;
|
3260
|
+
employeeId: string;
|
3261
|
+
deletedAt: string | null;
|
3262
|
+
cpOrderItemId: string;
|
3263
|
+
amount: number;
|
3264
|
+
};
|
3265
|
+
400: "Энэ үйлчилгээнд ажилтан аль хэдийн хуваарилагдсан байна.";
|
3266
|
+
422: {
|
3267
|
+
type: "validation";
|
3268
|
+
on: string;
|
3269
|
+
summary?: string;
|
3270
|
+
message?: string;
|
3271
|
+
found?: unknown;
|
3272
|
+
property?: string;
|
3273
|
+
expected?: string;
|
3274
|
+
};
|
3275
|
+
};
|
3276
|
+
};
|
3277
|
+
};
|
3278
|
+
} & {
|
3279
|
+
employee: {
|
3280
|
+
":id": {
|
3281
|
+
put: {
|
3282
|
+
body: {
|
3283
|
+
amount?: number | undefined;
|
3284
|
+
};
|
3285
|
+
params: {
|
3286
|
+
id: string;
|
3287
|
+
};
|
3288
|
+
query: unknown;
|
3289
|
+
headers: unknown;
|
3290
|
+
response: {
|
3291
|
+
200: {
|
3292
|
+
cpOrderItemId: string;
|
3293
|
+
employeeId: string;
|
3294
|
+
amount: number;
|
3295
|
+
id: string;
|
3296
|
+
createdAt: string;
|
3297
|
+
updatedAt: string;
|
3298
|
+
deletedAt: string | null;
|
3299
|
+
};
|
3300
|
+
404: "Ажилтны мэдээлэл олдсонгүй.";
|
3301
|
+
422: {
|
3302
|
+
type: "validation";
|
3303
|
+
on: string;
|
3304
|
+
summary?: string;
|
3305
|
+
message?: string;
|
3306
|
+
found?: unknown;
|
3307
|
+
property?: string;
|
3308
|
+
expected?: string;
|
3309
|
+
};
|
3310
|
+
};
|
3311
|
+
};
|
3312
|
+
};
|
3313
|
+
};
|
3314
|
+
} & {
|
3315
|
+
employee: {
|
3316
|
+
":id": {
|
3317
|
+
delete: {
|
3318
|
+
body: unknown;
|
3319
|
+
params: {
|
3320
|
+
id: string;
|
3321
|
+
};
|
3322
|
+
query: unknown;
|
3323
|
+
headers: unknown;
|
3324
|
+
response: {
|
3325
|
+
200: {
|
3326
|
+
id: string;
|
3327
|
+
};
|
3328
|
+
404: "Ажилтны мэдээлэл олдсонгүй.";
|
3329
|
+
422: {
|
3330
|
+
type: "validation";
|
3331
|
+
on: string;
|
3332
|
+
summary?: string;
|
3333
|
+
message?: string;
|
3334
|
+
found?: unknown;
|
3335
|
+
property?: string;
|
3336
|
+
expected?: string;
|
3337
|
+
};
|
3338
|
+
};
|
3339
|
+
};
|
3340
|
+
};
|
3341
|
+
};
|
3342
|
+
};
|
3213
3343
|
};
|
3214
3344
|
} & {
|
3215
3345
|
"cp-order": {
|
@@ -3237,9 +3367,9 @@ export declare const app: Elysia<"", {
|
|
3237
3367
|
paymentPackageId?: string | null | undefined;
|
3238
3368
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3239
3369
|
cpOrderId: string;
|
3370
|
+
amount: number;
|
3240
3371
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3241
3372
|
paymentChannel: string;
|
3242
|
-
amount: number;
|
3243
3373
|
};
|
3244
3374
|
params: {};
|
3245
3375
|
query: unknown;
|
@@ -3252,10 +3382,10 @@ export declare const app: Elysia<"", {
|
|
3252
3382
|
deletedAt: string | null;
|
3253
3383
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3254
3384
|
cpOrderId: string;
|
3385
|
+
amount: number;
|
3255
3386
|
paymentPackageId: string | null;
|
3256
3387
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3257
3388
|
paymentChannel: string;
|
3258
|
-
amount: number;
|
3259
3389
|
invoiceNumber: string | null;
|
3260
3390
|
};
|
3261
3391
|
422: {
|
@@ -3316,10 +3446,10 @@ export declare const app: Elysia<"", {
|
|
3316
3446
|
deletedAt: string | null;
|
3317
3447
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3318
3448
|
cpOrderId: string;
|
3449
|
+
amount: number;
|
3319
3450
|
paymentPackageId: string | null;
|
3320
3451
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3321
3452
|
paymentChannel: string;
|
3322
|
-
amount: number;
|
3323
3453
|
invoiceNumber: string | null;
|
3324
3454
|
};
|
3325
3455
|
404: "Төлбөрийн тохиргоо олдсонгүй.";
|
@@ -3376,9 +3506,9 @@ export declare const app: Elysia<"", {
|
|
3376
3506
|
paymentPackageId?: string | null | undefined;
|
3377
3507
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3378
3508
|
cpOrderId: string;
|
3509
|
+
amount: number;
|
3379
3510
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3380
3511
|
paymentChannel: string;
|
3381
|
-
amount: number;
|
3382
3512
|
};
|
3383
3513
|
params: {};
|
3384
3514
|
query: unknown;
|
@@ -3392,10 +3522,10 @@ export declare const app: Elysia<"", {
|
|
3392
3522
|
deletedAt: string | null;
|
3393
3523
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3394
3524
|
cpOrderId: string;
|
3525
|
+
amount: number;
|
3395
3526
|
paymentPackageId: string | null;
|
3396
3527
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3397
3528
|
paymentChannel: string;
|
3398
|
-
amount: number;
|
3399
3529
|
invoiceNumber: string | null;
|
3400
3530
|
};
|
3401
3531
|
404: "Төлбөрийн тохиргоо олдсонгүй.";
|
@@ -3482,9 +3612,9 @@ export declare const app: Elysia<"", {
|
|
3482
3612
|
paymentPackageId?: string | null | undefined;
|
3483
3613
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3484
3614
|
cpOrderId: string;
|
3615
|
+
amount: number;
|
3485
3616
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3486
3617
|
paymentChannel: string;
|
3487
|
-
amount: number;
|
3488
3618
|
};
|
3489
3619
|
params: {};
|
3490
3620
|
query: unknown;
|
@@ -3498,10 +3628,10 @@ export declare const app: Elysia<"", {
|
|
3498
3628
|
deletedAt: string | null;
|
3499
3629
|
state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
|
3500
3630
|
cpOrderId: string;
|
3631
|
+
amount: number;
|
3501
3632
|
paymentPackageId: string | null;
|
3502
3633
|
paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE" | "CARD";
|
3503
3634
|
paymentChannel: string;
|
3504
|
-
amount: number;
|
3505
3635
|
invoiceNumber: string | null;
|
3506
3636
|
};
|
3507
3637
|
404: "Төлбөрийн тохиргоо олдсонгүй.";
|
@@ -3600,10 +3730,10 @@ export declare const app: Elysia<"", {
|
|
3600
3730
|
payment: {
|
3601
3731
|
info: {
|
3602
3732
|
post: {
|
3603
|
-
body: {
|
3733
|
+
body: ({
|
3604
3734
|
branchId?: string | undefined;
|
3605
3735
|
companyId: string;
|
3606
|
-
} &
|
3736
|
+
} & {
|
3607
3737
|
type: "StorePay";
|
3608
3738
|
sub: {
|
3609
3739
|
password: string;
|
@@ -3612,13 +3742,19 @@ export declare const app: Elysia<"", {
|
|
3612
3742
|
appPassword: string;
|
3613
3743
|
storeId: string;
|
3614
3744
|
};
|
3615
|
-
} | {
|
3745
|
+
}) | ({
|
3746
|
+
branchId?: string | undefined;
|
3747
|
+
companyId: string;
|
3748
|
+
} & {
|
3616
3749
|
type: "UbPay";
|
3617
3750
|
sub: {
|
3618
3751
|
clientId: string;
|
3619
3752
|
clientSecret: string;
|
3620
3753
|
};
|
3621
|
-
} | {
|
3754
|
+
}) | ({
|
3755
|
+
branchId?: string | undefined;
|
3756
|
+
companyId: string;
|
3757
|
+
} & {
|
3622
3758
|
type: "Qpay";
|
3623
3759
|
sub: {
|
3624
3760
|
password: string;
|
@@ -5554,8 +5690,8 @@ export declare const app: Elysia<"", {
|
|
5554
5690
|
apply: {
|
5555
5691
|
post: {
|
5556
5692
|
body: {
|
5557
|
-
discountId?: string | null | undefined;
|
5558
5693
|
cpOrderItemId?: string | null | undefined;
|
5694
|
+
discountId?: string | null | undefined;
|
5559
5695
|
note?: string | null | undefined;
|
5560
5696
|
cpOrderId: string;
|
5561
5697
|
valueApplied: number;
|
@@ -5573,8 +5709,8 @@ export declare const app: Elysia<"", {
|
|
5573
5709
|
employeeId: string;
|
5574
5710
|
deletedAt: string | null;
|
5575
5711
|
cpOrderId: string;
|
5576
|
-
discountId: string | null;
|
5577
5712
|
cpOrderItemId: string | null;
|
5713
|
+
discountId: string | null;
|
5578
5714
|
valueApplied: number;
|
5579
5715
|
priceBeforeDiscount: number;
|
5580
5716
|
priceAfterDiscount: number;
|
@@ -5603,8 +5739,8 @@ export declare const app: Elysia<"", {
|
|
5603
5739
|
body: {
|
5604
5740
|
employeeId?: string | undefined;
|
5605
5741
|
cpOrderId?: string | undefined;
|
5606
|
-
discountId?: string | null | undefined;
|
5607
5742
|
cpOrderItemId?: string | null | undefined;
|
5743
|
+
discountId?: string | null | undefined;
|
5608
5744
|
valueApplied?: number | undefined;
|
5609
5745
|
priceBeforeDiscount?: number | undefined;
|
5610
5746
|
priceAfterDiscount?: number | undefined;
|
package/dist/index.js
CHANGED
@@ -147074,6 +147074,7 @@ __export(exports_schema, {
|
|
147074
147074
|
crmCpOrderPaymentStateEnum: () => crmCpOrderPaymentStateEnum,
|
147075
147075
|
crmCpOrderPaymentMethodEnum: () => crmCpOrderPaymentMethodEnum,
|
147076
147076
|
crmCpOrderItemTable: () => crmCpOrderItemTable,
|
147077
|
+
crmCpOrderItemEmployeeTable: () => crmCpOrderItemEmployeeTable,
|
147077
147078
|
companyWorkScheduleTable: () => companyWorkScheduleTable,
|
147078
147079
|
companyServiceKindTable: () => companyServiceKindTable,
|
147079
147080
|
companyServiceBookingTable: () => companyServiceBookingTable,
|
@@ -147424,11 +147425,17 @@ var crmCpOrderItemTable = crmSchema.table("cp_order_item", {
|
|
147424
147425
|
companyProductId: uuid3(),
|
147425
147426
|
companyServiceKindId: uuid3(),
|
147426
147427
|
cpOrderSpPackageId: uuid3(),
|
147427
|
-
quantity:
|
147428
|
+
quantity: numeric({ mode: "number" }).notNull(),
|
147428
147429
|
priceUnit: numeric({ mode: "number" }).notNull(),
|
147429
147430
|
priceTotal: numeric({ mode: "number" }).notNull(),
|
147430
147431
|
name: varchar()
|
147431
147432
|
});
|
147433
|
+
var crmCpOrderItemEmployeeTable = crmSchema.table("cp_order_item_employee", {
|
147434
|
+
...base_schema_helper_default,
|
147435
|
+
cpOrderItemId: uuid3().notNull(),
|
147436
|
+
employeeId: uuid3().notNull(),
|
147437
|
+
amount: numeric({ mode: "number" }).notNull().default(0)
|
147438
|
+
});
|
147432
147439
|
var crmCpOrderPaymentMethodEnum = crmSchema.enum("payment_method", [
|
147433
147440
|
"CASH",
|
147434
147441
|
"BANK_TRANSFER",
|
@@ -151494,7 +151501,7 @@ var WarehouseProductLogic;
|
|
151494
151501
|
product: warehouseProductTable,
|
151495
151502
|
supplier: techdocSupplierTable,
|
151496
151503
|
totalCount: totalCountSql
|
151497
|
-
}).from(warehouseProductTable).
|
151504
|
+
}).from(warehouseProductTable).leftJoin(techdocSupplierTable, eq(techdocSupplierTable.id, warehouseProductTable.supplierId)).where(WarehouseProductLogic.getFilter(query, user2)).$dynamic();
|
151498
151505
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
151499
151506
|
const content = {
|
151500
151507
|
totalCount: result[0]?.totalCount ?? 0,
|
@@ -151614,13 +151621,13 @@ var logic_default3 = WarehouseProductLogic;
|
|
151614
151621
|
var WarehouseItemLogic;
|
151615
151622
|
((WarehouseItemLogic) => {
|
151616
151623
|
WarehouseItemLogic.select = async (query, user2) => {
|
151617
|
-
const filter = and(softDeletedFilter(warehouseItemTable), ...query.product ? [logic_default3.getFilter(query.product, user2)] : [], eq(warehouseItemTable.safetyStock, query.safetyStock ?? 0).if(query.safetyStock), ilike(warehouseItemTable.shelfNumber, `%${query.shelfNumber}%`).if(query.shelfNumber));
|
151624
|
+
const filter = and(softDeletedFilter(warehouseItemTable), ...query.product ? [logic_default3.getFilter(query.product, user2)] : [], eq(warehouseItemTable.safetyStock, query.safetyStock ?? 0).if(query.safetyStock), ilike(warehouseItemTable.shelfNumber, `%${query.shelfNumber}%`).if(query.shelfNumber), eq(warehouseItemTable.warehouseId, query.warehouseId).if(query.warehouseId));
|
151618
151625
|
const baseQuery = db_default.select({
|
151619
151626
|
item: warehouseItemTable,
|
151620
151627
|
supplier: techdocSupplierTable,
|
151621
151628
|
product: warehouseProductTable,
|
151622
151629
|
totalCount: totalCountSql
|
151623
|
-
}).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).
|
151630
|
+
}).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).$dynamic();
|
151624
151631
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
151625
151632
|
const content = {
|
151626
151633
|
totalCount: result[0]?.totalCount ?? 0,
|
@@ -154900,6 +154907,7 @@ var CrmCpOrderPaymentLogic;
|
|
154900
154907
|
});
|
154901
154908
|
return result;
|
154902
154909
|
} catch (err2) {
|
154910
|
+
console.error(JSON.stringify(err2));
|
154903
154911
|
if (err2 instanceof Error) {
|
154904
154912
|
return status("Bad Request", err2.message);
|
154905
154913
|
}
|
@@ -155494,6 +155502,86 @@ var DiscountLogic;
|
|
155494
155502
|
})(DiscountLogic ||= {});
|
155495
155503
|
var logic_default11 = DiscountLogic;
|
155496
155504
|
|
155505
|
+
// src/routes/crm/cpOrder/item/employee/logic.ts
|
155506
|
+
var CrmCpOrderItemEmployeeLogic;
|
155507
|
+
((CrmCpOrderItemEmployeeLogic) => {
|
155508
|
+
CrmCpOrderItemEmployeeLogic.select = async ({ cpOrderItemId }) => {
|
155509
|
+
const filter = and(eq(crmCpOrderItemEmployeeTable.cpOrderItemId, cpOrderItemId), softDeletedFilter(crmCpOrderItemEmployeeTable));
|
155510
|
+
const result = await db_default.select().from(crmCpOrderItemEmployeeTable).where(filter);
|
155511
|
+
return result;
|
155512
|
+
};
|
155513
|
+
CrmCpOrderItemEmployeeLogic.selectById = async (id) => {
|
155514
|
+
const [result] = await db_default.select().from(crmCpOrderItemEmployeeTable).where(and(eq(crmCpOrderItemEmployeeTable.id, id), softDeletedFilter(crmCpOrderItemEmployeeTable))).limit(1);
|
155515
|
+
if (!result) {
|
155516
|
+
return status("Not Found", "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
155517
|
+
}
|
155518
|
+
return result;
|
155519
|
+
};
|
155520
|
+
CrmCpOrderItemEmployeeLogic.create = async (body) => {
|
155521
|
+
const existing = await db_default.select().from(crmCpOrderItemEmployeeTable).where(and(eq(crmCpOrderItemEmployeeTable.cpOrderItemId, body.cpOrderItemId), eq(crmCpOrderItemEmployeeTable.employeeId, body.employeeId), softDeletedFilter(crmCpOrderItemEmployeeTable))).limit(1);
|
155522
|
+
if (existing.length > 0) {
|
155523
|
+
return status("Bad Request", "\u042D\u043D\u044D \u04AF\u0439\u043B\u0447\u0438\u043B\u0433\u044D\u044D\u043D\u0434 \u0430\u0436\u0438\u043B\u0442\u0430\u043D \u0430\u043B\u044C \u0445\u044D\u0434\u0438\u0439\u043D \u0445\u0443\u0432\u0430\u0430\u0440\u0438\u043B\u0430\u0433\u0434\u0441\u0430\u043D \u0431\u0430\u0439\u043D\u0430.");
|
155524
|
+
}
|
155525
|
+
const [result] = await db_default.insert(crmCpOrderItemEmployeeTable).values(body).returning();
|
155526
|
+
return result;
|
155527
|
+
};
|
155528
|
+
CrmCpOrderItemEmployeeLogic.update = async (id, body) => {
|
155529
|
+
const [result] = await db_default.update(crmCpOrderItemEmployeeTable).set(body).where(and(eq(crmCpOrderItemEmployeeTable.id, id), softDeletedFilter(crmCpOrderItemEmployeeTable))).returning();
|
155530
|
+
if (!result) {
|
155531
|
+
return status("Not Found", "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
155532
|
+
}
|
155533
|
+
return result;
|
155534
|
+
};
|
155535
|
+
CrmCpOrderItemEmployeeLogic.remove = async (id) => {
|
155536
|
+
const [result] = await db_default.update(crmCpOrderItemEmployeeTable).set({
|
155537
|
+
deletedAt: new Date().toISOString()
|
155538
|
+
}).where(and(eq(crmCpOrderItemEmployeeTable.id, id), softDeletedFilter(crmCpOrderItemEmployeeTable))).returning({
|
155539
|
+
id: crmCpOrderItemEmployeeTable.id
|
155540
|
+
});
|
155541
|
+
if (!result) {
|
155542
|
+
return status("Not Found", "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
155543
|
+
}
|
155544
|
+
return result;
|
155545
|
+
};
|
155546
|
+
})(CrmCpOrderItemEmployeeLogic ||= {});
|
155547
|
+
var logic_default13 = CrmCpOrderItemEmployeeLogic;
|
155548
|
+
|
155549
|
+
// src/routes/crm/cpOrder/item/employee/model.ts
|
155550
|
+
var CrmCpOrderItemEmployeeModel;
|
155551
|
+
((CrmCpOrderItemEmployeeModel) => {
|
155552
|
+
const createSchema = createInsertSchema(crmCpOrderItemEmployeeTable);
|
155553
|
+
const updateSchema = createUpdateSchema(crmCpOrderItemEmployeeTable);
|
155554
|
+
CrmCpOrderItemEmployeeModel.create = t.Pick(OmitBaseSchema(createSchema), [
|
155555
|
+
"cpOrderItemId",
|
155556
|
+
"employeeId",
|
155557
|
+
"amount"
|
155558
|
+
]);
|
155559
|
+
CrmCpOrderItemEmployeeModel.update = t.Pick(OmitBaseSchema(updateSchema), [
|
155560
|
+
"amount"
|
155561
|
+
]);
|
155562
|
+
CrmCpOrderItemEmployeeModel.select = t.Object({
|
155563
|
+
cpOrderItemId: t.String({ format: "uuid" })
|
155564
|
+
});
|
155565
|
+
})(CrmCpOrderItemEmployeeModel ||= {});
|
155566
|
+
var model_default6 = CrmCpOrderItemEmployeeModel;
|
155567
|
+
|
155568
|
+
// src/routes/crm/cpOrder/item/employee/index.ts
|
155569
|
+
var employeeRoutes = new Elysia({
|
155570
|
+
prefix: "/employee",
|
155571
|
+
tags: ["CrmCpOrderItemEmployee"]
|
155572
|
+
}).use(better_auth_default).guard({
|
155573
|
+
auth: true
|
155574
|
+
}).get("/", async ({ query }) => logic_default13.select(query), {
|
155575
|
+
query: model_default6.select
|
155576
|
+
}).post("/", async ({ body }) => logic_default13.create(body), {
|
155577
|
+
body: model_default6.create
|
155578
|
+
}).guard({
|
155579
|
+
params: IdSchema
|
155580
|
+
}).put("/:id", async ({ params, body }) => logic_default13.update(params.id, body), {
|
155581
|
+
body: model_default6.update
|
155582
|
+
}).delete("/:id", async ({ params }) => logic_default13.remove(params.id));
|
155583
|
+
var employee_default2 = employeeRoutes;
|
155584
|
+
|
155497
155585
|
// src/routes/crm/cpOrder/item/model.ts
|
155498
155586
|
var CrmCpOrderItemModel;
|
155499
155587
|
((CrmCpOrderItemModel) => {
|
@@ -155522,7 +155610,7 @@ var CrmCpOrderItemModel;
|
|
155522
155610
|
cpOrderId: t.String({ format: "uuid" })
|
155523
155611
|
});
|
155524
155612
|
})(CrmCpOrderItemModel ||= {});
|
155525
|
-
var
|
155613
|
+
var model_default7 = CrmCpOrderItemModel;
|
155526
155614
|
|
155527
155615
|
// src/routes/crm/cpOrder/item/index.ts
|
155528
155616
|
var itemRoutes = new Elysia({
|
@@ -155531,9 +155619,9 @@ var itemRoutes = new Elysia({
|
|
155531
155619
|
}).use(better_auth_default).guard({
|
155532
155620
|
auth: true
|
155533
155621
|
}).get("/", async ({ query }) => logic_default5.select(query), {
|
155534
|
-
query:
|
155622
|
+
query: model_default7.select
|
155535
155623
|
}).post("/", async ({ body, user: user2 }) => logic_default5.create(body, user2), {
|
155536
|
-
body:
|
155624
|
+
body: model_default7.create,
|
155537
155625
|
afterResponse: async ({ user: user2, response }) => {
|
155538
155626
|
const res = response;
|
155539
155627
|
if ("code" in res)
|
@@ -155543,7 +155631,7 @@ var itemRoutes = new Elysia({
|
|
155543
155631
|
}).guard({
|
155544
155632
|
params: IdSchema
|
155545
155633
|
}).put("/:id", async ({ params, body, user: user2 }) => logic_default5.update(params.id, body, user2), {
|
155546
|
-
body:
|
155634
|
+
body: model_default7.update,
|
155547
155635
|
afterResponse: async ({ user: user2, response }) => {
|
155548
155636
|
const res = response;
|
155549
155637
|
if ("code" in res)
|
@@ -155557,7 +155645,7 @@ var itemRoutes = new Elysia({
|
|
155557
155645
|
return res;
|
155558
155646
|
return await logic_default11.apply(res.cpOrderId, user2);
|
155559
155647
|
}
|
155560
|
-
});
|
155648
|
+
}).use(employee_default2);
|
155561
155649
|
var item_default = itemRoutes;
|
155562
155650
|
|
155563
155651
|
// src/routes/crm/cpOrder/model.ts
|
@@ -155601,7 +155689,7 @@ var CrmCpOrderModel;
|
|
155601
155689
|
km: t.Number({ default: 0 })
|
155602
155690
|
});
|
155603
155691
|
})(CrmCpOrderModel ||= {});
|
155604
|
-
var
|
155692
|
+
var model_default8 = CrmCpOrderModel;
|
155605
155693
|
|
155606
155694
|
// src/routes/crm/cpOrder/payment/model.ts
|
155607
155695
|
var CrmCpOrderPaymentModel;
|
@@ -155617,12 +155705,13 @@ var CrmCpOrderPaymentModel;
|
|
155617
155705
|
})
|
155618
155706
|
})
|
155619
155707
|
]);
|
155620
|
-
|
155621
|
-
t.
|
155622
|
-
|
155623
|
-
|
155624
|
-
|
155625
|
-
t.
|
155708
|
+
const createPaymentBase = t.Object({
|
155709
|
+
branchId: t.Optional(t.String({ format: "uuid" })),
|
155710
|
+
companyId: t.String({ format: "uuid" })
|
155711
|
+
});
|
155712
|
+
CrmCpOrderPaymentModel.createPaymentInfo = t.Union([
|
155713
|
+
t.Intersect([
|
155714
|
+
createPaymentBase,
|
155626
155715
|
t.Object({
|
155627
155716
|
type: t.Literal("StorePay"),
|
155628
155717
|
sub: t.Object({
|
@@ -155632,14 +155721,20 @@ var CrmCpOrderPaymentModel;
|
|
155632
155721
|
appPassword: t.String(),
|
155633
155722
|
storeId: t.String()
|
155634
155723
|
})
|
155635
|
-
})
|
155724
|
+
})
|
155725
|
+
]),
|
155726
|
+
t.Intersect([
|
155727
|
+
createPaymentBase,
|
155636
155728
|
t.Object({
|
155637
155729
|
type: t.Literal("UbPay"),
|
155638
155730
|
sub: t.Object({
|
155639
155731
|
clientId: t.String(),
|
155640
155732
|
clientSecret: t.String()
|
155641
155733
|
})
|
155642
|
-
})
|
155734
|
+
})
|
155735
|
+
]),
|
155736
|
+
t.Intersect([
|
155737
|
+
createPaymentBase,
|
155643
155738
|
t.Object({
|
155644
155739
|
type: t.Literal("Qpay"),
|
155645
155740
|
sub: t.Object({
|
@@ -155659,7 +155754,7 @@ var CrmCpOrderPaymentModel;
|
|
155659
155754
|
state: t.UnionEnum(["PENDING", "PAID", "CANCELED"])
|
155660
155755
|
});
|
155661
155756
|
})(CrmCpOrderPaymentModel ||= {});
|
155662
|
-
var
|
155757
|
+
var model_default9 = CrmCpOrderPaymentModel;
|
155663
155758
|
|
155664
155759
|
// src/routes/crm/cpOrder/payment/index.ts
|
155665
155760
|
var paymentRoutes = new Elysia({
|
@@ -155672,23 +155767,23 @@ var paymentRoutes = new Elysia({
|
|
155672
155767
|
close: (ws) => {
|
155673
155768
|
ws.unsubscribe(`cp_order_payment:${ws.data.query.paymentId}`);
|
155674
155769
|
},
|
155675
|
-
query:
|
155676
|
-
body:
|
155770
|
+
query: model_default9.wsQuery,
|
155771
|
+
body: model_default9.wsBody
|
155677
155772
|
}).post("/", async ({ body }) => logic_default10.create(body), {
|
155678
|
-
body:
|
155773
|
+
body: model_default9.create,
|
155679
155774
|
auth: true
|
155680
155775
|
}).delete("/:id", async ({ params: { id } }) => logic_default10.remove(id), {
|
155681
155776
|
auth: true
|
155682
|
-
}).post("/storepay", async ({ body, user: user2 }) => logic_default10.createStorepay(body, user2), { body:
|
155683
|
-
body:
|
155777
|
+
}).post("/storepay", async ({ body, user: user2 }) => logic_default10.createStorepay(body, user2), { body: model_default9.storepay, auth: true }).get("/storepay/:id", async ({ params: { id } }) => logic_default10.checkStorePay(id)).post("/ubpay", async ({ body, user: user2 }) => logic_default10.createUbPay(body, user2), {
|
155778
|
+
body: model_default9.create,
|
155684
155779
|
auth: true
|
155685
155780
|
}).post("/ubpay/:id", async ({ params: { id } }) => logic_default10.checkUbPay(id)).get("/qpay/:id", async ({ params: { id } }) => logic_default10.checkQpay(id)).post("/qpay", async ({ body, user: user2 }) => logic_default10.createQpay(body, user2), {
|
155686
|
-
body:
|
155781
|
+
body: model_default9.create,
|
155687
155782
|
auth: true
|
155688
155783
|
}).guard({
|
155689
155784
|
userKind: "ADMIN"
|
155690
155785
|
}).get("/info", async () => logic_default10.selectPaymentInfo()).post("/info", async ({ body }) => logic_default10.createPaymentInfo(body), {
|
155691
|
-
body:
|
155786
|
+
body: model_default9.createPaymentInfo
|
155692
155787
|
}).delete("/info/:id", async ({ params: { id } }) => logic_default10.removePaymentInfo(id), {
|
155693
155788
|
params: IdSchema
|
155694
155789
|
});
|
@@ -155699,7 +155794,7 @@ var cpOrderRoutes = new Elysia({
|
|
155699
155794
|
prefix: "/cp-order",
|
155700
155795
|
tags: ["CrmCpOrder"]
|
155701
155796
|
}).use(better_auth_default).use(item_default).use(payment_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default12.select(query, user2), {
|
155702
|
-
query:
|
155797
|
+
query: model_default8.select
|
155703
155798
|
}).post("/", async ({ body, user: user2 }) => {
|
155704
155799
|
const created = await logic_default12.create(body, user2);
|
155705
155800
|
if ("code" in created) {
|
@@ -155714,15 +155809,15 @@ var cpOrderRoutes = new Elysia({
|
|
155714
155809
|
}, user2);
|
155715
155810
|
return result;
|
155716
155811
|
}, {
|
155717
|
-
body:
|
155812
|
+
body: model_default8.create
|
155718
155813
|
}).post("/package", async ({ body, user: user2 }) => logic_default12.addPackage(body, user2), {
|
155719
|
-
body:
|
155814
|
+
body: model_default8.addPackage
|
155720
155815
|
}).post("/complete", async ({ user: user2, body }) => logic_default12.complete(body, user2), {
|
155721
|
-
body:
|
155816
|
+
body: model_default8.complete
|
155722
155817
|
}).guard({
|
155723
155818
|
params: IdSchema
|
155724
155819
|
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default12.update(id, body, user2), {
|
155725
|
-
body:
|
155820
|
+
body: model_default8.update
|
155726
155821
|
}).delete("/:id", async ({ user: user2, params: { id } }) => logic_default12.remove(id, user2)).get("/:id/payment", async ({ params: { id } }) => logic_default12.selectPayments(id), {
|
155727
155822
|
tags: ["CrmCpOrderPayment", "CrmCpOrder"]
|
155728
155823
|
});
|
@@ -155742,18 +155837,18 @@ var CrmCustomerModel;
|
|
155742
155837
|
PaginationSchema
|
155743
155838
|
]);
|
155744
155839
|
})(CrmCustomerModel ||= {});
|
155745
|
-
var
|
155840
|
+
var model_default10 = CrmCustomerModel;
|
155746
155841
|
|
155747
155842
|
// src/routes/crm/customer/index.ts
|
155748
155843
|
var customerRoutes = new Elysia({
|
155749
155844
|
prefix: "/customer",
|
155750
155845
|
tags: ["CrmCustomer"]
|
155751
155846
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default6.select(query, user2), {
|
155752
|
-
query:
|
155847
|
+
query: model_default10.select
|
155753
155848
|
}).post("/", async ({ body }) => logic_default6.create(body), {
|
155754
|
-
body:
|
155849
|
+
body: model_default10.create
|
155755
155850
|
}).put("/:id", async ({ body, params: { id } }) => logic_default6.update(id, body), {
|
155756
|
-
body:
|
155851
|
+
body: model_default10.update
|
155757
155852
|
});
|
155758
155853
|
var customer_default = customerRoutes;
|
155759
155854
|
|
@@ -155843,7 +155938,7 @@ var DiscountModel;
|
|
155843
155938
|
const updateApplySchema = createUpdateSchema(crmDiscountApplyTable);
|
155844
155939
|
DiscountModel.updateApply = OmitBaseSchema(updateApplySchema);
|
155845
155940
|
})(DiscountModel ||= {});
|
155846
|
-
var
|
155941
|
+
var model_default11 = DiscountModel;
|
155847
155942
|
|
155848
155943
|
// src/routes/crm/discount/index.ts
|
155849
155944
|
var discountRoutes = new Elysia({
|
@@ -155852,25 +155947,25 @@ var discountRoutes = new Elysia({
|
|
155852
155947
|
auth: true,
|
155853
155948
|
tags: ["Discount"]
|
155854
155949
|
}).get("/", async ({ query, user: user2 }) => logic_default11.select(query, user2), {
|
155855
|
-
query:
|
155950
|
+
query: model_default11.select
|
155856
155951
|
}).post("/", async ({ body, user: user2 }) => logic_default11.create(body, user2), {
|
155857
|
-
body:
|
155952
|
+
body: model_default11.create
|
155858
155953
|
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default11.update(id, body, user2), {
|
155859
|
-
body:
|
155954
|
+
body: model_default11.update,
|
155860
155955
|
params: IdSchema
|
155861
155956
|
}).delete("/:id", async ({ user: user2, params: { id } }) => logic_default11.remove(id, user2), {
|
155862
155957
|
params: IdSchema
|
155863
155958
|
}).post("/condition", async ({ body, user: user2 }) => logic_default11.createCondition(body, user2), {
|
155864
|
-
body:
|
155959
|
+
body: model_default11.createCondition
|
155865
155960
|
}).put("/condition/:id", async ({ body, user: user2, params: { id } }) => logic_default11.updateCondition(id, body, user2), {
|
155866
|
-
body:
|
155961
|
+
body: model_default11.updateCondition,
|
155867
155962
|
params: IdSchema
|
155868
155963
|
}).delete("/condition/:id", async ({ user: user2, params: { id } }) => logic_default11.removeCondition(id, user2), {
|
155869
155964
|
params: IdSchema
|
155870
155965
|
}).post("/apply", async ({ body, user: user2 }) => logic_default11.createApply(body, user2), {
|
155871
|
-
body:
|
155966
|
+
body: model_default11.createApply
|
155872
155967
|
}).put("/apply/:id", async ({ body, user: user2, params: { id } }) => logic_default11.updateApply(id, body, user2), {
|
155873
|
-
body:
|
155968
|
+
body: model_default11.updateApply,
|
155874
155969
|
params: IdSchema
|
155875
155970
|
}).delete("/apply/:id", async ({ params: { id } }) => logic_default11.removeApply(id), {
|
155876
155971
|
params: IdSchema
|
@@ -155995,7 +156090,7 @@ var CrmInspectionLogic;
|
|
155995
156090
|
return inspections;
|
155996
156091
|
};
|
155997
156092
|
})(CrmInspectionLogic ||= {});
|
155998
|
-
var
|
156093
|
+
var logic_default14 = CrmInspectionLogic;
|
155999
156094
|
|
156000
156095
|
// src/routes/crm/inspection/model.ts
|
156001
156096
|
var CrmInspectionModel;
|
@@ -156027,22 +156122,22 @@ var CrmInspectionModel;
|
|
156027
156122
|
licensePlate: t.String()
|
156028
156123
|
});
|
156029
156124
|
})(CrmInspectionModel ||= {});
|
156030
|
-
var
|
156125
|
+
var model_default12 = CrmInspectionModel;
|
156031
156126
|
|
156032
156127
|
// src/routes/crm/inspection/index.ts
|
156033
156128
|
var inspectionRoutes = new Elysia({
|
156034
156129
|
prefix: "/inspection",
|
156035
156130
|
tags: ["CrmInspection"]
|
156036
|
-
}).use(better_auth_default).get("/ubcab", async ({ query: { licensePlate } }) =>
|
156037
|
-
query:
|
156131
|
+
}).use(better_auth_default).get("/ubcab", async ({ query: { licensePlate } }) => logic_default14.selectUbCab(licensePlate), {
|
156132
|
+
query: model_default12.selectUbCab,
|
156038
156133
|
auth: false
|
156039
|
-
}).guard({ auth: true }).get("/", async ({ query, user: user2 }) =>
|
156040
|
-
query:
|
156041
|
-
}).post("/", async ({ body, user: user2 }) =>
|
156042
|
-
body:
|
156134
|
+
}).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default14.select(query, user2), {
|
156135
|
+
query: model_default12.select
|
156136
|
+
}).post("/", async ({ body, user: user2 }) => logic_default14.create(body, user2), {
|
156137
|
+
body: model_default12.create
|
156043
156138
|
}).guard({
|
156044
156139
|
params: IdSchema
|
156045
|
-
}).get("/:id", async ({ params: { id }, user: user2 }) =>
|
156140
|
+
}).get("/:id", async ({ params: { id }, user: user2 }) => logic_default14.getById(id, user2)).post("/:id", async ({ params: { id }, user: user2 }) => logic_default14.approve(id, user2)).put("/:id", async ({ params: { id }, user: user2 }) => logic_default14.cancel(id, user2)).post("/:id/service-order", async ({ params: { id }, user: user2 }) => logic_default14.createCpOrder(id, user2));
|
156046
156141
|
var inspection_default = inspectionRoutes;
|
156047
156142
|
|
156048
156143
|
// src/routes/crm/spPackage/model.ts
|
@@ -156058,7 +156153,7 @@ var CrmSpPackageModel;
|
|
156058
156153
|
t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId"]))
|
156059
156154
|
]);
|
156060
156155
|
})(CrmSpPackageModel ||= {});
|
156061
|
-
var
|
156156
|
+
var model_default13 = CrmSpPackageModel;
|
156062
156157
|
|
156063
156158
|
// src/routes/crm/spPackage/product/logic.ts
|
156064
156159
|
var CrmSpPackageProductLogic;
|
@@ -156104,7 +156199,7 @@ var CrmSpPackageProductLogic;
|
|
156104
156199
|
}).where(eq(crmSpPackageProductTable.id, id));
|
156105
156200
|
};
|
156106
156201
|
})(CrmSpPackageProductLogic ||= {});
|
156107
|
-
var
|
156202
|
+
var logic_default15 = CrmSpPackageProductLogic;
|
156108
156203
|
|
156109
156204
|
// src/routes/crm/spPackage/product/model.ts
|
156110
156205
|
var CrmSpPackageProductModel;
|
@@ -156116,7 +156211,7 @@ var CrmSpPackageProductModel;
|
|
156116
156211
|
CrmSpPackageProductModel.update = OmitBaseSchema(updateSchema);
|
156117
156212
|
CrmSpPackageProductModel.select = t.Pick(selectSchema, ["spPackageId"]);
|
156118
156213
|
})(CrmSpPackageProductModel ||= {});
|
156119
|
-
var
|
156214
|
+
var model_default14 = CrmSpPackageProductModel;
|
156120
156215
|
|
156121
156216
|
// src/routes/crm/spPackage/product/index.ts
|
156122
156217
|
var productRoutes = new Elysia({
|
@@ -156124,17 +156219,17 @@ var productRoutes = new Elysia({
|
|
156124
156219
|
tags: ["CrmSpPackageProduct"]
|
156125
156220
|
}).use(better_auth_default).guard({
|
156126
156221
|
auth: true
|
156127
|
-
}).get("/", async ({ query }) =>
|
156128
|
-
query:
|
156129
|
-
}).post("/", async ({ body }) =>
|
156130
|
-
body:
|
156131
|
-
}).post("/many", async ({ body }) =>
|
156132
|
-
body: t.Array(
|
156222
|
+
}).get("/", async ({ query }) => logic_default15.select(query), {
|
156223
|
+
query: model_default14.select
|
156224
|
+
}).post("/", async ({ body }) => logic_default15.create(body), {
|
156225
|
+
body: model_default14.create
|
156226
|
+
}).post("/many", async ({ body }) => logic_default15.createMany(body), {
|
156227
|
+
body: t.Array(model_default14.create)
|
156133
156228
|
}).guard({
|
156134
156229
|
params: IdSchema
|
156135
|
-
}).put("/:id", async ({ params, body }) =>
|
156136
|
-
body:
|
156137
|
-
}).delete("/:id", async ({ params }) =>
|
156230
|
+
}).put("/:id", async ({ params, body }) => logic_default15.update(params.id, body), {
|
156231
|
+
body: model_default14.update
|
156232
|
+
}).delete("/:id", async ({ params }) => logic_default15.remove(params.id));
|
156138
156233
|
var product_default = productRoutes;
|
156139
156234
|
|
156140
156235
|
// src/routes/crm/spPackage/service/logic.ts
|
@@ -156177,7 +156272,7 @@ var CrmSpPackageServiceLogic;
|
|
156177
156272
|
}).where(eq(crmSpPackageServiceTable.id, id));
|
156178
156273
|
};
|
156179
156274
|
})(CrmSpPackageServiceLogic ||= {});
|
156180
|
-
var
|
156275
|
+
var logic_default16 = CrmSpPackageServiceLogic;
|
156181
156276
|
|
156182
156277
|
// src/routes/crm/spPackage/service/model.ts
|
156183
156278
|
var CrmSpPackageServiceModel;
|
@@ -156189,7 +156284,7 @@ var CrmSpPackageServiceModel;
|
|
156189
156284
|
CrmSpPackageServiceModel.update = OmitBaseSchema(updateSchema);
|
156190
156285
|
CrmSpPackageServiceModel.select = t.Pick(selectSchema, ["spPackageId"]);
|
156191
156286
|
})(CrmSpPackageServiceModel ||= {});
|
156192
|
-
var
|
156287
|
+
var model_default15 = CrmSpPackageServiceModel;
|
156193
156288
|
|
156194
156289
|
// src/routes/crm/spPackage/service/index.ts
|
156195
156290
|
var serviceRoutes = new Elysia({
|
@@ -156197,17 +156292,17 @@ var serviceRoutes = new Elysia({
|
|
156197
156292
|
tags: ["CrmSpPackageService"]
|
156198
156293
|
}).use(better_auth_default).guard({
|
156199
156294
|
auth: true
|
156200
|
-
}).get("/", async ({ query }) =>
|
156201
|
-
query:
|
156202
|
-
}).post("/", async ({ body }) =>
|
156203
|
-
body:
|
156204
|
-
}).post("/many", async ({ body }) =>
|
156205
|
-
body: t.Array(
|
156295
|
+
}).get("/", async ({ query }) => logic_default16.select(query), {
|
156296
|
+
query: model_default15.select
|
156297
|
+
}).post("/", async ({ body }) => logic_default16.create(body), {
|
156298
|
+
body: model_default15.create
|
156299
|
+
}).post("/many", async ({ body }) => logic_default16.createMany(body), {
|
156300
|
+
body: t.Array(model_default15.create)
|
156206
156301
|
}).guard({
|
156207
156302
|
params: IdSchema
|
156208
|
-
}).put("/:id", async ({ params, body }) =>
|
156209
|
-
body:
|
156210
|
-
}).delete("/:id", async ({ params }) =>
|
156303
|
+
}).put("/:id", async ({ params, body }) => logic_default16.update(params.id, body), {
|
156304
|
+
body: model_default15.update
|
156305
|
+
}).delete("/:id", async ({ params }) => logic_default16.remove(params.id));
|
156211
156306
|
var service_default = serviceRoutes;
|
156212
156307
|
|
156213
156308
|
// src/routes/crm/spPackage/index.ts
|
@@ -156217,12 +156312,12 @@ var spPackageRoutes = new Elysia({
|
|
156217
156312
|
}).use(better_auth_default).use(service_default).use(product_default).guard({
|
156218
156313
|
auth: true
|
156219
156314
|
}).get("/", async ({ query, user: user2 }) => logic_default7.select(query, user2), {
|
156220
|
-
query:
|
156315
|
+
query: model_default13.select
|
156221
156316
|
}).post("/", async ({ body, user: user2 }) => logic_default7.create(body, user2), {
|
156222
|
-
body:
|
156317
|
+
body: model_default13.create
|
156223
156318
|
}).guard({
|
156224
156319
|
params: IdSchema
|
156225
|
-
}).put("/:id", async ({ body, user: user2, params }) => logic_default7.update(params.id, body, user2), { body:
|
156320
|
+
}).put("/:id", async ({ body, user: user2, params }) => logic_default7.update(params.id, body, user2), { body: model_default13.update }).delete("/:id", async ({ user: user2, params: { id } }) => logic_default7.remove(id, user2));
|
156226
156321
|
var spPackage_default = spPackageRoutes;
|
156227
156322
|
|
156228
156323
|
// src/routes/crm/vehicle/model.ts
|
@@ -156245,7 +156340,7 @@ var CrmVehicleModel;
|
|
156245
156340
|
}))
|
156246
156341
|
]);
|
156247
156342
|
})(CrmVehicleModel ||= {});
|
156248
|
-
var
|
156343
|
+
var model_default16 = CrmVehicleModel;
|
156249
156344
|
|
156250
156345
|
// src/routes/crm/vehicle/index.ts
|
156251
156346
|
var vehicleRoutes = new Elysia({
|
@@ -156258,13 +156353,13 @@ var vehicleRoutes = new Elysia({
|
|
156258
156353
|
auth: true,
|
156259
156354
|
tags: ["Vehicle"]
|
156260
156355
|
}).get("/", async ({ query, user: user2 }) => logic_default9.select(query, user2), {
|
156261
|
-
query:
|
156356
|
+
query: model_default16.select
|
156262
156357
|
}).post("/", async ({ body, user: user2 }) => logic_default9.create(body, user2), {
|
156263
|
-
body:
|
156358
|
+
body: model_default16.create
|
156264
156359
|
}).guard({
|
156265
156360
|
params: IdSchema
|
156266
156361
|
}).get("/:id", async ({ params, user: user2 }) => logic_default9.selectById(params.id, user2)).put("/:id", async ({ params, body, user: user2 }) => logic_default9.update(params.id, body, user2), {
|
156267
|
-
body:
|
156362
|
+
body: model_default16.update
|
156268
156363
|
}).delete("/:id", async ({ params, user: user2 }) => logic_default9.remove(params.id, user2)));
|
156269
156364
|
var vehicle_default = vehicleRoutes;
|
156270
156365
|
|
@@ -156540,7 +156635,7 @@ var PermissionLogic;
|
|
156540
156635
|
return permissions;
|
156541
156636
|
};
|
156542
156637
|
})(PermissionLogic ||= {});
|
156543
|
-
var
|
156638
|
+
var logic_default17 = PermissionLogic;
|
156544
156639
|
|
156545
156640
|
// src/routes/permission/model.ts
|
156546
156641
|
var PermissionModel;
|
@@ -156555,7 +156650,7 @@ var PermissionModel;
|
|
156555
156650
|
permissions: t.Array(t.String())
|
156556
156651
|
});
|
156557
156652
|
})(PermissionModel ||= {});
|
156558
|
-
var
|
156653
|
+
var model_default17 = PermissionModel;
|
156559
156654
|
|
156560
156655
|
// src/routes/permission/index.ts
|
156561
156656
|
var groupService = new CrudHelper(permissionGroupTable, "\u042D\u0440\u0445\u0438\u0439\u043D \u0431\u0430\u0433\u0446 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
@@ -156571,8 +156666,8 @@ var permissionRoutes = new Elysia({
|
|
156571
156666
|
return permissionList;
|
156572
156667
|
}, {
|
156573
156668
|
permission: "PERMISSION_ADD"
|
156574
|
-
}).post("/", ({ body }) =>
|
156575
|
-
body:
|
156669
|
+
}).post("/", ({ body }) => logic_default17.addPermission(body), {
|
156670
|
+
body: model_default17.addPermission,
|
156576
156671
|
permission: "PERMISSION_ADD",
|
156577
156672
|
beforeHandle({ status: status2, body, permissions, publicPermissions }) {
|
156578
156673
|
if (!permissions.includes("BACK_OFFICE_ADMIN") && body.permissions.some((bp) => !publicPermissions.map((pp) => pp.code).includes(bp))) {
|
@@ -156581,14 +156676,14 @@ var permissionRoutes = new Elysia({
|
|
156581
156676
|
}
|
156582
156677
|
}).group("/group", (app2) => app2.guard({
|
156583
156678
|
permission: "PERMISSION_GROUP_ALL"
|
156584
|
-
}).get("/", async ({ query }) => await
|
156585
|
-
query:
|
156679
|
+
}).get("/", async ({ query }) => await logic_default17.selectGroups(query), {
|
156680
|
+
query: model_default17.select
|
156586
156681
|
}).post("/", async ({ body }) => await groupService.create(body), {
|
156587
|
-
body:
|
156682
|
+
body: model_default17.create
|
156588
156683
|
}).guard({
|
156589
156684
|
params: IdSchema
|
156590
156685
|
}).put("/:id", async ({ body, params: { id } }) => groupService.update(id, body), {
|
156591
|
-
body:
|
156686
|
+
body: model_default17.update
|
156592
156687
|
}).delete("/:id", async ({ params: { id } }) => groupService.delete(id)));
|
156593
156688
|
var permission_default2 = permissionRoutes;
|
156594
156689
|
|
@@ -156636,7 +156731,7 @@ var TechdocSupplierLogic;
|
|
156636
156731
|
}).where(eq(techdocSupplierTable.id, id));
|
156637
156732
|
};
|
156638
156733
|
})(TechdocSupplierLogic ||= {});
|
156639
|
-
var
|
156734
|
+
var logic_default18 = TechdocSupplierLogic;
|
156640
156735
|
|
156641
156736
|
// src/routes/techdoc/supplier/model.ts
|
156642
156737
|
var TechdocSupplierModel;
|
@@ -156654,24 +156749,24 @@ var TechdocSupplierModel;
|
|
156654
156749
|
const updateSchema = createUpdateSchema(techdocSupplierTable);
|
156655
156750
|
TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
|
156656
156751
|
})(TechdocSupplierModel ||= {});
|
156657
|
-
var
|
156752
|
+
var model_default18 = TechdocSupplierModel;
|
156658
156753
|
|
156659
156754
|
// src/routes/techdoc/supplier/index.ts
|
156660
156755
|
var supplierRoutes = new Elysia({
|
156661
156756
|
prefix: "/supplier",
|
156662
156757
|
tags: ["TechdocSupplier"]
|
156663
|
-
}).use(better_auth_default).get("/", async ({ query, user: user2 }) =>
|
156664
|
-
query:
|
156758
|
+
}).use(better_auth_default).get("/", async ({ query, user: user2 }) => logic_default18.select(query, user2), {
|
156759
|
+
query: model_default18.select,
|
156665
156760
|
auth: true
|
156666
156761
|
}).guard({
|
156667
156762
|
userKind: "ADMIN"
|
156668
|
-
}).post("/", async ({ body }) =>
|
156669
|
-
body:
|
156763
|
+
}).post("/", async ({ body }) => logic_default18.create(body), {
|
156764
|
+
body: model_default18.create
|
156670
156765
|
}).guard({
|
156671
156766
|
params: IdSchema
|
156672
|
-
}).put("/:id", ({ body, params: { id } }) =>
|
156673
|
-
body:
|
156674
|
-
}).delete("/:id", ({ params: { id } }) =>
|
156767
|
+
}).put("/:id", ({ body, params: { id } }) => logic_default18.update(id, body), {
|
156768
|
+
body: model_default18.update
|
156769
|
+
}).delete("/:id", ({ params: { id } }) => logic_default18.remove(id));
|
156675
156770
|
var supplier_default = supplierRoutes;
|
156676
156771
|
|
156677
156772
|
// src/routes/techdoc/vehicleKind/model.ts
|
@@ -156685,7 +156780,7 @@ var TechdocVehicleKindModel;
|
|
156685
156780
|
const updateSchema = createUpdateSchema(techdocVehicleKindTable);
|
156686
156781
|
TechdocVehicleKindModel.update = OmitBaseSchema(updateSchema);
|
156687
156782
|
})(TechdocVehicleKindModel ||= {});
|
156688
|
-
var
|
156783
|
+
var model_default19 = TechdocVehicleKindModel;
|
156689
156784
|
|
156690
156785
|
// src/routes/techdoc/vehicleKind/index.ts
|
156691
156786
|
var vehicleKindRoutes = new Elysia({
|
@@ -156694,9 +156789,9 @@ var vehicleKindRoutes = new Elysia({
|
|
156694
156789
|
}).use(better_auth_default).guard({
|
156695
156790
|
auth: true
|
156696
156791
|
}).get("/", async ({ query }) => logic_default8.select(query), {
|
156697
|
-
query:
|
156792
|
+
query: model_default19.select
|
156698
156793
|
}).put("/:id", async ({ body, params: { id } }) => logic_default8.update(id, body), {
|
156699
|
-
body:
|
156794
|
+
body: model_default19.update,
|
156700
156795
|
params: IdSchema,
|
156701
156796
|
userKind: "ADMIN"
|
156702
156797
|
});
|
@@ -156826,7 +156921,7 @@ var UserLogic;
|
|
156826
156921
|
totalCount: totalCountSql
|
156827
156922
|
}).from(user).where(filter).$dynamic();
|
156828
156923
|
const users = await pagination_helper_default(baseQuery, query.pagination);
|
156829
|
-
const userPermissions2 = await
|
156924
|
+
const userPermissions2 = await logic_default17.selectByUserId(users.map((u) => u.id));
|
156830
156925
|
const content = {
|
156831
156926
|
totalCount: users[0]?.totalCount ?? 0,
|
156832
156927
|
totalPage: users.length === 0 ? 0 : Math.ceil(users[0].totalCount / query.pagination.size)
|
@@ -156892,7 +156987,7 @@ var UserLogic;
|
|
156892
156987
|
});
|
156893
156988
|
};
|
156894
156989
|
})(UserLogic ||= {});
|
156895
|
-
var
|
156990
|
+
var logic_default19 = UserLogic;
|
156896
156991
|
|
156897
156992
|
// src/routes/user/schema.ts
|
156898
156993
|
var select = createSelectSchema(user);
|
@@ -156925,7 +157020,7 @@ var userRoutes = new Elysia({
|
|
156925
157020
|
}).use(better_auth_default).guard({
|
156926
157021
|
auth: true,
|
156927
157022
|
tags: ["User"]
|
156928
|
-
}).get("/", async ({ query, user: user2 }) =>
|
157023
|
+
}).get("/", async ({ query, user: user2 }) => logic_default19.select(query, user2), {
|
156929
157024
|
query: selectUserSchema,
|
156930
157025
|
userKind: "COMPANY_ADMIN"
|
156931
157026
|
}).get("/me", async ({ user: user2 }) => {
|
@@ -156937,10 +157032,10 @@ var userRoutes = new Elysia({
|
|
156937
157032
|
...user2,
|
156938
157033
|
company: company2.result[0]
|
156939
157034
|
};
|
156940
|
-
}).post("/", async ({ body, user: user2 }) =>
|
157035
|
+
}).post("/", async ({ body, user: user2 }) => logic_default19.registerUser(body, user2), {
|
156941
157036
|
body: createUserSchema,
|
156942
157037
|
userKind: "COMPANY_ADMIN"
|
156943
|
-
}).put("/:id", async ({ body, user: user2, params: { id } }) =>
|
157038
|
+
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default19.update(id, body, user2), {
|
156944
157039
|
body: updateUserSchema,
|
156945
157040
|
userKind: "COMPANY_ADMIN"
|
156946
157041
|
});
|
@@ -156959,7 +157054,6 @@ var WarehouseProductModel;
|
|
156959
157054
|
search: t.String(),
|
156960
157055
|
priceSell: t.Number(),
|
156961
157056
|
alias: t.String(),
|
156962
|
-
branchId: t.String({ format: "uuid" }),
|
156963
157057
|
productId: t.String({ format: "uuid" }),
|
156964
157058
|
id: t.String({ format: "uuid" }),
|
156965
157059
|
ids: t.Array(t.String({ format: "uuid" })),
|
@@ -156970,7 +157064,7 @@ var WarehouseProductModel;
|
|
156970
157064
|
PaginationSchema
|
156971
157065
|
]);
|
156972
157066
|
})(WarehouseProductModel ||= {});
|
156973
|
-
var
|
157067
|
+
var model_default20 = WarehouseProductModel;
|
156974
157068
|
|
156975
157069
|
// src/routes/warehouse/item/model.ts
|
156976
157070
|
var WarehouseItemModel;
|
@@ -156985,9 +157079,10 @@ var WarehouseItemModel;
|
|
156985
157079
|
WarehouseItemModel.select = t.Composite([
|
156986
157080
|
PaginationSchema,
|
156987
157081
|
t.Partial(t.Object({
|
156988
|
-
product:
|
157082
|
+
product: model_default20.select,
|
156989
157083
|
shelfNumber: t.String(),
|
156990
|
-
safetyStock: t.Number()
|
157084
|
+
safetyStock: t.Number(),
|
157085
|
+
warehouseId: t.String({ format: "uuid" })
|
156991
157086
|
}))
|
156992
157087
|
]);
|
156993
157088
|
WarehouseItemModel.selectTransaction = t.Composite([
|
@@ -157002,7 +157097,7 @@ var WarehouseItemModel;
|
|
157002
157097
|
transferId: t.String({ format: "uuid", default: undefined })
|
157003
157098
|
})),
|
157004
157099
|
t.Partial(t.Object({
|
157005
|
-
product: t.Omit(
|
157100
|
+
product: t.Omit(model_default20.select, ["pagination"]),
|
157006
157101
|
itemId: t.String({ format: "uuid", default: undefined }),
|
157007
157102
|
dateFrom: t.String({ format: "date-time", default: undefined }),
|
157008
157103
|
dateTo: t.String({ format: "date-time", default: undefined }),
|
@@ -157026,7 +157121,7 @@ var WarehouseItemModel;
|
|
157026
157121
|
transactionDetails
|
157027
157122
|
});
|
157028
157123
|
})(WarehouseItemModel ||= {});
|
157029
|
-
var
|
157124
|
+
var model_default21 = WarehouseItemModel;
|
157030
157125
|
|
157031
157126
|
// src/routes/warehouse/item/index.ts
|
157032
157127
|
var itemRoutes2 = new Elysia({
|
@@ -157035,19 +157130,19 @@ var itemRoutes2 = new Elysia({
|
|
157035
157130
|
}).use(better_auth_default).guard({
|
157036
157131
|
userKind: "CUSTOMER"
|
157037
157132
|
}).get("/", async ({ query, user: user2 }) => logic_default4.select(query, user2), {
|
157038
|
-
query:
|
157133
|
+
query: model_default21.select
|
157039
157134
|
}).post("/", async ({ body }) => logic_default4.create(body), {
|
157040
|
-
body:
|
157135
|
+
body: model_default21.create
|
157041
157136
|
}).post("/many", async ({ body, user: user2 }) => logic_default4.createMany(body, user2), {
|
157042
|
-
body:
|
157137
|
+
body: model_default21.createMany
|
157043
157138
|
}).get("/transaction", async ({ query, user: user2 }) => logic_default4.selectTransaction(query, user2), {
|
157044
|
-
query:
|
157139
|
+
query: model_default21.selectTransaction
|
157045
157140
|
}).post("/change-quantity", async ({ body, user: user2 }) => logic_default4.changeQuantity(body, user2), {
|
157046
|
-
body:
|
157141
|
+
body: model_default21.changeQuantity
|
157047
157142
|
}).guard({
|
157048
157143
|
params: IdSchema
|
157049
157144
|
}).put("/:id", async ({ body, params: { id } }) => logic_default4.update(id, body), {
|
157050
|
-
body:
|
157145
|
+
body: model_default21.update
|
157051
157146
|
});
|
157052
157147
|
var item_default3 = itemRoutes2;
|
157053
157148
|
|
@@ -157058,14 +157153,14 @@ var productRoutes3 = new Elysia({
|
|
157058
157153
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => {
|
157059
157154
|
return logic_default3.select(query, user2);
|
157060
157155
|
}, {
|
157061
|
-
query:
|
157156
|
+
query: model_default20.select
|
157062
157157
|
}).post("/", async ({ body, user: user2 }) => logic_default3.create(body, user2), {
|
157063
|
-
body:
|
157158
|
+
body: model_default20.create
|
157064
157159
|
}).post("/many", async ({ body, user: user2 }) => logic_default3.createMany(body, user2), {
|
157065
|
-
body: t.Array(
|
157066
|
-
}).post("/download", async ({ query, user: user2 }) => logic_default3.downloadExcel(query, user2), { query:
|
157160
|
+
body: t.Array(model_default20.create)
|
157161
|
+
}).post("/download", async ({ query, user: user2 }) => logic_default3.downloadExcel(query, user2), { query: model_default20.select }).guard({
|
157067
157162
|
params: IdSchema
|
157068
|
-
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default3.update(id, body, user2), { body:
|
157163
|
+
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default3.update(id, body, user2), { body: model_default20.update });
|
157069
157164
|
var product_default3 = productRoutes3;
|
157070
157165
|
|
157071
157166
|
// src/routes/warehouse/warehouse/logic.ts
|
@@ -157108,7 +157203,7 @@ var WarehouseWarehouseLogic;
|
|
157108
157203
|
}).where(and(eq(warehouseWarehouseTable.id, id), eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, user2.branchId).if(user2.kind !== "COMPANY_ADMIN")));
|
157109
157204
|
};
|
157110
157205
|
})(WarehouseWarehouseLogic ||= {});
|
157111
|
-
var
|
157206
|
+
var logic_default20 = WarehouseWarehouseLogic;
|
157112
157207
|
|
157113
157208
|
// src/routes/warehouse/warehouse/model.ts
|
157114
157209
|
var WarehouseWarehouseModel;
|
@@ -157127,21 +157222,21 @@ var WarehouseWarehouseModel;
|
|
157127
157222
|
PaginationSchema
|
157128
157223
|
]);
|
157129
157224
|
})(WarehouseWarehouseModel ||= {});
|
157130
|
-
var
|
157225
|
+
var model_default22 = WarehouseWarehouseModel;
|
157131
157226
|
|
157132
157227
|
// src/routes/warehouse/warehouse/index.ts
|
157133
157228
|
var warehouseRoutes = new Elysia({
|
157134
157229
|
prefix: "/warehouse",
|
157135
157230
|
tags: ["Warehouse"]
|
157136
|
-
}).use(better_auth_default).guard({ userKind: "COMPANY_ADMIN" }).get("/", async ({ query, user: user2 }) =>
|
157137
|
-
query:
|
157138
|
-
}).post("/", async ({ body, user: user2 }) =>
|
157139
|
-
body:
|
157231
|
+
}).use(better_auth_default).guard({ userKind: "COMPANY_ADMIN" }).get("/", async ({ query, user: user2 }) => logic_default20.select(query, user2), {
|
157232
|
+
query: model_default22.select
|
157233
|
+
}).post("/", async ({ body, user: user2 }) => logic_default20.create(body, user2), {
|
157234
|
+
body: model_default22.create
|
157140
157235
|
}).guard({
|
157141
157236
|
params: IdSchema
|
157142
|
-
}).put("/:id", async ({ params: { id }, body, user: user2 }) =>
|
157143
|
-
body:
|
157144
|
-
}).delete("/:id", async ({ params: { id }, user: user2 }) =>
|
157237
|
+
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default20.update(id, body, user2), {
|
157238
|
+
body: model_default22.update
|
157239
|
+
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default20.remove(id, user2));
|
157145
157240
|
var warehouse_default = warehouseRoutes;
|
157146
157241
|
|
157147
157242
|
// src/routes/warehouse/index.ts
|