autosync_backend2 1.2.9 → 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 +40 -15
- package/dist/index.js +23 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -3056,18 +3056,6 @@ export declare const app: Elysia<"", {
|
|
3056
3056
|
headers: unknown;
|
3057
3057
|
response: {
|
3058
3058
|
200: ({
|
3059
|
-
item: {
|
3060
|
-
warehouseId: string;
|
3061
|
-
productId: string;
|
3062
|
-
quantity: number;
|
3063
|
-
safetyStock: number;
|
3064
|
-
shelfNumber: string | null;
|
3065
|
-
id: string;
|
3066
|
-
createdAt: string;
|
3067
|
-
updatedAt: string;
|
3068
|
-
deletedAt: string | null;
|
3069
|
-
oldId: number | null;
|
3070
|
-
} | null;
|
3071
3059
|
service_kind: {
|
3072
3060
|
serviceKindId: string | null;
|
3073
3061
|
companyId: string;
|
@@ -3096,6 +3084,32 @@ export declare const app: Elysia<"", {
|
|
3096
3084
|
deletedAt: string | null;
|
3097
3085
|
oldId: number | null;
|
3098
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;
|
3099
3113
|
cp_order_item: {
|
3100
3114
|
cpOrderId: string;
|
3101
3115
|
companyProductId: string | null;
|
@@ -3881,6 +3895,7 @@ export declare const app: Elysia<"", {
|
|
3881
3895
|
transmissionCode: string | null;
|
3882
3896
|
driveTrain: string | null;
|
3883
3897
|
km: number;
|
3898
|
+
customData: unknown;
|
3884
3899
|
companyId: string | null;
|
3885
3900
|
id: string;
|
3886
3901
|
createdAt: string;
|
@@ -3929,7 +3944,7 @@ export declare const app: Elysia<"", {
|
|
3929
3944
|
deletedAt: string | null;
|
3930
3945
|
oldId: number | null;
|
3931
3946
|
} | null;
|
3932
|
-
isDeleteAble:
|
3947
|
+
isDeleteAble: unknown;
|
3933
3948
|
}[];
|
3934
3949
|
};
|
3935
3950
|
401: "Session not found";
|
@@ -3999,6 +4014,7 @@ export declare const app: Elysia<"", {
|
|
3999
4014
|
transmissionCode: string | null;
|
4000
4015
|
driveTrain: string | null;
|
4001
4016
|
km: number;
|
4017
|
+
customData: unknown;
|
4002
4018
|
companyId: string | null;
|
4003
4019
|
id: string;
|
4004
4020
|
createdAt: string;
|
@@ -4047,7 +4063,7 @@ export declare const app: Elysia<"", {
|
|
4047
4063
|
deletedAt: string | null;
|
4048
4064
|
oldId: number | null;
|
4049
4065
|
} | null;
|
4050
|
-
isDeleteAble:
|
4066
|
+
isDeleteAble: unknown;
|
4051
4067
|
}[];
|
4052
4068
|
};
|
4053
4069
|
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
@@ -5040,6 +5056,7 @@ export declare const app: Elysia<"", {
|
|
5040
5056
|
transmissionCode: string | null;
|
5041
5057
|
driveTrain: string | null;
|
5042
5058
|
km: number;
|
5059
|
+
customData: unknown;
|
5043
5060
|
companyId: string | null;
|
5044
5061
|
id: string;
|
5045
5062
|
createdAt: string;
|
@@ -5129,6 +5146,7 @@ export declare const app: Elysia<"", {
|
|
5129
5146
|
transmissionCode: string | null;
|
5130
5147
|
driveTrain: string | null;
|
5131
5148
|
km: number;
|
5149
|
+
customData: unknown;
|
5132
5150
|
};
|
5133
5151
|
400: "Машины дугаар болон VIN хоёроос нэгийг нь оруулна уу." | "Машины VIN оруулсан бол машины төрөл оруулна уу.";
|
5134
5152
|
401: "Session not found";
|
@@ -5177,6 +5195,7 @@ export declare const app: Elysia<"", {
|
|
5177
5195
|
transmissionCode: string | null;
|
5178
5196
|
driveTrain: string | null;
|
5179
5197
|
km: number;
|
5198
|
+
customData: unknown;
|
5180
5199
|
companyId: string | null;
|
5181
5200
|
id: string;
|
5182
5201
|
createdAt: string;
|
@@ -5267,6 +5286,7 @@ export declare const app: Elysia<"", {
|
|
5267
5286
|
transmissionCode?: string | null | undefined;
|
5268
5287
|
driveTrain?: string | null | undefined;
|
5269
5288
|
km?: number | undefined;
|
5289
|
+
customData?: import("drizzle-typebox").Json | undefined;
|
5270
5290
|
};
|
5271
5291
|
params: {
|
5272
5292
|
id: string;
|
@@ -5292,6 +5312,7 @@ export declare const app: Elysia<"", {
|
|
5292
5312
|
transmissionCode: string | null;
|
5293
5313
|
driveTrain: string | null;
|
5294
5314
|
km: number;
|
5315
|
+
customData: unknown;
|
5295
5316
|
companyId: string | null;
|
5296
5317
|
id: string;
|
5297
5318
|
createdAt: string;
|
@@ -5345,6 +5366,7 @@ export declare const app: Elysia<"", {
|
|
5345
5366
|
transmissionCode: string | null;
|
5346
5367
|
driveTrain: string | null;
|
5347
5368
|
km: number;
|
5369
|
+
customData: unknown;
|
5348
5370
|
companyId: string | null;
|
5349
5371
|
id: string;
|
5350
5372
|
createdAt: string;
|
@@ -5427,6 +5449,7 @@ export declare const app: Elysia<"", {
|
|
5427
5449
|
transmissionCode: string | null;
|
5428
5450
|
driveTrain: string | null;
|
5429
5451
|
km: number;
|
5452
|
+
customData: unknown;
|
5430
5453
|
}[];
|
5431
5454
|
}[];
|
5432
5455
|
};
|
@@ -6291,6 +6314,7 @@ export declare const app: Elysia<"", {
|
|
6291
6314
|
transmissionCode: string | null;
|
6292
6315
|
driveTrain: string | null;
|
6293
6316
|
km: number;
|
6317
|
+
customData: unknown;
|
6294
6318
|
companyId: string | null;
|
6295
6319
|
id: string;
|
6296
6320
|
createdAt: string;
|
@@ -6522,7 +6546,7 @@ export declare const app: Elysia<"", {
|
|
6522
6546
|
};
|
6523
6547
|
400: string;
|
6524
6548
|
401: "Session not found";
|
6525
|
-
404: "Үзлэг олдсонгүй.";
|
6549
|
+
404: "Бараа олдсонгүй." | "Үйлчилгээний төрөл олдсонгүй." | "Үзлэг олдсонгүй.";
|
6526
6550
|
422: {
|
6527
6551
|
type: "validation";
|
6528
6552
|
on: string;
|
@@ -6614,6 +6638,7 @@ export declare const app: Elysia<"", {
|
|
6614
6638
|
transmissionCode: string | null;
|
6615
6639
|
driveTrain: string | null;
|
6616
6640
|
km: number;
|
6641
|
+
customData: unknown;
|
6617
6642
|
companyId: string | null;
|
6618
6643
|
id: string;
|
6619
6644
|
createdAt: string;
|
package/dist/index.js
CHANGED
@@ -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 }) => ({
|
@@ -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,
|
@@ -150222,9 +150223,8 @@ var CrmCpOrderLogic;
|
|
150222
150223
|
make,
|
150223
150224
|
model,
|
150224
150225
|
customer: crmCustomerTable,
|
150225
|
-
isDeleteAble: sql3`
|
150226
|
-
|
150227
|
-
= 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")
|
150228
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();
|
150229
150229
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
150230
150230
|
let totalAmounts = [];
|
@@ -150831,8 +150831,8 @@ var itemRoutes = new Elysia({
|
|
150831
150831
|
query: model_default8.select
|
150832
150832
|
}).post("/", async ({ body, user: user2 }) => logic_default7.create(body, user2), {
|
150833
150833
|
body: model_default8.create,
|
150834
|
-
afterResponse: async ({ user: user2,
|
150835
|
-
const res =
|
150834
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150835
|
+
const res = responseValue;
|
150836
150836
|
if ("code" in res)
|
150837
150837
|
return res;
|
150838
150838
|
return await logic_default13.apply(res.cpOrderId, user2);
|
@@ -150841,15 +150841,15 @@ var itemRoutes = new Elysia({
|
|
150841
150841
|
params: IdSchema
|
150842
150842
|
}).put("/:id", async ({ params, body, user: user2 }) => logic_default7.update(params.id, body, user2), {
|
150843
150843
|
body: model_default8.update,
|
150844
|
-
afterResponse: async ({ user: user2,
|
150845
|
-
const res =
|
150844
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150845
|
+
const res = responseValue;
|
150846
150846
|
if ("code" in res)
|
150847
150847
|
return;
|
150848
150848
|
await logic_default13.apply(res.cpOrderId, user2);
|
150849
150849
|
}
|
150850
150850
|
}).delete("/:id", async ({ params, user: user2 }) => logic_default7.remove(params.id, user2), {
|
150851
|
-
afterResponse: async ({ user: user2,
|
150852
|
-
const res =
|
150851
|
+
afterResponse: async ({ user: user2, responseValue }) => {
|
150852
|
+
const res = responseValue;
|
150853
150853
|
if ("code" in res)
|
150854
150854
|
return res;
|
150855
150855
|
return await logic_default13.apply(res.cpOrderId, user2);
|
@@ -151329,15 +151329,9 @@ var CrmInspectionLogic;
|
|
151329
151329
|
if ("code" in cpOrder) {
|
151330
151330
|
return cpOrder;
|
151331
151331
|
}
|
151332
|
+
let serviceKind;
|
151332
151333
|
try {
|
151333
|
-
await
|
151334
|
-
const serviceKind = await logic_default4.getInspection(user2, db2);
|
151335
|
-
await logic_default7.create({
|
151336
|
-
quantity: 1,
|
151337
|
-
cpOrderId: cpOrder.id,
|
151338
|
-
companyServiceKindId: serviceKind.id
|
151339
|
-
}, user2);
|
151340
|
-
});
|
151334
|
+
serviceKind = await logic_default4.getInspection(user2);
|
151341
151335
|
} catch (err2) {
|
151342
151336
|
await logic_default14.hardRemove(cpOrder.id, user2);
|
151343
151337
|
if (err2 instanceof Error) {
|
@@ -151345,6 +151339,14 @@ var CrmInspectionLogic;
|
|
151345
151339
|
}
|
151346
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.");
|
151347
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
|
+
}
|
151348
151350
|
return {
|
151349
151351
|
cpOrderId: cpOrder.id
|
151350
151352
|
};
|