autosync_backend2 1.2.8 → 1.2.10
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 +70 -19
- package/dist/index.js +38 -31
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -784,10 +784,6 @@ export declare const app: Elysia<"", {
|
|
784
784
|
productId?: string | undefined;
|
785
785
|
priceSell?: number | undefined;
|
786
786
|
ids?: string[] | undefined;
|
787
|
-
pagination: {
|
788
|
-
size: number;
|
789
|
-
page: number;
|
790
|
-
};
|
791
787
|
};
|
792
788
|
headers: unknown;
|
793
789
|
response: {
|
@@ -2195,6 +2191,7 @@ export declare const app: Elysia<"", {
|
|
2195
2191
|
query: {
|
2196
2192
|
search?: string | undefined;
|
2197
2193
|
companyId?: string | undefined;
|
2194
|
+
branchId?: string | null | undefined;
|
2198
2195
|
pagination: {
|
2199
2196
|
size: number;
|
2200
2197
|
page: number;
|
@@ -3059,18 +3056,6 @@ export declare const app: Elysia<"", {
|
|
3059
3056
|
headers: unknown;
|
3060
3057
|
response: {
|
3061
3058
|
200: ({
|
3062
|
-
item: {
|
3063
|
-
warehouseId: string;
|
3064
|
-
productId: string;
|
3065
|
-
quantity: number;
|
3066
|
-
safetyStock: number;
|
3067
|
-
shelfNumber: string | null;
|
3068
|
-
id: string;
|
3069
|
-
createdAt: string;
|
3070
|
-
updatedAt: string;
|
3071
|
-
deletedAt: string | null;
|
3072
|
-
oldId: number | null;
|
3073
|
-
} | null;
|
3074
3059
|
service_kind: {
|
3075
3060
|
serviceKindId: string | null;
|
3076
3061
|
companyId: string;
|
@@ -3099,6 +3084,32 @@ export declare const app: Elysia<"", {
|
|
3099
3084
|
deletedAt: string | null;
|
3100
3085
|
oldId: number | null;
|
3101
3086
|
} | null;
|
3087
|
+
sp_package: {
|
3088
|
+
companyId: string;
|
3089
|
+
companyBranchId: string | null;
|
3090
|
+
name: string;
|
3091
|
+
description: string | null;
|
3092
|
+
priceTotal: number;
|
3093
|
+
id: string;
|
3094
|
+
createdAt: string;
|
3095
|
+
updatedAt: string;
|
3096
|
+
deletedAt: string | null;
|
3097
|
+
oldId: number | null;
|
3098
|
+
} | null;
|
3099
|
+
cp_order_sp_package: {
|
3100
|
+
cpOrderId: string;
|
3101
|
+
spPackageId: string;
|
3102
|
+
quantity: number;
|
3103
|
+
priceUnit: number;
|
3104
|
+
priceTotal: number;
|
3105
|
+
name: string;
|
3106
|
+
description: string | null;
|
3107
|
+
id: string;
|
3108
|
+
createdAt: string;
|
3109
|
+
updatedAt: string;
|
3110
|
+
deletedAt: string | null;
|
3111
|
+
oldId: number | null;
|
3112
|
+
} | null;
|
3102
3113
|
cp_order_item: {
|
3103
3114
|
cpOrderId: string;
|
3104
3115
|
companyProductId: string | null;
|
@@ -3509,6 +3520,35 @@ export declare const app: Elysia<"", {
|
|
3509
3520
|
};
|
3510
3521
|
};
|
3511
3522
|
};
|
3523
|
+
} & {
|
3524
|
+
payment: {
|
3525
|
+
ubpay: {
|
3526
|
+
test: {
|
3527
|
+
":id": {
|
3528
|
+
post: {
|
3529
|
+
body: unknown;
|
3530
|
+
params: {
|
3531
|
+
id: string;
|
3532
|
+
};
|
3533
|
+
query: unknown;
|
3534
|
+
headers: unknown;
|
3535
|
+
response: {
|
3536
|
+
200: string;
|
3537
|
+
422: {
|
3538
|
+
type: "validation";
|
3539
|
+
on: string;
|
3540
|
+
summary?: string;
|
3541
|
+
message?: string;
|
3542
|
+
found?: unknown;
|
3543
|
+
property?: string;
|
3544
|
+
expected?: string;
|
3545
|
+
};
|
3546
|
+
};
|
3547
|
+
};
|
3548
|
+
};
|
3549
|
+
};
|
3550
|
+
};
|
3551
|
+
};
|
3512
3552
|
} & {
|
3513
3553
|
payment: {
|
3514
3554
|
ubpay: {
|
@@ -3855,6 +3895,7 @@ export declare const app: Elysia<"", {
|
|
3855
3895
|
transmissionCode: string | null;
|
3856
3896
|
driveTrain: string | null;
|
3857
3897
|
km: number;
|
3898
|
+
customData: unknown;
|
3858
3899
|
companyId: string | null;
|
3859
3900
|
id: string;
|
3860
3901
|
createdAt: string;
|
@@ -3903,7 +3944,7 @@ export declare const app: Elysia<"", {
|
|
3903
3944
|
deletedAt: string | null;
|
3904
3945
|
oldId: number | null;
|
3905
3946
|
} | null;
|
3906
|
-
isDeleteAble:
|
3947
|
+
isDeleteAble: unknown;
|
3907
3948
|
}[];
|
3908
3949
|
};
|
3909
3950
|
401: "Session not found";
|
@@ -3973,6 +4014,7 @@ export declare const app: Elysia<"", {
|
|
3973
4014
|
transmissionCode: string | null;
|
3974
4015
|
driveTrain: string | null;
|
3975
4016
|
km: number;
|
4017
|
+
customData: unknown;
|
3976
4018
|
companyId: string | null;
|
3977
4019
|
id: string;
|
3978
4020
|
createdAt: string;
|
@@ -4021,7 +4063,7 @@ export declare const app: Elysia<"", {
|
|
4021
4063
|
deletedAt: string | null;
|
4022
4064
|
oldId: number | null;
|
4023
4065
|
} | null;
|
4024
|
-
isDeleteAble:
|
4066
|
+
isDeleteAble: unknown;
|
4025
4067
|
}[];
|
4026
4068
|
};
|
4027
4069
|
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
@@ -5014,6 +5056,7 @@ export declare const app: Elysia<"", {
|
|
5014
5056
|
transmissionCode: string | null;
|
5015
5057
|
driveTrain: string | null;
|
5016
5058
|
km: number;
|
5059
|
+
customData: unknown;
|
5017
5060
|
companyId: string | null;
|
5018
5061
|
id: string;
|
5019
5062
|
createdAt: string;
|
@@ -5103,6 +5146,7 @@ export declare const app: Elysia<"", {
|
|
5103
5146
|
transmissionCode: string | null;
|
5104
5147
|
driveTrain: string | null;
|
5105
5148
|
km: number;
|
5149
|
+
customData: unknown;
|
5106
5150
|
};
|
5107
5151
|
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
5108
5152
|
401: "Session not found";
|
@@ -5151,6 +5195,7 @@ export declare const app: Elysia<"", {
|
|
5151
5195
|
transmissionCode: string | null;
|
5152
5196
|
driveTrain: string | null;
|
5153
5197
|
km: number;
|
5198
|
+
customData: unknown;
|
5154
5199
|
companyId: string | null;
|
5155
5200
|
id: string;
|
5156
5201
|
createdAt: string;
|
@@ -5241,6 +5286,7 @@ export declare const app: Elysia<"", {
|
|
5241
5286
|
transmissionCode?: string | null | undefined;
|
5242
5287
|
driveTrain?: string | null | undefined;
|
5243
5288
|
km?: number | undefined;
|
5289
|
+
customData?: import("drizzle-typebox").Json | undefined;
|
5244
5290
|
};
|
5245
5291
|
params: {
|
5246
5292
|
id: string;
|
@@ -5266,6 +5312,7 @@ export declare const app: Elysia<"", {
|
|
5266
5312
|
transmissionCode: string | null;
|
5267
5313
|
driveTrain: string | null;
|
5268
5314
|
km: number;
|
5315
|
+
customData: unknown;
|
5269
5316
|
companyId: string | null;
|
5270
5317
|
id: string;
|
5271
5318
|
createdAt: string;
|
@@ -5319,6 +5366,7 @@ export declare const app: Elysia<"", {
|
|
5319
5366
|
transmissionCode: string | null;
|
5320
5367
|
driveTrain: string | null;
|
5321
5368
|
km: number;
|
5369
|
+
customData: unknown;
|
5322
5370
|
companyId: string | null;
|
5323
5371
|
id: string;
|
5324
5372
|
createdAt: string;
|
@@ -5401,6 +5449,7 @@ export declare const app: Elysia<"", {
|
|
5401
5449
|
transmissionCode: string | null;
|
5402
5450
|
driveTrain: string | null;
|
5403
5451
|
km: number;
|
5452
|
+
customData: unknown;
|
5404
5453
|
}[];
|
5405
5454
|
}[];
|
5406
5455
|
};
|
@@ -6265,6 +6314,7 @@ export declare const app: Elysia<"", {
|
|
6265
6314
|
transmissionCode: string | null;
|
6266
6315
|
driveTrain: string | null;
|
6267
6316
|
km: number;
|
6317
|
+
customData: unknown;
|
6268
6318
|
companyId: string | null;
|
6269
6319
|
id: string;
|
6270
6320
|
createdAt: string;
|
@@ -6496,7 +6546,7 @@ export declare const app: Elysia<"", {
|
|
6496
6546
|
};
|
6497
6547
|
400: string;
|
6498
6548
|
401: "Session not found";
|
6499
|
-
404: "Үзлэг олдсонгүй.";
|
6549
|
+
404: "Бараа олдсонгүй." | "Үйлчилгээний төрөл олдсонгүй." | "Үзлэг олдсонгүй.";
|
6500
6550
|
422: {
|
6501
6551
|
type: "validation";
|
6502
6552
|
on: string;
|
@@ -6588,6 +6638,7 @@ export declare const app: Elysia<"", {
|
|
6588
6638
|
transmissionCode: string | null;
|
6589
6639
|
driveTrain: string | null;
|
6590
6640
|
km: number;
|
6641
|
+
customData: unknown;
|
6591
6642
|
companyId: string | null;
|
6592
6643
|
id: string;
|
6593
6644
|
createdAt: string;
|
package/dist/index.js
CHANGED
@@ -1924,8 +1924,8 @@ var import_debug, debug, syncBufferSize, ddSignatureArray, eocdSignatureBytes;
|
|
1924
1924
|
var init_lib3 = __esm(() => {
|
1925
1925
|
init_lib2();
|
1926
1926
|
init_esm();
|
1927
|
-
import_debug = __toESM(require_src(), 1);
|
1928
1927
|
init_ZipToken();
|
1928
|
+
import_debug = __toESM(require_src(), 1);
|
1929
1929
|
debug = import_debug.default("tokenizer:inflate");
|
1930
1930
|
syncBufferSize = 256 * 1024;
|
1931
1931
|
ddSignatureArray = signatureToArray(Signature.DataDescriptor);
|
@@ -17019,10 +17019,12 @@ var init_infer_result = () => {};
|
|
17019
17019
|
|
17020
17020
|
// node_modules/kysely/dist/esm/index.js
|
17021
17021
|
var init_esm2 = __esm(() => {
|
17022
|
+
init_expression_builder();
|
17023
|
+
init_log_once();
|
17024
|
+
init_query_id();
|
17022
17025
|
init_kysely();
|
17023
17026
|
init_query_creator();
|
17024
17027
|
init_expression();
|
17025
|
-
init_expression_builder();
|
17026
17028
|
init_expression_wrapper();
|
17027
17029
|
init_where_interface();
|
17028
17030
|
init_returning_interface();
|
@@ -17218,8 +17220,6 @@ var init_esm2 = __esm(() => {
|
|
17218
17220
|
init_streamable();
|
17219
17221
|
init_log();
|
17220
17222
|
init_infer_result();
|
17221
|
-
init_log_once();
|
17222
|
-
init_query_id();
|
17223
17223
|
});
|
17224
17224
|
|
17225
17225
|
// node_modules/better-auth/dist/chunks/bun-sqlite-dialect.mjs
|
@@ -142381,6 +142381,7 @@ var crmVehicleTable = crmSchema.table("vehicle", {
|
|
142381
142381
|
transmissionCode: varchar(),
|
142382
142382
|
driveTrain: varchar(),
|
142383
142383
|
km: integer2().notNull().default(0),
|
142384
|
+
customData: jsonb(),
|
142384
142385
|
companyId: uuid5()
|
142385
142386
|
});
|
142386
142387
|
var crmVehicleRelations = relations(crmVehicleTable, ({ one }) => ({
|
@@ -146420,7 +146421,7 @@ var CompanyEmployeeModel;
|
|
146420
146421
|
CompanyEmployeeModel.create = OmitBaseSchema(createSchema);
|
146421
146422
|
CompanyEmployeeModel.update = OmitBaseSchema(updateSchema);
|
146422
146423
|
CompanyEmployeeModel.select = t.Composite([
|
146423
|
-
t.Partial(t.Pick(selectSchema, ["companyId"])),
|
146424
|
+
t.Partial(t.Pick(selectSchema, ["companyId", "branchId"])),
|
146424
146425
|
t.Partial(t.Object({
|
146425
146426
|
search: t.String()
|
146426
146427
|
})),
|
@@ -146453,7 +146454,7 @@ var CompanyEmployeeLogic;
|
|
146453
146454
|
};
|
146454
146455
|
CompanyEmployeeLogic.select = async (query, user2) => {
|
146455
146456
|
const columns = getTableColumns(companyEmployeeTable);
|
146456
|
-
const filter = and(eq(companyEmployeeTable.companyId, user2.companyId), or(isNull2(companyEmployeeTable.branchId), eq(companyEmployeeTable.branchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), or(ilike(companyEmployeeTable.firstname, `%${query.search}%`), ilike(companyEmployeeTable.lastname, `%${query.search}%`), ilike(companyEmployeeTable.phone, `%${query.search}%`), ilike(companyEmployeeTable.regNumber, `%${query.search}%`))?.if(query.search), eq(companyEmployeeTable.companyId, query.companyId ?? "").if(query.companyId && user2.kind === "ADMIN"), softDeletedFilter(companyEmployeeTable));
|
146457
|
+
const filter = and(eq(companyEmployeeTable.companyId, user2.companyId), eq(companyEmployeeTable.branchId, query.branchId).if(query.branchId && user2.kind !== "CUSTOMER"), or(isNull2(companyEmployeeTable.branchId), eq(companyEmployeeTable.branchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), or(ilike(companyEmployeeTable.firstname, `%${query.search}%`), ilike(companyEmployeeTable.lastname, `%${query.search}%`), ilike(companyEmployeeTable.phone, `%${query.search}%`), ilike(companyEmployeeTable.regNumber, `%${query.search}%`))?.if(query.search), eq(companyEmployeeTable.companyId, query.companyId ?? "").if(query.companyId && user2.kind === "ADMIN"), softDeletedFilter(companyEmployeeTable));
|
146457
146458
|
const baseQuery = db_default.select({
|
146458
146459
|
...columns,
|
146459
146460
|
totalCount: totalCountSql
|
@@ -146551,7 +146552,7 @@ var CompanyServiceKindLogic;
|
|
146551
146552
|
};
|
146552
146553
|
CompanyServiceKindLogic.select = async (query, user2) => {
|
146553
146554
|
const columns = getTableColumns(companyServiceKindTable);
|
146554
|
-
const filter = and(eq(companyServiceKindTable.companyId, user2.companyId), eq(companyServiceKindTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"), eq(companyServiceKindTable.enabled, query.enabled ?? true), eq(companyServiceKindTable.serviceKindId, query.serviceKindId ?? "").if(query.serviceKindId), ilike(companyServiceKindTable.name, `%${query.name}%`).if(query.name), softDeletedFilter(companyServiceKindTable), eq(companyServiceKindTable.id, query.id ?? "").if(query.id), inArray(companyServiceKindTable.id, query.ids ?? []).if(query.ids?.length));
|
146555
|
+
const filter = and(eq(companyServiceKindTable.companyId, user2.companyId), or(eq(companyServiceKindTable.branchId, user2.branchId), isNull2(companyServiceKindTable.branchId))?.if(user2.kind === "CUSTOMER"), eq(companyServiceKindTable.enabled, query.enabled ?? true), eq(companyServiceKindTable.serviceKindId, query.serviceKindId ?? "").if(query.serviceKindId), ilike(companyServiceKindTable.name, `%${query.name}%`).if(query.name), softDeletedFilter(companyServiceKindTable), eq(companyServiceKindTable.id, query.id ?? "").if(query.id), inArray(companyServiceKindTable.id, query.ids ?? []).if(query.ids?.length));
|
146555
146556
|
const baseQuery = db_default.select({
|
146556
146557
|
...columns,
|
146557
146558
|
totalCount: totalCountSql
|
@@ -146930,7 +146931,7 @@ var CrmCpOrderItemLogic;
|
|
146930
146931
|
((CrmCpOrderItemLogic) => {
|
146931
146932
|
CrmCpOrderItemLogic.select = async ({ cpOrderId }) => {
|
146932
146933
|
const filter = and(eq(crmCpOrderItemTable.cpOrderId, cpOrderId), softDeletedFilter(crmCpOrderItemTable));
|
146933
|
-
const rows = await db_default.select().from(crmCpOrderItemTable).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(
|
146934
|
+
const rows = await db_default.select().from(crmCpOrderItemTable).leftJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).leftJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).leftJoin(crmCpOrderItemEmployeeTable, eq(crmCpOrderItemEmployeeTable.cpOrderItemId, crmCpOrderItemTable.id)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmCpOrderItemEmployeeTable.employeeId)).leftJoin(crmCpOrderSpPackageTable, eq(crmCpOrderSpPackageTable.cpOrderId, crmCpOrderItemTable.cpOrderId)).leftJoin(crmSpPackageTable, eq(crmSpPackageTable.id, crmCpOrderSpPackageTable.spPackageId)).where(filter);
|
146934
146935
|
const result = rows.reduce((acc, row) => {
|
146935
146936
|
if (!acc[row.cp_order_item.id]) {
|
146936
146937
|
acc[row.cp_order_item.id] = {
|
@@ -147265,11 +147266,11 @@ var CrmSpPackageLogic;
|
|
147265
147266
|
const products = rows.map((row) => row.product ? {
|
147266
147267
|
...row.product,
|
147267
147268
|
name: row.productName
|
147268
|
-
} : undefined).filter((i2) => Boolean(i2));
|
147269
|
+
} : undefined).filter((i2) => Boolean(i2)).filter((product, index2, self2) => index2 === self2.findIndex((t2) => t2.id === product?.id));
|
147269
147270
|
const services = rows.map((row) => row.service ? {
|
147270
147271
|
...row.service,
|
147271
147272
|
name: row.serviceName
|
147272
|
-
} : undefined).filter((i2) => Boolean(i2));
|
147273
|
+
} : undefined).filter((i2) => Boolean(i2)).filter((service5, index2, self2) => index2 === self2.findIndex((t2) => t2.id === service5?.id));
|
147273
147274
|
return {
|
147274
147275
|
spPackage,
|
147275
147276
|
products,
|
@@ -149965,7 +149966,9 @@ class UbPayGateway extends PaymentGateway {
|
|
149965
149966
|
const invoice = await this.ubPay.createInvoice({
|
149966
149967
|
amount: payment.amount,
|
149967
149968
|
description: "Autosync",
|
149968
|
-
customData:
|
149969
|
+
customData: {
|
149970
|
+
bnplProductId: 2
|
149971
|
+
},
|
149969
149972
|
callbackUrl: `${CALLBACK_URL}/ubpay/${payment.id}`
|
149970
149973
|
}, this.token);
|
149971
149974
|
if (invoice.data.success === false) {
|
@@ -150220,9 +150223,8 @@ var CrmCpOrderLogic;
|
|
150220
150223
|
make,
|
150221
150224
|
model,
|
150222
150225
|
customer: crmCustomerTable,
|
150223
|
-
isDeleteAble: sql3`
|
150224
|
-
|
150225
|
-
= 0`.mapWith(Boolean).as("is_delete_able")
|
150226
|
+
isDeleteAble: sql3`(
|
150227
|
+
select case when count(*) = 0 then TRUE else FALSE end from ${crmCpOrderItemTable} where ${crmCpOrderItemTable.cpOrderId} = ${crmCpOrderTable.id} and ${crmCpOrderItemTable.deletedAt} is null)`.as("is_delete_able")
|
150226
150228
|
}).from(crmCpOrderTable).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).leftJoin(crmCustomerTable, eq(crmCustomerTable.id, crmCpOrderTable.customerId)).leftJoin(model, eq(model.id, crmVehicleTable.vehicleKindId)).leftJoin(make, eq(make.id, model.parentId)).where(filter).orderBy(desc(crmCpOrderTable.createdAt)).$dynamic();
|
150227
150229
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
150228
150230
|
let totalAmounts = [];
|
@@ -150829,8 +150831,8 @@ var itemRoutes = new Elysia({
|
|
150829
150831
|
query: model_default8.select
|
150830
150832
|
}).post("/", async ({ body, user: user2 }) => logic_default7.create(body, user2), {
|
150831
150833
|
body: model_default8.create,
|
150832
|
-
afterResponse: async ({ user: user2,
|
150833
|
-
const res =
|
150834
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150835
|
+
const res = responseValue;
|
150834
150836
|
if ("code" in res)
|
150835
150837
|
return res;
|
150836
150838
|
return await logic_default13.apply(res.cpOrderId, user2);
|
@@ -150839,15 +150841,15 @@ var itemRoutes = new Elysia({
|
|
150839
150841
|
params: IdSchema
|
150840
150842
|
}).put("/:id", async ({ params, body, user: user2 }) => logic_default7.update(params.id, body, user2), {
|
150841
150843
|
body: model_default8.update,
|
150842
|
-
afterResponse: async ({ user: user2,
|
150843
|
-
const res =
|
150844
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150845
|
+
const res = responseValue;
|
150844
150846
|
if ("code" in res)
|
150845
150847
|
return;
|
150846
150848
|
await logic_default13.apply(res.cpOrderId, user2);
|
150847
150849
|
}
|
150848
150850
|
}).delete("/:id", async ({ params, user: user2 }) => logic_default7.remove(params.id, user2), {
|
150849
|
-
afterResponse: async ({ user: user2,
|
150850
|
-
const res =
|
150851
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150852
|
+
const res = responseValue;
|
150851
150853
|
if ("code" in res)
|
150852
150854
|
return res;
|
150853
150855
|
return await logic_default13.apply(res.cpOrderId, user2);
|
@@ -150987,6 +150989,9 @@ var paymentRoutes = new Elysia({
|
|
150987
150989
|
}).post("/storepay", async ({ body, user: user2 }) => logic_default12.createStorepay(body, user2), { body: model_default10.storepay, auth: true }).get("/storepay/:id", async ({ params: { id } }) => logic_default12.checkStorePay(id)).post("/ubpay", async ({ body, user: user2 }) => logic_default12.createUbPay(body, user2), {
|
150988
150990
|
body: model_default10.create,
|
150989
150991
|
auth: true
|
150992
|
+
}).post("/ubpay/test/:id", async ({ params: { id } }) => {
|
150993
|
+
app.server?.publish(`cp_order_payment:${id}`, "Testing web socket");
|
150994
|
+
return "ok";
|
150990
150995
|
}).post("/ubpay/:id", async ({ params: { id } }) => logic_default12.checkUbPay(id)).get("/qpay/:id", async ({ params: { id } }) => logic_default12.checkQpay(id)).post("/qpay", async ({ body, user: user2 }) => logic_default12.createQpay(body, user2), {
|
150991
150996
|
body: model_default10.create,
|
150992
150997
|
auth: true
|
@@ -151127,8 +151132,8 @@ var CrmDashboardLogic;
|
|
151127
151132
|
CrmDashboardLogic.getCpOrderTotalAmountByDay = async (user2) => {
|
151128
151133
|
const result = await db_default.select({
|
151129
151134
|
amount: sum(crmCpOrderItemTable.priceTotal).mapWith(Number),
|
151130
|
-
date: sql3`date_trunc('day',
|
151131
|
-
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.date);
|
151135
|
+
date: sql3`date_trunc('day', ${crmCpOrderTable.createdAt})`.as("day")
|
151136
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.date).orderBy((t2) => t2.date);
|
151132
151137
|
return result;
|
151133
151138
|
};
|
151134
151139
|
})(CrmDashboardLogic ||= {});
|
@@ -151324,15 +151329,9 @@ var CrmInspectionLogic;
|
|
151324
151329
|
if ("code" in cpOrder) {
|
151325
151330
|
return cpOrder;
|
151326
151331
|
}
|
151332
|
+
let serviceKind;
|
151327
151333
|
try {
|
151328
|
-
await
|
151329
|
-
const serviceKind = await logic_default4.getInspection(user2, db2);
|
151330
|
-
await logic_default7.create({
|
151331
|
-
quantity: 1,
|
151332
|
-
cpOrderId: cpOrder.id,
|
151333
|
-
companyServiceKindId: serviceKind.id
|
151334
|
-
}, user2);
|
151335
|
-
});
|
151334
|
+
serviceKind = await logic_default4.getInspection(user2);
|
151336
151335
|
} catch (err2) {
|
151337
151336
|
await logic_default14.hardRemove(cpOrder.id, user2);
|
151338
151337
|
if (err2 instanceof Error) {
|
@@ -151340,6 +151339,14 @@ var CrmInspectionLogic;
|
|
151340
151339
|
}
|
151341
151340
|
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.");
|
151342
151341
|
}
|
151342
|
+
const res = await logic_default7.create({
|
151343
|
+
quantity: 1,
|
151344
|
+
cpOrderId: cpOrder.id,
|
151345
|
+
companyServiceKindId: serviceKind.id
|
151346
|
+
}, user2);
|
151347
|
+
if ("code" in res) {
|
151348
|
+
return res;
|
151349
|
+
}
|
151343
151350
|
return {
|
151344
151351
|
cpOrderId: cpOrder.id
|
151345
151352
|
};
|
@@ -152957,7 +152964,7 @@ var productRoutes3 = new Elysia({
|
|
152957
152964
|
body: model_default22.create
|
152958
152965
|
}).post("/many", async ({ body, user: user2 }) => logic_default5.createMany(body, user2), {
|
152959
152966
|
body: t.Array(model_default22.create)
|
152960
|
-
}).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: model_default22.select }).guard({
|
152967
|
+
}).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: t.Omit(model_default22.select, ["pagination"]) }).guard({
|
152961
152968
|
params: IdSchema
|
152962
152969
|
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default5.update(id, body, user2), { body: model_default22.update });
|
152963
152970
|
var product_default3 = productRoutes3;
|