autosync_backend2 1.2.16 → 1.2.17
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 +8 -0
- package/dist/index.js +13 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1011,6 +1011,7 @@ export declare const app: Elysia<"", {
|
|
|
1011
1011
|
warehouseId: string;
|
|
1012
1012
|
productId: string;
|
|
1013
1013
|
quantity: number;
|
|
1014
|
+
quantityUnit: number;
|
|
1014
1015
|
safetyStock: number;
|
|
1015
1016
|
shelfNumber: string | null;
|
|
1016
1017
|
description: string | null;
|
|
@@ -1088,6 +1089,7 @@ export declare const app: Elysia<"", {
|
|
|
1088
1089
|
oldId?: number | null | undefined;
|
|
1089
1090
|
description?: string | null | undefined;
|
|
1090
1091
|
quantity?: number | undefined;
|
|
1092
|
+
quantityUnit?: number | undefined;
|
|
1091
1093
|
shelfNumber?: string | null | undefined;
|
|
1092
1094
|
isOrdered?: boolean | undefined;
|
|
1093
1095
|
productId: string;
|
|
@@ -1108,6 +1110,7 @@ export declare const app: Elysia<"", {
|
|
|
1108
1110
|
quantity: number;
|
|
1109
1111
|
productId: string;
|
|
1110
1112
|
warehouseId: string;
|
|
1113
|
+
quantityUnit: number;
|
|
1111
1114
|
safetyStock: number;
|
|
1112
1115
|
shelfNumber: string | null;
|
|
1113
1116
|
isOrdered: boolean;
|
|
@@ -1132,6 +1135,7 @@ export declare const app: Elysia<"", {
|
|
|
1132
1135
|
oldId?: number | null | undefined;
|
|
1133
1136
|
description?: string | null | undefined;
|
|
1134
1137
|
quantity?: number | undefined;
|
|
1138
|
+
quantityUnit?: number | undefined;
|
|
1135
1139
|
shelfNumber?: string | null | undefined;
|
|
1136
1140
|
isOrdered?: boolean | undefined;
|
|
1137
1141
|
productId: string;
|
|
@@ -1223,6 +1227,7 @@ export declare const app: Elysia<"", {
|
|
|
1223
1227
|
warehouseId: string;
|
|
1224
1228
|
productId: string;
|
|
1225
1229
|
quantity: number;
|
|
1230
|
+
quantityUnit: number;
|
|
1226
1231
|
safetyStock: number;
|
|
1227
1232
|
shelfNumber: string | null;
|
|
1228
1233
|
description: string | null;
|
|
@@ -1296,6 +1301,7 @@ export declare const app: Elysia<"", {
|
|
|
1296
1301
|
warehouseId: string;
|
|
1297
1302
|
productId: string;
|
|
1298
1303
|
quantity: number;
|
|
1304
|
+
quantityUnit: number;
|
|
1299
1305
|
safetyStock: number;
|
|
1300
1306
|
shelfNumber: string | null;
|
|
1301
1307
|
description: string | null;
|
|
@@ -1331,6 +1337,7 @@ export declare const app: Elysia<"", {
|
|
|
1331
1337
|
description?: string | null | undefined;
|
|
1332
1338
|
productId?: string | undefined;
|
|
1333
1339
|
warehouseId?: string | undefined;
|
|
1340
|
+
quantityUnit?: number | undefined;
|
|
1334
1341
|
safetyStock?: number | undefined;
|
|
1335
1342
|
shelfNumber?: string | null | undefined;
|
|
1336
1343
|
isOrdered?: boolean | undefined;
|
|
@@ -1345,6 +1352,7 @@ export declare const app: Elysia<"", {
|
|
|
1345
1352
|
warehouseId: string;
|
|
1346
1353
|
productId: string;
|
|
1347
1354
|
quantity: number;
|
|
1355
|
+
quantityUnit: number;
|
|
1348
1356
|
safetyStock: number;
|
|
1349
1357
|
shelfNumber: string | null;
|
|
1350
1358
|
description: string | null;
|
package/dist/index.js
CHANGED
|
@@ -142990,6 +142990,7 @@ var warehouseItemTable = warehouseSchema.table("item", {
|
|
|
142990
142990
|
warehouseId: uuid5().notNull(),
|
|
142991
142991
|
productId: uuid5().notNull(),
|
|
142992
142992
|
quantity: numeric({ mode: "number" }).notNull().default(0),
|
|
142993
|
+
quantityUnit: integer2().notNull().default(1),
|
|
142993
142994
|
safetyStock: numeric({ mode: "number" }).notNull(),
|
|
142994
142995
|
shelfNumber: varchar(),
|
|
142995
142996
|
description: text(),
|
|
@@ -147251,7 +147252,8 @@ var WarehouseItemLogic;
|
|
|
147251
147252
|
return status("Bad Request", "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u04AF\u043B\u0434\u044D\u0433\u0434\u044D\u043B \u0445\u04AF\u0440\u044D\u043B\u0446\u044D\u0445\u0433\u04AF\u0439 \u0431\u0430\u0439\u043D\u0430.");
|
|
147252
147253
|
}
|
|
147253
147254
|
const [updatedItem] = await tdb.update(warehouseItemTable).set({
|
|
147254
|
-
quantity: quantityAfter
|
|
147255
|
+
quantity: quantityAfter,
|
|
147256
|
+
deletedAt: null
|
|
147255
147257
|
}).where(eq(warehouseItemTable.id, itemId)).returning();
|
|
147256
147258
|
await tdb.insert(warehouseItemTransactionTable).values({
|
|
147257
147259
|
itemId,
|
|
@@ -147284,7 +147286,7 @@ var CrmCpOrderItemLogic;
|
|
|
147284
147286
|
((CrmCpOrderItemLogic) => {
|
|
147285
147287
|
CrmCpOrderItemLogic.select = async ({ cpOrderId }) => {
|
|
147286
147288
|
const filter = and(eq(crmCpOrderItemTable.cpOrderId, cpOrderId), softDeletedFilter(crmCpOrderItemTable));
|
|
147287
|
-
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.
|
|
147289
|
+
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.id, crmCpOrderItemTable.cpOrderSpPackageId)).leftJoin(crmSpPackageTable, eq(crmSpPackageTable.id, crmCpOrderSpPackageTable.spPackageId)).where(filter);
|
|
147288
147290
|
const result = rows.reduce((acc, row) => {
|
|
147289
147291
|
if (!acc[row.cp_order_item.id]) {
|
|
147290
147292
|
acc[row.cp_order_item.id] = {
|
|
@@ -147338,7 +147340,7 @@ var CrmCpOrderItemLogic;
|
|
|
147338
147340
|
}
|
|
147339
147341
|
const curr = await db_default.select({
|
|
147340
147342
|
id: crmCpOrderItemTable.id
|
|
147341
|
-
}).from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, body.cpOrderId), eq(crmCpOrderItemTable.companyServiceKindId, body.companyServiceKindId ?? "").if(body.companyServiceKindId), eq(crmCpOrderItemTable.companyProductId, body.companyProductId ?? "").if(body.companyProductId)));
|
|
147343
|
+
}).from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, body.cpOrderId), eq(crmCpOrderItemTable.companyServiceKindId, body.companyServiceKindId ?? "").if(body.companyServiceKindId), eq(crmCpOrderItemTable.companyProductId, body.companyProductId ?? "").if(body.companyProductId), isNull2(crmCpOrderItemTable.cpOrderSpPackageId)));
|
|
147342
147344
|
if (curr.length > 0) {
|
|
147343
147345
|
const [updated] = await db_default.update(crmCpOrderItemTable).set({
|
|
147344
147346
|
...body,
|
|
@@ -147412,7 +147414,11 @@ var CrmCpOrderItemLogic;
|
|
|
147412
147414
|
priceTotal: item.quantity * (item.priceUnit ?? serviceKind?.price ?? product?.product.priceSell ?? 0)
|
|
147413
147415
|
});
|
|
147414
147416
|
}
|
|
147415
|
-
const currentValues = await db_default.select().from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, insertValues[0].cpOrderId), or(
|
|
147417
|
+
const currentValues = await db_default.select().from(crmCpOrderItemTable).where(and(eq(crmCpOrderItemTable.cpOrderId, insertValues[0].cpOrderId), or(...insertValues.map((i2) => {
|
|
147418
|
+
if (!i2.companyProductId && !i2.companyServiceKindId)
|
|
147419
|
+
return null;
|
|
147420
|
+
return and(eq(crmCpOrderItemTable.companyProductId, i2.companyProductId).if(i2.companyProductId), eq(crmCpOrderItemTable.companyServiceKindId, i2.companyServiceKindId).if(i2.companyServiceKindId), i2.cpOrderSpPackageId ? eq(crmCpOrderItemTable.cpOrderSpPackageId, i2.cpOrderSpPackageId) : isNull2(crmCpOrderItemTable.cpOrderSpPackageId));
|
|
147421
|
+
}).filter((i2) => !!i2))));
|
|
147416
147422
|
if (currentValues.length > 0) {
|
|
147417
147423
|
return status("Bad Request", "\u0411\u043E\u0440\u043B\u0443\u0443\u043B\u0430\u043B\u0442\u044B\u043D \u04AF\u0439\u043B\u0447\u0438\u043B\u0433\u044D\u044D \u044D\u0441\u0432\u044D\u043B \u0431\u0430\u0440\u0430\u0430 \u0430\u043B\u044C \u0445\u044D\u0434\u0438\u0439\u043D \u043E\u0440\u0441\u043E\u043D \u0431\u0430\u0439\u043D\u0430.");
|
|
147418
147424
|
}
|
|
@@ -152328,6 +152334,9 @@ var CrmReportsModel;
|
|
|
152328
152334
|
CrmReportsModel.cpOrderReport = t.Object({
|
|
152329
152335
|
type: t.UnionEnum(["Product", "Service"])
|
|
152330
152336
|
});
|
|
152337
|
+
CrmReportsModel.cpOrderEmployeeReport = t.Object({
|
|
152338
|
+
employeeId: t.String({ format: "uuid" })
|
|
152339
|
+
});
|
|
152331
152340
|
})(CrmReportsModel ||= {});
|
|
152332
152341
|
var model_default14 = CrmReportsModel;
|
|
152333
152342
|
|