autosync_backend2 1.2.69 → 1.2.73
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 +128 -18
- package/dist/index.js +309 -260
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -147984,8 +147984,15 @@ var import_exceljs = __toESM(require_excel(), 1);
|
|
|
147984
147984
|
var WarehouseProductLogic;
|
|
147985
147985
|
((WarehouseProductLogic) => {
|
|
147986
147986
|
WarehouseProductLogic.getFilter = (query, user2) => {
|
|
147987
|
-
const
|
|
147988
|
-
|
|
147987
|
+
const search = [];
|
|
147988
|
+
if (query.search) {
|
|
147989
|
+
const splitted = query.search.trim().split(" ").filter((i2) => i2 !== "");
|
|
147990
|
+
const productKeys = ["name", "barCode", "oen", "partNumber", "alias"];
|
|
147991
|
+
for (const key of productKeys) {
|
|
147992
|
+
search.push(and(...splitted.map((i2) => ilike(warehouseProductTable[key], `%${i2}%`))));
|
|
147993
|
+
}
|
|
147994
|
+
}
|
|
147995
|
+
return and(softDeletedFilter(warehouseProductTable), eq(warehouseProductTable.companyId, user2.companyId), or(...search)?.if(!!query.search), eq(warehouseProductTable.priceSell, query.priceSell ?? 0).if(query.priceSell), eq(warehouseProductTable.productId, query.productId ?? "").if(query.productId), eq(warehouseProductTable.supplierId, query.supplierId ?? "").if(query.supplierId), eq(warehouseProductTable.id, query.id ?? "").if(query.id), inArray(warehouseProductTable.id, query.ids ?? []).if(query.ids?.length), ...query.type ? [eq(warehouseProductTable.type, query.type)] : []);
|
|
147989
147996
|
};
|
|
147990
147997
|
WarehouseProductLogic.select = async (query, user2) => {
|
|
147991
147998
|
const baseQuery = db_default.select({
|
|
@@ -147994,14 +148001,7 @@ var WarehouseProductLogic;
|
|
|
147994
148001
|
totalCount: totalCountSql
|
|
147995
148002
|
}).from(warehouseProductTable).leftJoin(techdocSupplierTable, eq(techdocSupplierTable.id, warehouseProductTable.supplierId)).where(WarehouseProductLogic.getFilter(query, user2)).orderBy(desc(warehouseProductTable.createdAt)).$dynamic();
|
|
147996
148003
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
147997
|
-
|
|
147998
|
-
totalCount: result[0]?.totalCount ?? 0,
|
|
147999
|
-
totalPage: result.length === 0 ? 0 : Math.ceil(result[0].totalCount / query.pagination.size)
|
|
148000
|
-
};
|
|
148001
|
-
return {
|
|
148002
|
-
result: result.map(({ totalCount, ...item }) => item),
|
|
148003
|
-
...content
|
|
148004
|
-
};
|
|
148004
|
+
return getPaginationContent(result, query.pagination.size);
|
|
148005
148005
|
};
|
|
148006
148006
|
WarehouseProductLogic.create = async (body, user2) => {
|
|
148007
148007
|
const [result] = await db_default.insert(warehouseProductTable).values({
|
|
@@ -148109,10 +148109,22 @@ var WarehouseProductLogic;
|
|
|
148109
148109
|
var logic_default8 = WarehouseProductLogic;
|
|
148110
148110
|
|
|
148111
148111
|
// src/routes/warehouse/item/logic.ts
|
|
148112
|
+
var BATCH_SIZE = 1000;
|
|
148113
|
+
var DATA_STORE_EXPIRY_HOURS = 1;
|
|
148114
|
+
var TRANSACTION_DESCRIPTION_IN = "\u0411\u0430\u0440\u0430\u0430 \u043E\u0440\u043B\u043E\u0433\u0434\u043E\u0445";
|
|
148115
|
+
var ERRORS = {
|
|
148116
|
+
EMPLOYEE_REQUIRED: "\u0410\u0436\u0438\u043B\u0442\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u0448\u0430\u0430\u0440\u0434\u043B\u0430\u0433\u0430\u0442\u0430\u0439.",
|
|
148117
|
+
ITEM_NOT_FOUND: "\u0410\u0433\u0443\u0443\u043B\u0430\u0445\u044B\u043D \u0431\u0430\u0440\u0430\u0430 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.",
|
|
148118
|
+
PRODUCT_NOT_FOUND: "\u0411\u0430\u0440\u0430\u0430\u043D\u044B \u043C\u044D\u0434\u044D\u044D\u043B\u044D\u043B \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.",
|
|
148119
|
+
INSUFFICIENT_STOCK: "\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."
|
|
148120
|
+
};
|
|
148112
148121
|
var WarehouseItemLogic;
|
|
148113
148122
|
((WarehouseItemLogic) => {
|
|
148123
|
+
const buildItemFilter = (query, user2) => {
|
|
148124
|
+
return and(softDeletedFilter(warehouseItemTable).if(query.isActive), isNotNull(warehouseItemTable.deletedAt).if(query.isActive !== undefined && query.isActive === false), ...query.product ? [logic_default8.getFilter(query.product, user2)] : [], eq(warehouseItemTable.safetyStock, query.safetyStock ?? 0).if(query.safetyStock), lte(warehouseItemTable.quantity, warehouseItemTable.safetyStock).if(query.isSafetyStock), ilike(warehouseItemTable.shelfNumber, `%${query.shelfNumber}%`).if(query.shelfNumber), eq(warehouseItemTable.warehouseId, query.warehouseId).if(query.warehouseId), eq(warehouseItemTable.isOrdered, query.isOrdered).if(query.isOrdered));
|
|
148125
|
+
};
|
|
148114
148126
|
WarehouseItemLogic.select = async (query, user2) => {
|
|
148115
|
-
const filter =
|
|
148127
|
+
const filter = buildItemFilter(query, user2);
|
|
148116
148128
|
const baseQuery = db_default.select({
|
|
148117
148129
|
item: warehouseItemTable,
|
|
148118
148130
|
supplier: techdocSupplierTable,
|
|
@@ -148120,21 +148132,14 @@ var WarehouseItemLogic;
|
|
|
148120
148132
|
totalCount: totalCountSql
|
|
148121
148133
|
}).from(warehouseItemTable).where(filter).innerJoin(warehouseProductTable, and(eq(warehouseItemTable.productId, warehouseProductTable.id), isNull2(warehouseProductTable.deletedAt))).leftJoin(techdocSupplierTable, eq(warehouseProductTable.supplierId, techdocSupplierTable.id)).orderBy(warehouseItemTable.order, warehouseItemTable.createdAt).$dynamic();
|
|
148122
148134
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
148123
|
-
|
|
148124
|
-
totalCount: result[0]?.totalCount ?? 0,
|
|
148125
|
-
totalPage: result.length === 0 ? 0 : Math.ceil(result[0].totalCount / query.pagination.size)
|
|
148126
|
-
};
|
|
148127
|
-
return {
|
|
148128
|
-
result: result.map(({ totalCount, ...item }) => item),
|
|
148129
|
-
...content
|
|
148130
|
-
};
|
|
148135
|
+
return getPaginationContent(result, query.pagination.size);
|
|
148131
148136
|
};
|
|
148132
148137
|
WarehouseItemLogic.selectSos = async (user2) => {
|
|
148133
148138
|
const filter = and(softDeletedFilter(warehouseItemTable), lte(warehouseItemTable.quantity, warehouseItemTable.safetyStock), logic_default8.getFilter({}, user2));
|
|
148134
148139
|
const result = await db_default.select({
|
|
148135
148140
|
count: sql3`count(*)`.mapWith(Number)
|
|
148136
148141
|
}).from(warehouseItemTable).innerJoin(warehouseProductTable, eq(warehouseItemTable.productId, warehouseProductTable.id)).where(filter);
|
|
148137
|
-
return result[0] ?? 0;
|
|
148142
|
+
return result[0]?.count ?? 0;
|
|
148138
148143
|
};
|
|
148139
148144
|
WarehouseItemLogic.create = async (body) => {
|
|
148140
148145
|
const [result] = await db_default.insert(warehouseItemTable).values(body).returning();
|
|
@@ -148143,21 +148148,22 @@ var WarehouseItemLogic;
|
|
|
148143
148148
|
WarehouseItemLogic.update = async (id, body) => {
|
|
148144
148149
|
const [result] = await db_default.update(warehouseItemTable).set(body).where(eq(warehouseItemTable.id, id)).returning();
|
|
148145
148150
|
if (!result) {
|
|
148146
|
-
return status("Not Found",
|
|
148151
|
+
return status("Not Found", ERRORS.ITEM_NOT_FOUND);
|
|
148147
148152
|
}
|
|
148148
148153
|
return result;
|
|
148149
148154
|
};
|
|
148150
148155
|
WarehouseItemLogic.upload = async (body) => {
|
|
148151
|
-
const
|
|
148156
|
+
const productIds = body.map((item) => item.productId);
|
|
148157
|
+
const products = await logic_default8.selectByIds(productIds);
|
|
148152
148158
|
if (products.length !== body.length) {
|
|
148153
|
-
const
|
|
148159
|
+
const notFoundProductIds = body.filter((item) => !products.some((p) => p.id === item.productId)).map((item) => item.productId);
|
|
148154
148160
|
return status("Bad Request", {
|
|
148155
|
-
message:
|
|
148156
|
-
data:
|
|
148161
|
+
message: ERRORS.PRODUCT_NOT_FOUND,
|
|
148162
|
+
data: notFoundProductIds
|
|
148157
148163
|
});
|
|
148158
148164
|
}
|
|
148159
148165
|
const result = await dataStore_logic_default.create({
|
|
148160
|
-
expireDate: sql3`now() + interval '
|
|
148166
|
+
expireDate: sql3`now() + interval '${DATA_STORE_EXPIRY_HOURS} hour'`,
|
|
148161
148167
|
data: {
|
|
148162
148168
|
warehouseInId: body[0].warehouseId,
|
|
148163
148169
|
transactionKind: "ORDER",
|
|
@@ -148166,62 +148172,76 @@ var WarehouseItemLogic;
|
|
|
148166
148172
|
});
|
|
148167
148173
|
return result;
|
|
148168
148174
|
};
|
|
148175
|
+
const createInitialTransaction = (item, userId, employeeId) => ({
|
|
148176
|
+
itemId: item.id,
|
|
148177
|
+
productId: item.productId,
|
|
148178
|
+
transactionType: "IN",
|
|
148179
|
+
transactionKind: "TRANSFER",
|
|
148180
|
+
quantity: item.quantity,
|
|
148181
|
+
quantityBefore: 0,
|
|
148182
|
+
quantityAfter: item.quantity,
|
|
148183
|
+
description: TRANSACTION_DESCRIPTION_IN,
|
|
148184
|
+
employeeId,
|
|
148185
|
+
userId
|
|
148186
|
+
});
|
|
148187
|
+
const separateNewAndExistingItems = async (body) => {
|
|
148188
|
+
const productIds = body.map((item) => item.productId);
|
|
148189
|
+
const currentItems = await db_default.select().from(warehouseItemTable).where(inArray(warehouseItemTable.productId, productIds));
|
|
148190
|
+
const currentItemKeys = new Set(currentItems.map((item) => `${item.productId}-${item.warehouseId}`));
|
|
148191
|
+
const newItems = body.filter((item) => !currentItemKeys.has(`${item.productId}-${item.warehouseId}`));
|
|
148192
|
+
return { newItems, currentItems };
|
|
148193
|
+
};
|
|
148194
|
+
const processNewItemsBatch = async (batch, user2, employeeId) => {
|
|
148195
|
+
const inserted = await db_default.insert(warehouseItemTable).values(batch).returning();
|
|
148196
|
+
await db_default.insert(warehouseItemTransactionTable).values(inserted.map((item) => createInitialTransaction(item, user2.id, employeeId)));
|
|
148197
|
+
return inserted;
|
|
148198
|
+
};
|
|
148199
|
+
const calculateProgress = (current, total) => ({
|
|
148200
|
+
percent: Math.min(Math.round(current / total * 100), 100),
|
|
148201
|
+
count: current,
|
|
148202
|
+
total
|
|
148203
|
+
});
|
|
148169
148204
|
WarehouseItemLogic.createMany = async function* (body, user2) {
|
|
148170
148205
|
if (!user2.employeeId) {
|
|
148171
|
-
throw status("Bad Request",
|
|
148206
|
+
throw status("Bad Request", ERRORS.EMPLOYEE_REQUIRED);
|
|
148172
148207
|
}
|
|
148173
|
-
const
|
|
148174
|
-
const currentItems = await db_default.select().from(warehouseItemTable).where(inArray(warehouseItemTable.productId, body.map((item) => item.productId)));
|
|
148175
|
-
const newItems = body.filter((item) => currentItems.filter((i2) => i2.productId === item.productId && i2.warehouseId === item.warehouseId).length === 0);
|
|
148208
|
+
const { newItems, currentItems } = await separateNewAndExistingItems(body);
|
|
148176
148209
|
for (let i2 = 0;i2 < newItems.length; i2 += BATCH_SIZE) {
|
|
148177
148210
|
const batch = newItems.slice(i2, i2 + BATCH_SIZE);
|
|
148178
|
-
|
|
148179
|
-
await db_default.insert(warehouseItemTransactionTable).values(inserted.map((i3) => ({
|
|
148180
|
-
itemId: i3.id,
|
|
148181
|
-
productId: i3.productId,
|
|
148182
|
-
transactionType: "IN",
|
|
148183
|
-
transactionKind: "TRANSFER",
|
|
148184
|
-
quantity: i3.quantity,
|
|
148185
|
-
quantityBefore: 0,
|
|
148186
|
-
quantityAfter: i3.quantity,
|
|
148187
|
-
description: "\u0411\u0430\u0440\u0430\u0430 \u043E\u0440\u043B\u043E\u0433\u0434\u043E\u0445",
|
|
148188
|
-
employeeId: user2.employeeId ?? "",
|
|
148189
|
-
userId: user2.id
|
|
148190
|
-
})));
|
|
148191
|
-
const percent = Math.round((i2 * BATCH_SIZE + batch.length) / newItems.length * 100);
|
|
148211
|
+
await processNewItemsBatch(batch, user2, user2.employeeId);
|
|
148192
148212
|
yield {
|
|
148193
|
-
|
|
148194
|
-
count: i2,
|
|
148195
|
-
total: body.length,
|
|
148213
|
+
...calculateProgress(i2 + batch.length, newItems.length),
|
|
148196
148214
|
type: "New Items"
|
|
148197
148215
|
};
|
|
148198
148216
|
}
|
|
148199
|
-
for (const [index2,
|
|
148200
|
-
const
|
|
148201
|
-
|
|
148202
|
-
|
|
148203
|
-
|
|
148204
|
-
|
|
148205
|
-
|
|
148206
|
-
|
|
148207
|
-
|
|
148217
|
+
for (const [index2, currentItem] of currentItems.entries()) {
|
|
148218
|
+
const matchingBodyItem = body.find((item) => item.productId === currentItem.productId && item.warehouseId === currentItem.warehouseId);
|
|
148219
|
+
if (matchingBodyItem && matchingBodyItem.quantity !== undefined) {
|
|
148220
|
+
const result = await WarehouseItemLogic.changeQuantity({
|
|
148221
|
+
itemId: currentItem.id,
|
|
148222
|
+
quantityChange: matchingBodyItem.quantity,
|
|
148223
|
+
transactionDetails: {
|
|
148224
|
+
transactionType: "IN",
|
|
148225
|
+
transactionKind: "TRANSFER",
|
|
148226
|
+
description: TRANSACTION_DESCRIPTION_IN
|
|
148227
|
+
}
|
|
148228
|
+
}, user2);
|
|
148229
|
+
if ("code" in result) {
|
|
148230
|
+
yield result;
|
|
148208
148231
|
}
|
|
148209
|
-
}, user2);
|
|
148210
|
-
if ("code" in res) {
|
|
148211
|
-
yield res;
|
|
148212
148232
|
}
|
|
148213
|
-
const percent = Math.round(index2 / currentItems.length * 100);
|
|
148214
148233
|
yield {
|
|
148215
|
-
|
|
148216
|
-
count: index2,
|
|
148217
|
-
total: currentItems.length,
|
|
148234
|
+
...calculateProgress(index2 + 1, currentItems.length),
|
|
148218
148235
|
type: "Current Items"
|
|
148219
148236
|
};
|
|
148220
148237
|
}
|
|
148221
148238
|
};
|
|
148239
|
+
const buildTransactionFilter = (query, user2) => {
|
|
148240
|
+
return and(softDeletedFilter(warehouseItemTransactionTable), eq(user.companyId, user2.companyId), ...query.product ? [logic_default8.getFilter(query.product, user2)] : [], eq(warehouseItemTransactionTable.transactionType, query.transactionType ?? "IN").if(query.transactionType), eq(warehouseItemTransactionTable.transactionKind, query.transactionKind ?? "TRANSFER").if(query.transactionKind), eq(warehouseItemTransactionTable.employeeId, query.employeeId ?? "").if(query.employeeId), eq(warehouseItemTransactionTable.userId, query.userId ?? "").if(query.userId), eq(warehouseItemTransactionTable.salesId, query.salesId ?? "").if(query.salesId), eq(warehouseItemTransactionTable.orderId, query.orderId ?? "").if(query.orderId), eq(warehouseItemTransactionTable.transferId, query.transferId ?? "").if(query.transferId), eq(warehouseItemTransactionTable.itemId, query.itemId ?? "").if(query.itemId), gte(warehouseItemTransactionTable.createdAt, query.dateFrom ?? "").if(query.dateFrom), lte(warehouseItemTransactionTable.createdAt, query.dateTo ?? "").if(query.dateTo), gte(warehouseItemTransactionTable.quantity, query.minQuantity ?? 0).if(query.minQuantity), lte(warehouseItemTransactionTable.quantity, query.maxQuantity ?? 0).if(query.maxQuantity), eq(warehouseItemTable.warehouseId, query.warehouseId).if(query.warehouseId));
|
|
148241
|
+
};
|
|
148222
148242
|
WarehouseItemLogic.selectTransaction = async (query, user2) => {
|
|
148243
|
+
const filter = buildTransactionFilter(query, user2);
|
|
148223
148244
|
const columns = getTableColumns(warehouseItemTransactionTable);
|
|
148224
|
-
const filter = and(softDeletedFilter(warehouseItemTransactionTable), eq(user.companyId, user2.companyId), ...query.product ? [logic_default8.getFilter(query.product, user2)] : [], eq(warehouseItemTransactionTable.transactionType, query.transactionType ?? "IN").if(query.transactionType), eq(warehouseItemTransactionTable.transactionKind, query.transactionKind ?? "TRANSFER").if(query.transactionKind), eq(warehouseItemTransactionTable.employeeId, query.employeeId ?? "").if(query.employeeId), eq(warehouseItemTransactionTable.userId, query.userId ?? "").if(query.userId), eq(warehouseItemTransactionTable.salesId, query.salesId ?? "").if(query.salesId), eq(warehouseItemTransactionTable.orderId, query.orderId ?? "").if(query.orderId), eq(warehouseItemTransactionTable.transferId, query.transferId ?? "").if(query.transferId), eq(warehouseItemTransactionTable.itemId, query.itemId ?? "").if(query.itemId), gte(warehouseItemTransactionTable.createdAt, query.dateFrom ?? "").if(query.dateFrom), lte(warehouseItemTransactionTable.createdAt, query.dateTo ?? "").if(query.dateTo), gte(warehouseItemTransactionTable.quantity, query.minQuantity ?? 0).if(query.minQuantity), lte(warehouseItemTransactionTable.quantity, query.maxQuantity ?? 0).if(query.maxQuantity), eq(warehouseItemTable.warehouseId, query.warehouseId).if(query.warehouseId));
|
|
148225
148245
|
const baseQuery = db_default.select({
|
|
148226
148246
|
...columns,
|
|
148227
148247
|
totalCount: totalCountSql,
|
|
@@ -148233,14 +148253,7 @@ var WarehouseItemLogic;
|
|
|
148233
148253
|
}
|
|
148234
148254
|
}).from(warehouseItemTransactionTable).where(filter).leftJoin(warehouseProductTable, eq(warehouseItemTransactionTable.productId, warehouseProductTable.id)).leftJoin(warehouseItemTable, eq(warehouseItemTransactionTable.itemId, warehouseItemTable.id)).leftJoin(user, eq(warehouseItemTransactionTable.userId, user.id)).orderBy(desc(warehouseItemTransactionTable.createdAt)).$dynamic();
|
|
148235
148255
|
const result = await pagination_helper_default(baseQuery, query.pagination);
|
|
148236
|
-
|
|
148237
|
-
totalCount: result[0]?.totalCount ?? 0,
|
|
148238
|
-
totalPage: result.length === 0 ? 0 : Math.ceil(result[0].totalCount / query.pagination.size)
|
|
148239
|
-
};
|
|
148240
|
-
return {
|
|
148241
|
-
result: result.map(({ totalCount, ...item }) => item),
|
|
148242
|
-
...content
|
|
148243
|
-
};
|
|
148256
|
+
return getPaginationContent(result, query.pagination.size);
|
|
148244
148257
|
};
|
|
148245
148258
|
WarehouseItemLogic.changeQuantity = async ({
|
|
148246
148259
|
itemId,
|
|
@@ -148248,16 +148261,16 @@ var WarehouseItemLogic;
|
|
|
148248
148261
|
transactionDetails
|
|
148249
148262
|
}, user2, tdb = db_default) => {
|
|
148250
148263
|
if (!user2.employeeId) {
|
|
148251
|
-
return status("Bad Request",
|
|
148264
|
+
return status("Bad Request", ERRORS.EMPLOYEE_REQUIRED);
|
|
148252
148265
|
}
|
|
148253
148266
|
const [currentItem] = await tdb.select().from(warehouseItemTable).where(eq(warehouseItemTable.id, itemId)).limit(1);
|
|
148254
148267
|
if (!currentItem) {
|
|
148255
|
-
return status("Not Found",
|
|
148268
|
+
return status("Not Found", ERRORS.ITEM_NOT_FOUND);
|
|
148256
148269
|
}
|
|
148257
148270
|
const quantityBefore = currentItem.quantity;
|
|
148258
148271
|
const quantityAfter = quantityBefore + quantityChange;
|
|
148259
148272
|
if (transactionDetails.transactionType === "OUT" && quantityAfter < 0) {
|
|
148260
|
-
return status("Bad Request",
|
|
148273
|
+
return status("Bad Request", ERRORS.INSUFFICIENT_STOCK);
|
|
148261
148274
|
}
|
|
148262
148275
|
const [updatedItem] = await tdb.update(warehouseItemTable).set({
|
|
148263
148276
|
quantity: quantityAfter,
|
|
@@ -152148,8 +152161,9 @@ var DiscountLogic;
|
|
|
152148
152161
|
DiscountLogic.selectAppliesByCpOrderId = async (cpOrderId) => {
|
|
152149
152162
|
const appliedDiscounts = await db_default.select({
|
|
152150
152163
|
apply: crmDiscountApplyTable,
|
|
152151
|
-
discount: crmDiscountTable
|
|
152152
|
-
|
|
152164
|
+
discount: crmDiscountTable,
|
|
152165
|
+
item: crmCpOrderItemTable
|
|
152166
|
+
}).from(crmDiscountApplyTable).leftJoin(crmDiscountTable, eq(crmDiscountTable.id, crmDiscountApplyTable.discountId)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.id, crmDiscountApplyTable.cpOrderItemId)).where(Array.isArray(cpOrderId) ? inArray(crmDiscountApplyTable.cpOrderId, cpOrderId) : eq(crmDiscountApplyTable.cpOrderId, cpOrderId)).orderBy(crmDiscountApplyTable.createdAt);
|
|
152153
152167
|
return appliedDiscounts;
|
|
152154
152168
|
};
|
|
152155
152169
|
DiscountLogic.create = async (body, user2) => {
|
|
@@ -152765,35 +152779,45 @@ var customer_default = customerRoutes;
|
|
|
152765
152779
|
// src/routes/crm/dashboard/logic.ts
|
|
152766
152780
|
var CrmDashboardLogic;
|
|
152767
152781
|
((CrmDashboardLogic) => {
|
|
152768
|
-
|
|
152782
|
+
const buildCommonFilter = (user2, query) => {
|
|
152783
|
+
const filters = [
|
|
152784
|
+
eq(crmCpOrderTable.companyId, user2.companyId),
|
|
152785
|
+
eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER")
|
|
152786
|
+
];
|
|
152787
|
+
if (query?.branchId && user2.kind !== "CUSTOMER") {
|
|
152788
|
+
filters.push(eq(crmCpOrderTable.companyBranchId, query.branchId));
|
|
152789
|
+
}
|
|
152790
|
+
return and(...filters);
|
|
152791
|
+
};
|
|
152792
|
+
CrmDashboardLogic.getCarCount = async (user2, query) => {
|
|
152769
152793
|
const result = await db_default.select({
|
|
152770
152794
|
count: sql3`count(distinct ${crmCpOrderTable.vehicleId})`.mapWith(Number),
|
|
152771
152795
|
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
|
152772
|
-
}).from(crmCpOrderTable).where(and(
|
|
152796
|
+
}).from(crmCpOrderTable).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - INTERVAL '1 month'`)).groupBy((t2) => t2.month);
|
|
152773
152797
|
return result;
|
|
152774
152798
|
};
|
|
152775
|
-
CrmDashboardLogic.getCpOrderCount = async (user2) => {
|
|
152799
|
+
CrmDashboardLogic.getCpOrderCount = async (user2, query) => {
|
|
152776
152800
|
const result = await db_default.select({
|
|
152777
152801
|
count: sql3`count(${crmCpOrderTable.id})`.mapWith(Number),
|
|
152778
152802
|
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
|
152779
|
-
}).from(crmCpOrderTable).where(and(
|
|
152803
|
+
}).from(crmCpOrderTable).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).groupBy((t2) => t2.month);
|
|
152780
152804
|
return result;
|
|
152781
152805
|
};
|
|
152782
|
-
CrmDashboardLogic.getCpOrderServiceCount = async (user2) => {
|
|
152806
|
+
CrmDashboardLogic.getCpOrderServiceCount = async (user2, query) => {
|
|
152783
152807
|
const result = await db_default.select({
|
|
152784
152808
|
count: sql3`count(${crmCpOrderTable.id})`.mapWith(Number),
|
|
152785
152809
|
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
|
152786
|
-
}).from(crmCpOrderTable).where(and(
|
|
152810
|
+
}).from(crmCpOrderTable).where(and(buildCommonFilter(user2, query), eq(crmCpOrderTable.type, "Service"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).groupBy((t2) => t2.month);
|
|
152787
152811
|
return result;
|
|
152788
152812
|
};
|
|
152789
|
-
CrmDashboardLogic.getCpOrderTotalAmount = async (user2) => {
|
|
152813
|
+
CrmDashboardLogic.getCpOrderTotalAmount = async (user2, query) => {
|
|
152790
152814
|
const result = await db_default.select({
|
|
152791
152815
|
amount: sum(crmCpOrderItemTable.priceTotal).mapWith(Number),
|
|
152792
152816
|
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
|
152793
|
-
}).from(crmCpOrderTable).where(and(
|
|
152817
|
+
}).from(crmCpOrderTable).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.month);
|
|
152794
152818
|
return result;
|
|
152795
152819
|
};
|
|
152796
|
-
CrmDashboardLogic.getMostSelledProduct = async (user2) => {
|
|
152820
|
+
CrmDashboardLogic.getMostSelledProduct = async (user2, query) => {
|
|
152797
152821
|
const result = await db_default.select({
|
|
152798
152822
|
quantity: sum(crmCpOrderItemTable.quantity).mapWith(Number),
|
|
152799
152823
|
product: {
|
|
@@ -152801,46 +152825,71 @@ var CrmDashboardLogic;
|
|
|
152801
152825
|
name: warehouseProductTable.name,
|
|
152802
152826
|
partNumber: warehouseProductTable.partNumber
|
|
152803
152827
|
}
|
|
152804
|
-
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).where(and(
|
|
152828
|
+
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE)`, sql3`${crmCpOrderTable.createdAt} < date_trunc('month', CURRENT_DATE) + interval '1 month'`)).orderBy((t2) => desc(t2.quantity)).groupBy(warehouseProductTable.id, warehouseProductTable.name, warehouseProductTable.partNumber).limit(5);
|
|
152805
152829
|
return result;
|
|
152806
152830
|
};
|
|
152807
|
-
CrmDashboardLogic.getMostSelledService = async (user2) => {
|
|
152831
|
+
CrmDashboardLogic.getMostSelledService = async (user2, query) => {
|
|
152808
152832
|
const result = await db_default.select({
|
|
152809
152833
|
quantity: sum(crmCpOrderItemTable.quantity).mapWith(Number),
|
|
152810
152834
|
service: {
|
|
152811
152835
|
id: companyServiceKindTable.id,
|
|
152812
152836
|
name: companyServiceKindTable.name
|
|
152813
152837
|
}
|
|
152814
|
-
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).where(and(
|
|
152838
|
+
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE)`, sql3`${crmCpOrderTable.createdAt} < date_trunc('month', CURRENT_DATE) + interval '1 month'`)).orderBy((t2) => desc(t2.quantity)).groupBy(companyServiceKindTable.id, companyServiceKindTable.name).limit(5);
|
|
152815
152839
|
return result;
|
|
152816
152840
|
};
|
|
152817
|
-
CrmDashboardLogic.getMostSelledVehicleKind = async (user2) => {
|
|
152841
|
+
CrmDashboardLogic.getMostSelledVehicleKind = async (user2, query) => {
|
|
152818
152842
|
const result = await db_default.select({
|
|
152819
152843
|
quantity: count(crmCpOrderTable.id).mapWith(Number),
|
|
152820
152844
|
vehicleKind: {
|
|
152821
152845
|
id: techdocVehicleKindTable.id,
|
|
152822
152846
|
name: techdocVehicleKindTable.name
|
|
152823
152847
|
}
|
|
152824
|
-
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).innerJoin(techdocVehicleKindTable, eq(techdocVehicleKindTable.id, crmVehicleTable.vehicleKindId)).where(and(
|
|
152848
|
+
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(crmVehicleTable, eq(crmVehicleTable.id, crmCpOrderTable.vehicleId)).innerJoin(techdocVehicleKindTable, eq(techdocVehicleKindTable.id, crmVehicleTable.vehicleKindId)).where(and(buildCommonFilter(user2, query), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE)`, sql3`${crmCpOrderTable.createdAt} < date_trunc('month', CURRENT_DATE) + interval '1 month'`)).orderBy((t2) => desc(t2.quantity)).groupBy(techdocVehicleKindTable.id, techdocVehicleKindTable.name).limit(5);
|
|
152825
152849
|
return result;
|
|
152826
152850
|
};
|
|
152827
|
-
CrmDashboardLogic.getCpOrderTotalAmountByDay = async (user2) => {
|
|
152851
|
+
CrmDashboardLogic.getCpOrderTotalAmountByDay = async (user2, query) => {
|
|
152828
152852
|
const result = await db_default.select({
|
|
152829
152853
|
amount: sum(crmCpOrderItemTable.priceTotal).mapWith(Number),
|
|
152830
152854
|
date: sql3`date_trunc('day', ${crmCpOrderTable.createdAt})`.as("day")
|
|
152831
|
-
}).from(crmCpOrderTable).where(and(
|
|
152855
|
+
}).from(crmCpOrderTable).where(and(buildCommonFilter(user2, query), 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);
|
|
152832
152856
|
return result;
|
|
152833
152857
|
};
|
|
152834
152858
|
})(CrmDashboardLogic ||= {});
|
|
152835
152859
|
var logic_default19 = CrmDashboardLogic;
|
|
152836
152860
|
|
|
152861
|
+
// src/routes/crm/dashboard/model.ts
|
|
152862
|
+
var CrmDashboardModel;
|
|
152863
|
+
((CrmDashboardModel) => {
|
|
152864
|
+
CrmDashboardModel.baseQuery = t.Partial(t.Object({
|
|
152865
|
+
branchId: t.String({ format: "uuid" })
|
|
152866
|
+
}));
|
|
152867
|
+
})(CrmDashboardModel ||= {});
|
|
152868
|
+
var model_default15 = CrmDashboardModel;
|
|
152869
|
+
|
|
152837
152870
|
// src/routes/crm/dashboard/index.ts
|
|
152838
152871
|
var dashboardRoutes = new Elysia({
|
|
152839
152872
|
prefix: "/dashboard",
|
|
152840
152873
|
tags: ["CrmDashboard"]
|
|
152841
152874
|
}).use(better_auth_default).guard({
|
|
152842
152875
|
auth: true
|
|
152843
|
-
}).get("/car-count", async ({ user: user2
|
|
152876
|
+
}).get("/car-count", async ({ user: user2, query }) => logic_default19.getCarCount(user2, query), {
|
|
152877
|
+
query: model_default15.baseQuery
|
|
152878
|
+
}).get("/cp-order-count", async ({ user: user2, query }) => logic_default19.getCpOrderCount(user2, query), {
|
|
152879
|
+
query: model_default15.baseQuery
|
|
152880
|
+
}).get("/cp-order-service-count", async ({ user: user2, query }) => logic_default19.getCpOrderServiceCount(user2, query), {
|
|
152881
|
+
query: model_default15.baseQuery
|
|
152882
|
+
}).get("/cp-order-total-amount", async ({ user: user2, query }) => logic_default19.getCpOrderTotalAmount(user2, query), {
|
|
152883
|
+
query: model_default15.baseQuery
|
|
152884
|
+
}).get("/most-sold-products", async ({ user: user2, query }) => logic_default19.getMostSelledProduct(user2, query), {
|
|
152885
|
+
query: model_default15.baseQuery
|
|
152886
|
+
}).get("/most-sold-services", async ({ user: user2, query }) => logic_default19.getMostSelledService(user2, query), {
|
|
152887
|
+
query: model_default15.baseQuery
|
|
152888
|
+
}).get("/most-sold-vehicles", async ({ user: user2, query }) => logic_default19.getMostSelledVehicleKind(user2, query), {
|
|
152889
|
+
query: model_default15.baseQuery
|
|
152890
|
+
}).get("/daily-sales", async ({ user: user2, query }) => logic_default19.getCpOrderTotalAmountByDay(user2, query), {
|
|
152891
|
+
query: model_default15.baseQuery
|
|
152892
|
+
});
|
|
152844
152893
|
var dashboard_default = dashboardRoutes;
|
|
152845
152894
|
|
|
152846
152895
|
// src/routes/crm/discount/model.ts
|
|
@@ -152929,7 +152978,7 @@ var DiscountModel;
|
|
|
152929
152978
|
const updateApplySchema = createUpdateSchema(crmDiscountApplyTable);
|
|
152930
152979
|
DiscountModel.updateApply = OmitBaseSchema(updateApplySchema);
|
|
152931
152980
|
})(DiscountModel ||= {});
|
|
152932
|
-
var
|
|
152981
|
+
var model_default16 = DiscountModel;
|
|
152933
152982
|
|
|
152934
152983
|
// src/routes/crm/discount/index.ts
|
|
152935
152984
|
var discountRoutes = new Elysia({
|
|
@@ -152938,25 +152987,25 @@ var discountRoutes = new Elysia({
|
|
|
152938
152987
|
auth: true,
|
|
152939
152988
|
tags: ["Discount"]
|
|
152940
152989
|
}).get("/", async ({ query, user: user2 }) => logic_default16.select(query, user2), {
|
|
152941
|
-
query:
|
|
152990
|
+
query: model_default16.select
|
|
152942
152991
|
}).post("/", async ({ body, user: user2 }) => logic_default16.create(body, user2), {
|
|
152943
|
-
body:
|
|
152992
|
+
body: model_default16.create
|
|
152944
152993
|
}).put("/:id", async ({ body, user: user2, params: { id } }) => logic_default16.update(id, body, user2), {
|
|
152945
|
-
body:
|
|
152994
|
+
body: model_default16.update,
|
|
152946
152995
|
params: IdSchema
|
|
152947
152996
|
}).delete("/:id", async ({ user: user2, params: { id } }) => logic_default16.remove(id, user2), {
|
|
152948
152997
|
params: IdSchema
|
|
152949
152998
|
}).post("/condition", async ({ body, user: user2 }) => logic_default16.createCondition(body, user2), {
|
|
152950
|
-
body:
|
|
152999
|
+
body: model_default16.createCondition
|
|
152951
153000
|
}).put("/condition/:id", async ({ body, user: user2, params: { id } }) => logic_default16.updateCondition(id, body, user2), {
|
|
152952
|
-
body:
|
|
153001
|
+
body: model_default16.updateCondition,
|
|
152953
153002
|
params: IdSchema
|
|
152954
153003
|
}).delete("/condition/:id", async ({ user: user2, params: { id } }) => logic_default16.removeCondition(id, user2), {
|
|
152955
153004
|
params: IdSchema
|
|
152956
153005
|
}).post("/apply", async ({ body, user: user2 }) => logic_default16.createApply(body, user2), {
|
|
152957
|
-
body:
|
|
153006
|
+
body: model_default16.createApply
|
|
152958
153007
|
}).put("/apply/:id", async ({ body, user: user2, params: { id } }) => logic_default16.updateApply(id, body, user2), {
|
|
152959
|
-
body:
|
|
153008
|
+
body: model_default16.updateApply,
|
|
152960
153009
|
params: IdSchema
|
|
152961
153010
|
}).delete("/apply/:id", async ({ params: { id } }) => logic_default16.removeApply(id), {
|
|
152962
153011
|
params: IdSchema
|
|
@@ -153192,21 +153241,21 @@ var CrmInspectionModel;
|
|
|
153192
153241
|
PaginationSchema
|
|
153193
153242
|
]);
|
|
153194
153243
|
})(CrmInspectionModel ||= {});
|
|
153195
|
-
var
|
|
153244
|
+
var model_default17 = CrmInspectionModel;
|
|
153196
153245
|
|
|
153197
153246
|
// src/routes/crm/inspection/index.ts
|
|
153198
153247
|
var inspectionRoutes = new Elysia({
|
|
153199
153248
|
prefix: "/inspection",
|
|
153200
153249
|
tags: ["CrmInspection"]
|
|
153201
153250
|
}).use(better_auth_default).get("/ubcab", async ({ query: { licensePlate } }) => logic_default20.selectUbCab(licensePlate), {
|
|
153202
|
-
query:
|
|
153251
|
+
query: model_default17.selectUbCab,
|
|
153203
153252
|
auth: false
|
|
153204
153253
|
}).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default20.select(query, user2), {
|
|
153205
|
-
query:
|
|
153254
|
+
query: model_default17.select
|
|
153206
153255
|
}).post("/", async ({ body, user: user2 }) => logic_default20.create(body, user2), {
|
|
153207
|
-
body:
|
|
153256
|
+
body: model_default17.create
|
|
153208
153257
|
}).get("/admin", async ({ query }) => logic_default20.selectAdmin(query), {
|
|
153209
|
-
query:
|
|
153258
|
+
query: model_default17.selectAdmin,
|
|
153210
153259
|
userKind: "ADMIN"
|
|
153211
153260
|
}).guard({
|
|
153212
153261
|
params: IdSchema
|
|
@@ -153654,7 +153703,7 @@ var CrmReportsModel;
|
|
|
153654
153703
|
PaginationSchema
|
|
153655
153704
|
]);
|
|
153656
153705
|
})(CrmReportsModel ||= {});
|
|
153657
|
-
var
|
|
153706
|
+
var model_default18 = CrmReportsModel;
|
|
153658
153707
|
|
|
153659
153708
|
// src/routes/crm/reports/index.ts
|
|
153660
153709
|
var reportsRoutes = new Elysia({
|
|
@@ -153663,52 +153712,52 @@ var reportsRoutes = new Elysia({
|
|
|
153663
153712
|
}).use(better_auth_default).guard({
|
|
153664
153713
|
auth: true
|
|
153665
153714
|
}).get("/sales", async ({ query, user: user2 }) => logic_default21.salesReport(query, user2), {
|
|
153666
|
-
query:
|
|
153715
|
+
query: model_default18.salesReportQuery
|
|
153667
153716
|
}).get("/sales/summary", async ({ query, user: user2 }) => logic_default21.salesSummary(query, user2), {
|
|
153668
|
-
query:
|
|
153717
|
+
query: model_default18.salesSummaryQuery
|
|
153669
153718
|
}).get("/sales/by-period", async ({ query, user: user2 }) => logic_default21.salesByPeriod(query, user2), {
|
|
153670
|
-
query:
|
|
153719
|
+
query: model_default18.salesByPeriodQuery
|
|
153671
153720
|
}).get("/sales/by-employee", async ({ query, user: user2 }) => logic_default21.salesByEmployee(query, user2), {
|
|
153672
|
-
query:
|
|
153721
|
+
query: model_default18.salesByEmployeeQuery
|
|
153673
153722
|
}).get("/payments", async ({ query, user: user2 }) => logic_default21.paymentsReport(query, user2), {
|
|
153674
|
-
query:
|
|
153723
|
+
query: model_default18.paymentsReportQuery
|
|
153675
153724
|
}).get("/sales/csv", async ({ query, user: user2, set: set2 }) => {
|
|
153676
153725
|
const csvData = await logic_default21.exportSalesCSV(query, user2);
|
|
153677
153726
|
set2.headers["Content-Type"] = "text/csv";
|
|
153678
153727
|
set2.headers["Content-Disposition"] = 'attachment; filename="sales-report.csv"';
|
|
153679
153728
|
return csvData;
|
|
153680
153729
|
}, {
|
|
153681
|
-
query:
|
|
153730
|
+
query: model_default18.csvExportQuery
|
|
153682
153731
|
}).get("/sales/summary/csv", async ({ query, user: user2, set: set2 }) => {
|
|
153683
153732
|
const csvData = await logic_default21.exportSalesSummaryCSV(query, user2);
|
|
153684
153733
|
set2.headers["Content-Type"] = "text/csv";
|
|
153685
153734
|
set2.headers["Content-Disposition"] = 'attachment; filename="sales-summary.csv"';
|
|
153686
153735
|
return csvData;
|
|
153687
153736
|
}, {
|
|
153688
|
-
query:
|
|
153737
|
+
query: model_default18.baseDateFilter
|
|
153689
153738
|
}).get("/sales/by-period/csv", async ({ query, user: user2, set: set2 }) => {
|
|
153690
153739
|
const csvData = await logic_default21.exportSalesByPeriodCSV(query, user2);
|
|
153691
153740
|
set2.headers["Content-Type"] = "text/csv";
|
|
153692
153741
|
set2.headers["Content-Disposition"] = 'attachment; filename="sales-by-period.csv"';
|
|
153693
153742
|
return csvData;
|
|
153694
153743
|
}, {
|
|
153695
|
-
query:
|
|
153744
|
+
query: model_default18.salesByPeriodQuery
|
|
153696
153745
|
}).get("/sales/by-employee/csv", async ({ query, user: user2, set: set2 }) => {
|
|
153697
153746
|
const csvData = await logic_default21.exportSalesByEmployeeCSV(query, user2);
|
|
153698
153747
|
set2.headers["Content-Type"] = "text/csv";
|
|
153699
153748
|
set2.headers["Content-Disposition"] = 'attachment; filename="sales-by-employee.csv"';
|
|
153700
153749
|
return csvData;
|
|
153701
153750
|
}, {
|
|
153702
|
-
query:
|
|
153751
|
+
query: model_default18.csvExportQuery
|
|
153703
153752
|
}).get("/payments/csv", async ({ query, user: user2, set: set2 }) => {
|
|
153704
153753
|
const csvData = await logic_default21.exportPaymentsCSV(query, user2);
|
|
153705
153754
|
set2.headers["Content-Type"] = "text/csv";
|
|
153706
153755
|
set2.headers["Content-Disposition"] = 'attachment; filename="payments-report.csv"';
|
|
153707
153756
|
return csvData;
|
|
153708
153757
|
}, {
|
|
153709
|
-
query:
|
|
153758
|
+
query: model_default18.csvExportQuery
|
|
153710
153759
|
}).get("/cp-order", ({ query, user: user2 }) => logic_default21.cpOrderReport(query, user2), {
|
|
153711
|
-
query:
|
|
153760
|
+
query: model_default18.cpOrderReport
|
|
153712
153761
|
});
|
|
153713
153762
|
var reports_default = reportsRoutes;
|
|
153714
153763
|
|
|
@@ -153725,7 +153774,7 @@ var CrmSpPackageModel;
|
|
|
153725
153774
|
t.Partial(t.Pick(selectSchema, ["name", "priceTotal", "companyBranchId", "id"]))
|
|
153726
153775
|
]);
|
|
153727
153776
|
})(CrmSpPackageModel ||= {});
|
|
153728
|
-
var
|
|
153777
|
+
var model_default19 = CrmSpPackageModel;
|
|
153729
153778
|
|
|
153730
153779
|
// src/routes/crm/spPackage/product/logic.ts
|
|
153731
153780
|
var CrmSpPackageProductLogic;
|
|
@@ -153783,7 +153832,7 @@ var CrmSpPackageProductModel;
|
|
|
153783
153832
|
CrmSpPackageProductModel.update = OmitBaseSchema(updateSchema);
|
|
153784
153833
|
CrmSpPackageProductModel.select = t.Pick(selectSchema, ["spPackageId"]);
|
|
153785
153834
|
})(CrmSpPackageProductModel ||= {});
|
|
153786
|
-
var
|
|
153835
|
+
var model_default20 = CrmSpPackageProductModel;
|
|
153787
153836
|
|
|
153788
153837
|
// src/routes/crm/spPackage/product/index.ts
|
|
153789
153838
|
var productRoutes = new Elysia({
|
|
@@ -153792,15 +153841,15 @@ var productRoutes = new Elysia({
|
|
|
153792
153841
|
}).use(better_auth_default).guard({
|
|
153793
153842
|
auth: true
|
|
153794
153843
|
}).get("/", async ({ query }) => logic_default22.select(query), {
|
|
153795
|
-
query:
|
|
153844
|
+
query: model_default20.select
|
|
153796
153845
|
}).post("/", async ({ body }) => logic_default22.create(body), {
|
|
153797
|
-
body:
|
|
153846
|
+
body: model_default20.create
|
|
153798
153847
|
}).post("/many", async ({ body }) => logic_default22.createMany(body), {
|
|
153799
|
-
body: t.Array(
|
|
153848
|
+
body: t.Array(model_default20.create)
|
|
153800
153849
|
}).guard({
|
|
153801
153850
|
params: IdSchema
|
|
153802
153851
|
}).put("/:id", async ({ params, body }) => logic_default22.update(params.id, body), {
|
|
153803
|
-
body:
|
|
153852
|
+
body: model_default20.update
|
|
153804
153853
|
}).delete("/:id", async ({ params }) => logic_default22.remove(params.id));
|
|
153805
153854
|
var product_default = productRoutes;
|
|
153806
153855
|
|
|
@@ -153856,7 +153905,7 @@ var CrmSpPackageServiceModel;
|
|
|
153856
153905
|
CrmSpPackageServiceModel.update = OmitBaseSchema(updateSchema);
|
|
153857
153906
|
CrmSpPackageServiceModel.select = t.Pick(selectSchema, ["spPackageId"]);
|
|
153858
153907
|
})(CrmSpPackageServiceModel ||= {});
|
|
153859
|
-
var
|
|
153908
|
+
var model_default21 = CrmSpPackageServiceModel;
|
|
153860
153909
|
|
|
153861
153910
|
// src/routes/crm/spPackage/service/index.ts
|
|
153862
153911
|
var serviceRoutes = new Elysia({
|
|
@@ -153865,15 +153914,15 @@ var serviceRoutes = new Elysia({
|
|
|
153865
153914
|
}).use(better_auth_default).guard({
|
|
153866
153915
|
auth: true
|
|
153867
153916
|
}).get("/", async ({ query }) => logic_default23.select(query), {
|
|
153868
|
-
query:
|
|
153917
|
+
query: model_default21.select
|
|
153869
153918
|
}).post("/", async ({ body }) => logic_default23.create(body), {
|
|
153870
|
-
body:
|
|
153919
|
+
body: model_default21.create
|
|
153871
153920
|
}).post("/many", async ({ body }) => logic_default23.createMany(body), {
|
|
153872
|
-
body: t.Array(
|
|
153921
|
+
body: t.Array(model_default21.create)
|
|
153873
153922
|
}).guard({
|
|
153874
153923
|
params: IdSchema
|
|
153875
153924
|
}).put("/:id", async ({ params, body }) => logic_default23.update(params.id, body), {
|
|
153876
|
-
body:
|
|
153925
|
+
body: model_default21.update
|
|
153877
153926
|
}).delete("/:id", async ({ params }) => logic_default23.remove(params.id));
|
|
153878
153927
|
var service_default = serviceRoutes;
|
|
153879
153928
|
|
|
@@ -153884,12 +153933,12 @@ var spPackageRoutes = new Elysia({
|
|
|
153884
153933
|
}).use(better_auth_default).use(service_default).use(product_default).guard({
|
|
153885
153934
|
auth: true
|
|
153886
153935
|
}).get("/", async ({ query, user: user2 }) => logic_default12.select(query, user2), {
|
|
153887
|
-
query:
|
|
153936
|
+
query: model_default19.select
|
|
153888
153937
|
}).post("/", async ({ body, user: user2 }) => logic_default12.create(body, user2), {
|
|
153889
|
-
body:
|
|
153938
|
+
body: model_default19.create
|
|
153890
153939
|
}).guard({
|
|
153891
153940
|
params: IdSchema
|
|
153892
|
-
}).put("/:id", async ({ body, user: user2, params }) => logic_default12.update(params.id, body, user2), { body:
|
|
153941
|
+
}).put("/:id", async ({ body, user: user2, params }) => logic_default12.update(params.id, body, user2), { body: model_default19.update }).delete("/:id", async ({ user: user2, params: { id } }) => logic_default12.remove(id, user2));
|
|
153893
153942
|
var spPackage_default = spPackageRoutes;
|
|
153894
153943
|
|
|
153895
153944
|
// src/routes/crm/vehicle/model.ts
|
|
@@ -153912,7 +153961,7 @@ var CrmVehicleModel;
|
|
|
153912
153961
|
}))
|
|
153913
153962
|
]);
|
|
153914
153963
|
})(CrmVehicleModel ||= {});
|
|
153915
|
-
var
|
|
153964
|
+
var model_default22 = CrmVehicleModel;
|
|
153916
153965
|
|
|
153917
153966
|
// src/routes/crm/vehicle/index.ts
|
|
153918
153967
|
var vehicleRoutes = new Elysia({
|
|
@@ -153951,13 +154000,13 @@ var vehicleRoutes = new Elysia({
|
|
|
153951
154000
|
auth: true,
|
|
153952
154001
|
tags: ["Vehicle"]
|
|
153953
154002
|
}).get("/", async ({ query, user: user2 }) => logic_default14.select(query, user2), {
|
|
153954
|
-
query:
|
|
154003
|
+
query: model_default22.select
|
|
153955
154004
|
}).post("/", async ({ body, user: user2 }) => logic_default14.create(body, user2), {
|
|
153956
|
-
body:
|
|
154005
|
+
body: model_default22.create
|
|
153957
154006
|
}).guard({
|
|
153958
154007
|
params: IdSchema
|
|
153959
154008
|
}).get("/:id", async ({ params, user: user2 }) => logic_default14.selectById(params.id, user2)).put("/:id", async ({ params, body, user: user2 }) => logic_default14.update(params.id, body, user2), {
|
|
153960
|
-
body:
|
|
154009
|
+
body: model_default22.update
|
|
153961
154010
|
}).delete("/:id", async ({ params, user: user2 }) => logic_default14.remove(params.id, user2)));
|
|
153962
154011
|
var vehicle_default = vehicleRoutes;
|
|
153963
154012
|
|
|
@@ -153996,7 +154045,7 @@ var InspectionFieldModel;
|
|
|
153996
154045
|
InspectionFieldModel.create = OmitBaseSchema(createSchema);
|
|
153997
154046
|
InspectionFieldModel.update = OmitBaseSchema(updateSchema);
|
|
153998
154047
|
})(InspectionFieldModel ||= {});
|
|
153999
|
-
var
|
|
154048
|
+
var model_default23 = InspectionFieldModel;
|
|
154000
154049
|
|
|
154001
154050
|
// src/routes/fleet/inspection/field/index.ts
|
|
154002
154051
|
var fieldRoutes = new Elysia({
|
|
@@ -154005,11 +154054,11 @@ var fieldRoutes = new Elysia({
|
|
|
154005
154054
|
}).use(better_auth_default).guard({
|
|
154006
154055
|
userKind: "ADMIN"
|
|
154007
154056
|
}).post("/", async ({ body }) => logic_default24.create(body), {
|
|
154008
|
-
body:
|
|
154057
|
+
body: model_default23.create
|
|
154009
154058
|
}).guard({
|
|
154010
154059
|
params: IdSchema
|
|
154011
154060
|
}).put("/:id", async ({ body, params: { id } }) => logic_default24.update(id, body), {
|
|
154012
|
-
body:
|
|
154061
|
+
body: model_default23.update
|
|
154013
154062
|
}).delete("/:id", async ({ params: { id } }) => logic_default24.remove(id));
|
|
154014
154063
|
var field_default = fieldRoutes;
|
|
154015
154064
|
|
|
@@ -154062,7 +154111,7 @@ var InspectionFieldGroupModel;
|
|
|
154062
154111
|
PaginationSchema
|
|
154063
154112
|
]);
|
|
154064
154113
|
})(InspectionFieldGroupModel ||= {});
|
|
154065
|
-
var
|
|
154114
|
+
var model_default24 = InspectionFieldGroupModel;
|
|
154066
154115
|
|
|
154067
154116
|
// src/routes/fleet/inspection/fieldGroup/index.ts
|
|
154068
154117
|
var fieldGroupRoutes = new Elysia({
|
|
@@ -154071,15 +154120,15 @@ var fieldGroupRoutes = new Elysia({
|
|
|
154071
154120
|
}).use(better_auth_default).guard({
|
|
154072
154121
|
userKind: "ADMIN"
|
|
154073
154122
|
}).get("/", async ({ query }) => logic_default25.select(query), {
|
|
154074
|
-
query:
|
|
154123
|
+
query: model_default24.select,
|
|
154075
154124
|
userKind: undefined,
|
|
154076
154125
|
auth: true
|
|
154077
154126
|
}).post("/", async ({ body }) => logic_default25.create(body), {
|
|
154078
|
-
body:
|
|
154127
|
+
body: model_default24.create
|
|
154079
154128
|
}).guard({
|
|
154080
154129
|
params: IdSchema
|
|
154081
154130
|
}).put("/:id", async ({ body, params: { id } }) => logic_default25.update(id, body), {
|
|
154082
|
-
body:
|
|
154131
|
+
body: model_default24.update
|
|
154083
154132
|
}).delete("/:id", async ({ params: { id } }) => logic_default25.remove(id)).get("/:id/field", async ({ params: { id } }) => logic_default24.select(id));
|
|
154084
154133
|
var fieldGroup_default = fieldGroupRoutes;
|
|
154085
154134
|
|
|
@@ -154160,16 +154209,16 @@ var InspectionFieldResultModel;
|
|
|
154160
154209
|
})
|
|
154161
154210
|
]);
|
|
154162
154211
|
})(InspectionFieldResultModel ||= {});
|
|
154163
|
-
var
|
|
154212
|
+
var model_default25 = InspectionFieldResultModel;
|
|
154164
154213
|
|
|
154165
154214
|
// src/routes/fleet/inspection/fieldResult/index.ts
|
|
154166
154215
|
var fieldResultRoutes = new Elysia({
|
|
154167
154216
|
prefix: "/field-result",
|
|
154168
154217
|
tags: ["InspectionFieldResult"]
|
|
154169
154218
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default26.select(query), {
|
|
154170
|
-
query:
|
|
154219
|
+
query: model_default25.select
|
|
154171
154220
|
}).post("/create-or-update", async ({ body }) => logic_default26.createOrUpdate(body), {
|
|
154172
|
-
body:
|
|
154221
|
+
body: model_default25.createOrUpdate
|
|
154173
154222
|
}).guard({
|
|
154174
154223
|
params: IdSchema
|
|
154175
154224
|
}).delete("/inspection/:id/all", async ({ params: { id } }) => logic_default26.removeAll(id));
|
|
@@ -154244,7 +154293,7 @@ var InspectionModel;
|
|
|
154244
154293
|
}))
|
|
154245
154294
|
]);
|
|
154246
154295
|
})(InspectionModel ||= {});
|
|
154247
|
-
var
|
|
154296
|
+
var model_default26 = InspectionModel;
|
|
154248
154297
|
|
|
154249
154298
|
// src/routes/fleet/inspection/schedule/logic.ts
|
|
154250
154299
|
var InspectionScheduleLogic;
|
|
@@ -154285,18 +154334,18 @@ var InspectionScheduleModel;
|
|
|
154285
154334
|
InspectionScheduleModel.update = OmitBaseSchema(updateSchema);
|
|
154286
154335
|
InspectionScheduleModel.select = t.Composite([PaginationSchema]);
|
|
154287
154336
|
})(InspectionScheduleModel ||= {});
|
|
154288
|
-
var
|
|
154337
|
+
var model_default27 = InspectionScheduleModel;
|
|
154289
154338
|
|
|
154290
154339
|
// src/routes/fleet/inspection/schedule/index.ts
|
|
154291
154340
|
var scheduleRoutes = new Elysia({
|
|
154292
154341
|
prefix: "/schedule"
|
|
154293
154342
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default28.select(query, user2), {
|
|
154294
|
-
query:
|
|
154343
|
+
query: model_default27.select
|
|
154295
154344
|
}).post("/", async ({ body, user: user2 }) => logic_default28.create(body, user2), {
|
|
154296
|
-
body:
|
|
154345
|
+
body: model_default27.create
|
|
154297
154346
|
}).guard({
|
|
154298
154347
|
params: IdSchema
|
|
154299
|
-
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default28.update(id, body, user2), { body:
|
|
154348
|
+
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default28.update(id, body, user2), { body: model_default27.update }).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default28.remove(id, user2));
|
|
154300
154349
|
var schedule_default = scheduleRoutes;
|
|
154301
154350
|
|
|
154302
154351
|
// src/routes/fleet/inspection/template/logic.ts
|
|
@@ -154378,7 +154427,7 @@ var InspectionTemplateModel;
|
|
|
154378
154427
|
]);
|
|
154379
154428
|
InspectionTemplateModel.updateField = OmitBaseSchema(updateFieldSchema);
|
|
154380
154429
|
})(InspectionTemplateModel ||= {});
|
|
154381
|
-
var
|
|
154430
|
+
var model_default28 = InspectionTemplateModel;
|
|
154382
154431
|
|
|
154383
154432
|
// src/routes/fleet/inspection/template/index.ts
|
|
154384
154433
|
var templateRoutes = new Elysia({
|
|
@@ -154387,17 +154436,17 @@ var templateRoutes = new Elysia({
|
|
|
154387
154436
|
}).use(better_auth_default).guard({
|
|
154388
154437
|
userKind: "COMPANY_ADMIN"
|
|
154389
154438
|
}).get("/", async ({ query, user: user2 }) => logic_default29.select(query, user2), {
|
|
154390
|
-
query:
|
|
154439
|
+
query: model_default28.select
|
|
154391
154440
|
}).post("/", async ({ body, user: user2 }) => logic_default29.create(body, user2), {
|
|
154392
|
-
body:
|
|
154441
|
+
body: model_default28.create
|
|
154393
154442
|
}).guard({
|
|
154394
154443
|
params: IdSchema
|
|
154395
154444
|
}).get("/:id", async ({ params: { id }, user: user2 }) => logic_default29.selectById(id, user2)).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default29.update(id, body, user2), {
|
|
154396
|
-
body:
|
|
154445
|
+
body: model_default28.update
|
|
154397
154446
|
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default29.remove(id, user2)).get("/:id/field", async ({ params: { id } }) => logic_default29.selectField(id)).put("/field/:id", async ({ body, params: { id } }) => logic_default29.updateField(id, body), {
|
|
154398
|
-
body:
|
|
154447
|
+
body: model_default28.updateField
|
|
154399
154448
|
}).post("/:id/field", async ({ body, params: { id } }) => logic_default29.addField(id, body), {
|
|
154400
|
-
body:
|
|
154449
|
+
body: model_default28.createField
|
|
154401
154450
|
}).delete("/field/:id", async ({ params: { id } }) => logic_default29.removeField(id));
|
|
154402
154451
|
var template_default = templateRoutes;
|
|
154403
154452
|
|
|
@@ -154405,13 +154454,13 @@ var template_default = templateRoutes;
|
|
|
154405
154454
|
var inspectionRoutes2 = new Elysia({
|
|
154406
154455
|
prefix: "/inspection"
|
|
154407
154456
|
}).use(fieldGroup_default).use(field_default).use(fieldResult_default).use(template_default).use(schedule_default).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default27.select(query, user2), {
|
|
154408
|
-
query:
|
|
154457
|
+
query: model_default26.select
|
|
154409
154458
|
}).post("/", async ({ body, user: user2 }) => logic_default27.create(body, user2).catch((err2) => console.error(err2)), {
|
|
154410
|
-
body:
|
|
154459
|
+
body: model_default26.create
|
|
154411
154460
|
}).guard({
|
|
154412
154461
|
params: IdSchema
|
|
154413
154462
|
}).put("/:id", async ({ body, params: { id } }) => logic_default27.update(id, body), {
|
|
154414
|
-
body:
|
|
154463
|
+
body: model_default26.update
|
|
154415
154464
|
});
|
|
154416
154465
|
var inspection_default2 = inspectionRoutes2;
|
|
154417
154466
|
|
|
@@ -154462,7 +154511,7 @@ var MachineModel;
|
|
|
154462
154511
|
}))
|
|
154463
154512
|
]);
|
|
154464
154513
|
})(MachineModel ||= {});
|
|
154465
|
-
var
|
|
154514
|
+
var model_default29 = MachineModel;
|
|
154466
154515
|
|
|
154467
154516
|
// src/routes/fleet/machine/index.ts
|
|
154468
154517
|
var machineRoutes = new Elysia({
|
|
@@ -154471,13 +154520,13 @@ var machineRoutes = new Elysia({
|
|
|
154471
154520
|
}).use(better_auth_default).guard({
|
|
154472
154521
|
auth: true
|
|
154473
154522
|
}).get("/", async ({ query, user: user2 }) => logic_default30.select(query, user2), {
|
|
154474
|
-
query:
|
|
154523
|
+
query: model_default29.select
|
|
154475
154524
|
}).post("/", async ({ body, user: user2 }) => logic_default30.create(body, user2), {
|
|
154476
|
-
body:
|
|
154525
|
+
body: model_default29.create
|
|
154477
154526
|
}).guard({
|
|
154478
154527
|
params: IdSchema
|
|
154479
154528
|
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default30.update(id, body, user2), {
|
|
154480
|
-
body:
|
|
154529
|
+
body: model_default29.update
|
|
154481
154530
|
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default30.remove(id, user2));
|
|
154482
154531
|
var machine_default = machineRoutes;
|
|
154483
154532
|
|
|
@@ -154513,7 +154562,7 @@ var MsRecordModel;
|
|
|
154513
154562
|
MsRecordModel.update = OmitBaseSchema(updateSchema);
|
|
154514
154563
|
MsRecordModel.select = t.Composite([PaginationSchema]);
|
|
154515
154564
|
})(MsRecordModel ||= {});
|
|
154516
|
-
var
|
|
154565
|
+
var model_default30 = MsRecordModel;
|
|
154517
154566
|
|
|
154518
154567
|
// src/routes/fleet/ms/record/product/logic.ts
|
|
154519
154568
|
var MsRecordProductLogic;
|
|
@@ -154545,7 +154594,7 @@ var MsRecordProductModel;
|
|
|
154545
154594
|
recordId: t.String({ format: "uuid" })
|
|
154546
154595
|
});
|
|
154547
154596
|
})(MsRecordProductModel ||= {});
|
|
154548
|
-
var
|
|
154597
|
+
var model_default31 = MsRecordProductModel;
|
|
154549
154598
|
|
|
154550
154599
|
// src/routes/fleet/ms/record/product/index.ts
|
|
154551
154600
|
var productRoutes2 = new Elysia({
|
|
@@ -154554,13 +154603,13 @@ var productRoutes2 = new Elysia({
|
|
|
154554
154603
|
}).use(better_auth_default).guard({
|
|
154555
154604
|
auth: true
|
|
154556
154605
|
}).get("/", async ({ query }) => logic_default32.select(query), {
|
|
154557
|
-
query:
|
|
154606
|
+
query: model_default31.select
|
|
154558
154607
|
}).post("/", async ({ body }) => logic_default32.create(body), {
|
|
154559
|
-
body:
|
|
154608
|
+
body: model_default31.create
|
|
154560
154609
|
}).guard({
|
|
154561
154610
|
params: IdSchema
|
|
154562
154611
|
}).put("/:id", async ({ body, params: { id } }) => logic_default32.update(id, body), {
|
|
154563
|
-
body:
|
|
154612
|
+
body: model_default31.update
|
|
154564
154613
|
}).delete("/:id", async ({ params: { id } }) => logic_default32.remove(id));
|
|
154565
154614
|
var product_default2 = productRoutes2;
|
|
154566
154615
|
|
|
@@ -154571,13 +154620,13 @@ var recordRoutes = new Elysia({
|
|
|
154571
154620
|
}).use(product_default2).use(better_auth_default).guard({
|
|
154572
154621
|
auth: true
|
|
154573
154622
|
}).get("/", async ({ query }) => logic_default31.select(query), {
|
|
154574
|
-
query:
|
|
154623
|
+
query: model_default30.select
|
|
154575
154624
|
}).post("/", async ({ body }) => logic_default31.create(body), {
|
|
154576
|
-
body:
|
|
154625
|
+
body: model_default30.create
|
|
154577
154626
|
}).guard({
|
|
154578
154627
|
params: IdSchema
|
|
154579
154628
|
}).put("/:id", async ({ body, params: { id } }) => logic_default31.update(id, body), {
|
|
154580
|
-
body:
|
|
154629
|
+
body: model_default30.update
|
|
154581
154630
|
}).delete("/:id", async ({ params: { id } }) => logic_default31.remove(id));
|
|
154582
154631
|
var record_default = recordRoutes;
|
|
154583
154632
|
|
|
@@ -154718,7 +154767,7 @@ var PmPlanMachineModel;
|
|
|
154718
154767
|
]);
|
|
154719
154768
|
PmPlanMachineModel.createMany = t.Array(OmitBaseSchema(createSchema));
|
|
154720
154769
|
})(PmPlanMachineModel ||= {});
|
|
154721
|
-
var
|
|
154770
|
+
var model_default32 = PmPlanMachineModel;
|
|
154722
154771
|
|
|
154723
154772
|
// src/routes/fleet/pm/plan/machine/index.ts
|
|
154724
154773
|
var machineRoutes2 = new Elysia({
|
|
@@ -154727,15 +154776,15 @@ var machineRoutes2 = new Elysia({
|
|
|
154727
154776
|
}).use(better_auth_default).guard({
|
|
154728
154777
|
auth: true
|
|
154729
154778
|
}).get("/", async ({ query }) => logic_default34.select(query), {
|
|
154730
|
-
query:
|
|
154779
|
+
query: model_default32.select
|
|
154731
154780
|
}).post("/", async ({ body, user: user2 }) => logic_default34.create(body, user2), {
|
|
154732
|
-
body:
|
|
154781
|
+
body: model_default32.create
|
|
154733
154782
|
}).post("/many", async ({ body }) => logic_default34.createMany(body), {
|
|
154734
|
-
body:
|
|
154783
|
+
body: model_default32.createMany
|
|
154735
154784
|
}).guard({
|
|
154736
154785
|
params: IdSchema
|
|
154737
154786
|
}).put("/:id", async ({ body, params: { id } }) => logic_default34.update(id, body), {
|
|
154738
|
-
body:
|
|
154787
|
+
body: model_default32.update
|
|
154739
154788
|
}).delete("/:id", async ({ params: { id } }) => logic_default34.remove(id));
|
|
154740
154789
|
var machine_default2 = machineRoutes2;
|
|
154741
154790
|
|
|
@@ -154750,7 +154799,7 @@ var PmPlanModel;
|
|
|
154750
154799
|
PmPlanModel.update = OmitBaseSchema(updateSchema);
|
|
154751
154800
|
PmPlanModel.select = t.Composite([PaginationSchema]);
|
|
154752
154801
|
})(PmPlanModel ||= {});
|
|
154753
|
-
var
|
|
154802
|
+
var model_default33 = PmPlanModel;
|
|
154754
154803
|
|
|
154755
154804
|
// src/routes/fleet/pm/plan/product/logic.ts
|
|
154756
154805
|
var PmPlanProductLogic;
|
|
@@ -154806,7 +154855,7 @@ var PmPlanProductModel;
|
|
|
154806
154855
|
]);
|
|
154807
154856
|
PmPlanProductModel.createMany = t.Array(OmitBaseSchema(createSchema));
|
|
154808
154857
|
})(PmPlanProductModel ||= {});
|
|
154809
|
-
var
|
|
154858
|
+
var model_default34 = PmPlanProductModel;
|
|
154810
154859
|
|
|
154811
154860
|
// src/routes/fleet/pm/plan/product/index.ts
|
|
154812
154861
|
var productRoutes3 = new Elysia({
|
|
@@ -154815,15 +154864,15 @@ var productRoutes3 = new Elysia({
|
|
|
154815
154864
|
}).use(better_auth_default).guard({
|
|
154816
154865
|
auth: true
|
|
154817
154866
|
}).get("/", async ({ query }) => logic_default35.select(query), {
|
|
154818
|
-
query:
|
|
154867
|
+
query: model_default34.select
|
|
154819
154868
|
}).post("/", async ({ body }) => logic_default35.create(body), {
|
|
154820
|
-
body:
|
|
154869
|
+
body: model_default34.create
|
|
154821
154870
|
}).post("/many", async ({ body }) => logic_default35.createMany(body), {
|
|
154822
|
-
body:
|
|
154871
|
+
body: model_default34.createMany
|
|
154823
154872
|
}).guard({
|
|
154824
154873
|
params: IdSchema
|
|
154825
154874
|
}).put("/:id", async ({ body, params: { id } }) => logic_default35.update(id, body), {
|
|
154826
|
-
body:
|
|
154875
|
+
body: model_default34.update
|
|
154827
154876
|
}).delete("/:id", async ({ params: { id } }) => logic_default35.remove(id));
|
|
154828
154877
|
var product_default3 = productRoutes3;
|
|
154829
154878
|
|
|
@@ -154834,13 +154883,13 @@ var planRoutes = new Elysia({
|
|
|
154834
154883
|
}).use(better_auth_default).use(machine_default2).use(product_default3).guard({
|
|
154835
154884
|
userKind: "COMPANY_ADMIN"
|
|
154836
154885
|
}).get("/", async ({ query, user: user2 }) => logic_default33.select(query, user2), {
|
|
154837
|
-
query:
|
|
154886
|
+
query: model_default33.select
|
|
154838
154887
|
}).post("/", async ({ body, user: user2 }) => logic_default33.create(body, user2), {
|
|
154839
|
-
body:
|
|
154888
|
+
body: model_default33.create
|
|
154840
154889
|
}).guard({
|
|
154841
154890
|
params: IdSchema
|
|
154842
154891
|
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default33.update(id, body, user2), {
|
|
154843
|
-
body:
|
|
154892
|
+
body: model_default33.update
|
|
154844
154893
|
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default33.remove(id, user2));
|
|
154845
154894
|
var plan_default = planRoutes;
|
|
154846
154895
|
|
|
@@ -154887,7 +154936,7 @@ var PmTemplateModel;
|
|
|
154887
154936
|
PmTemplateModel.update = OmitBaseSchema(updateSchema);
|
|
154888
154937
|
PmTemplateModel.select = t.Composite([PaginationSchema]);
|
|
154889
154938
|
})(PmTemplateModel ||= {});
|
|
154890
|
-
var
|
|
154939
|
+
var model_default35 = PmTemplateModel;
|
|
154891
154940
|
|
|
154892
154941
|
// src/routes/fleet/pm/template/product/logic.ts
|
|
154893
154942
|
var PmTemplateProductLogic;
|
|
@@ -154935,7 +154984,7 @@ var PmTemplateProductModel;
|
|
|
154935
154984
|
})
|
|
154936
154985
|
]);
|
|
154937
154986
|
})(PmTemplateProductModel ||= {});
|
|
154938
|
-
var
|
|
154987
|
+
var model_default36 = PmTemplateProductModel;
|
|
154939
154988
|
|
|
154940
154989
|
// src/routes/fleet/pm/template/product/index.ts
|
|
154941
154990
|
var productRoutes4 = new Elysia({
|
|
@@ -154944,13 +154993,13 @@ var productRoutes4 = new Elysia({
|
|
|
154944
154993
|
}).use(better_auth_default).guard({
|
|
154945
154994
|
userKind: "COMPANY_ADMIN"
|
|
154946
154995
|
}).get("/", async ({ query }) => logic_default37.select(query), {
|
|
154947
|
-
query:
|
|
154996
|
+
query: model_default36.select
|
|
154948
154997
|
}).post("/", async ({ body }) => logic_default37.create(body), {
|
|
154949
|
-
body:
|
|
154998
|
+
body: model_default36.create
|
|
154950
154999
|
}).guard({
|
|
154951
155000
|
params: IdSchema
|
|
154952
155001
|
}).put("/:id", async ({ body, params: { id } }) => logic_default37.update(id, body), {
|
|
154953
|
-
body:
|
|
155002
|
+
body: model_default36.update
|
|
154954
155003
|
}).delete("/:id", async ({ params: { id } }) => logic_default37.remove(id));
|
|
154955
155004
|
var product_default4 = productRoutes4;
|
|
154956
155005
|
|
|
@@ -154961,13 +155010,13 @@ var templateRoutes2 = new Elysia({
|
|
|
154961
155010
|
}).use(better_auth_default).use(product_default4).guard({
|
|
154962
155011
|
userKind: "COMPANY_ADMIN"
|
|
154963
155012
|
}).get("/", async ({ query, user: user2 }) => logic_default36.select(query, user2), {
|
|
154964
|
-
query:
|
|
155013
|
+
query: model_default35.select
|
|
154965
155014
|
}).post("/", async ({ body, user: user2 }) => logic_default36.create(body, user2), {
|
|
154966
|
-
body:
|
|
155015
|
+
body: model_default35.create
|
|
154967
155016
|
}).guard({
|
|
154968
155017
|
params: IdSchema
|
|
154969
155018
|
}).put("/:id", async ({ body, params: { id }, user: user2 }) => logic_default36.update(id, body, user2), {
|
|
154970
|
-
body:
|
|
155019
|
+
body: model_default35.update
|
|
154971
155020
|
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default36.remove(id, user2));
|
|
154972
155021
|
var template_default2 = templateRoutes2;
|
|
154973
155022
|
|
|
@@ -155014,7 +155063,7 @@ var WorkOrderModel;
|
|
|
155014
155063
|
WorkOrderModel.update = OmitBaseSchema(updateSchema);
|
|
155015
155064
|
WorkOrderModel.select = t.Composite([PaginationSchema]);
|
|
155016
155065
|
})(WorkOrderModel ||= {});
|
|
155017
|
-
var
|
|
155066
|
+
var model_default37 = WorkOrderModel;
|
|
155018
155067
|
|
|
155019
155068
|
// src/routes/fleet/work-order/task/logic.ts
|
|
155020
155069
|
var WorkOrderTaskLogic;
|
|
@@ -155063,20 +155112,20 @@ var WorkOrderTaskModel;
|
|
|
155063
155112
|
}))
|
|
155064
155113
|
]);
|
|
155065
155114
|
})(WorkOrderTaskModel ||= {});
|
|
155066
|
-
var
|
|
155115
|
+
var model_default38 = WorkOrderTaskModel;
|
|
155067
155116
|
|
|
155068
155117
|
// src/routes/fleet/work-order/task/index.ts
|
|
155069
155118
|
var workOrderTaskRoutes = new Elysia({
|
|
155070
155119
|
prefix: "/task",
|
|
155071
155120
|
tags: ["WorkOrderTask"]
|
|
155072
155121
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default39.select(query), {
|
|
155073
|
-
query:
|
|
155122
|
+
query: model_default38.select
|
|
155074
155123
|
}).post("/", async ({ body }) => logic_default39.create(body), {
|
|
155075
|
-
body:
|
|
155124
|
+
body: model_default38.create
|
|
155076
155125
|
}).guard({
|
|
155077
155126
|
params: IdSchema
|
|
155078
155127
|
}).put("/:id", async ({ body, params: { id } }) => logic_default39.update(id, body), {
|
|
155079
|
-
body:
|
|
155128
|
+
body: model_default38.update
|
|
155080
155129
|
}).delete("/:id", async ({ params: { id } }) => logic_default39.remove(id));
|
|
155081
155130
|
var task_default = workOrderTaskRoutes;
|
|
155082
155131
|
|
|
@@ -155085,13 +155134,13 @@ var workOrderRoutes = new Elysia({
|
|
|
155085
155134
|
prefix: "/work-order",
|
|
155086
155135
|
tags: ["WorkOrder"]
|
|
155087
155136
|
}).use(better_auth_default).use(task_default).guard({ auth: true }).get("/", async ({ query }) => logic_default38.select(query), {
|
|
155088
|
-
query:
|
|
155137
|
+
query: model_default37.select
|
|
155089
155138
|
}).post("/", async ({ body }) => logic_default38.create(body), {
|
|
155090
|
-
body:
|
|
155139
|
+
body: model_default37.create
|
|
155091
155140
|
}).guard({
|
|
155092
155141
|
params: IdSchema
|
|
155093
155142
|
}).put("/:id", async ({ body, params: { id } }) => logic_default38.update(id, body), {
|
|
155094
|
-
body:
|
|
155143
|
+
body: model_default37.update
|
|
155095
155144
|
}).delete("/:id", async ({ params: { id } }) => logic_default38.remove(id));
|
|
155096
155145
|
var work_order_default = workOrderRoutes;
|
|
155097
155146
|
|
|
@@ -155380,7 +155429,7 @@ var PermissionModel;
|
|
|
155380
155429
|
permissions: t.Array(t.String())
|
|
155381
155430
|
});
|
|
155382
155431
|
})(PermissionModel ||= {});
|
|
155383
|
-
var
|
|
155432
|
+
var model_default39 = PermissionModel;
|
|
155384
155433
|
|
|
155385
155434
|
// src/routes/permission/index.ts
|
|
155386
155435
|
var groupService = new CrudHelper(permissionGroupTable, "\u042D\u0440\u0445\u0438\u0439\u043D \u0431\u0430\u0433\u0446 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
|
@@ -155397,7 +155446,7 @@ var permissionRoutes = new Elysia({
|
|
|
155397
155446
|
}, {
|
|
155398
155447
|
permission: "PERMISSION_ADD"
|
|
155399
155448
|
}).post("/", ({ body }) => logic_default40.addPermission(body), {
|
|
155400
|
-
body:
|
|
155449
|
+
body: model_default39.addPermission,
|
|
155401
155450
|
permission: "PERMISSION_ADD",
|
|
155402
155451
|
beforeHandle({ status: status2, body, permissions, publicPermissions }) {
|
|
155403
155452
|
if (!permissions.includes("BACK_OFFICE_ADMIN") && body.permissions.some((bp) => !publicPermissions.map((pp) => pp.code).includes(bp))) {
|
|
@@ -155407,13 +155456,13 @@ var permissionRoutes = new Elysia({
|
|
|
155407
155456
|
}).group("/group", (app2) => app2.guard({
|
|
155408
155457
|
permission: "PERMISSION_GROUP_ALL"
|
|
155409
155458
|
}).get("/", async ({ query }) => await logic_default40.selectGroups(query), {
|
|
155410
|
-
query:
|
|
155459
|
+
query: model_default39.select
|
|
155411
155460
|
}).post("/", async ({ body }) => await groupService.create(body), {
|
|
155412
|
-
body:
|
|
155461
|
+
body: model_default39.create
|
|
155413
155462
|
}).guard({
|
|
155414
155463
|
params: IdSchema
|
|
155415
155464
|
}).put("/:id", async ({ body, params: { id } }) => groupService.update(id, body), {
|
|
155416
|
-
body:
|
|
155465
|
+
body: model_default39.update
|
|
155417
155466
|
}).delete("/:id", async ({ params: { id } }) => groupService.delete(id)));
|
|
155418
155467
|
var permission_default2 = permissionRoutes;
|
|
155419
155468
|
|
|
@@ -155471,18 +155520,18 @@ var TechdocProductCategoryModel;
|
|
|
155471
155520
|
}))
|
|
155472
155521
|
]);
|
|
155473
155522
|
})(TechdocProductCategoryModel ||= {});
|
|
155474
|
-
var
|
|
155523
|
+
var model_default40 = TechdocProductCategoryModel;
|
|
155475
155524
|
|
|
155476
155525
|
// src/routes/techdoc/productCategory/index.ts
|
|
155477
155526
|
var productCategoryRoutes = new Elysia({
|
|
155478
155527
|
prefix: "/product-category",
|
|
155479
155528
|
tags: ["TechdocProductCategory"]
|
|
155480
155529
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default41.select(query), {
|
|
155481
|
-
query:
|
|
155530
|
+
query: model_default40.select
|
|
155482
155531
|
}).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default41.create(body), {
|
|
155483
|
-
body:
|
|
155532
|
+
body: model_default40.create
|
|
155484
155533
|
}).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default41.update(id, body), {
|
|
155485
|
-
body:
|
|
155534
|
+
body: model_default40.update
|
|
155486
155535
|
}).delete("/:id", async ({ params: { id } }) => logic_default41.remove(id));
|
|
155487
155536
|
var productCategory_default = productCategoryRoutes;
|
|
155488
155537
|
|
|
@@ -155536,18 +155585,18 @@ var TechdocProductKindModel;
|
|
|
155536
155585
|
}))
|
|
155537
155586
|
]);
|
|
155538
155587
|
})(TechdocProductKindModel ||= {});
|
|
155539
|
-
var
|
|
155588
|
+
var model_default41 = TechdocProductKindModel;
|
|
155540
155589
|
|
|
155541
155590
|
// src/routes/techdoc/productKind/index.ts
|
|
155542
155591
|
var productKindRoutes = new Elysia({
|
|
155543
155592
|
prefix: "/product-kind",
|
|
155544
155593
|
tags: ["TechdocProductKind"]
|
|
155545
155594
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default42.select(query), {
|
|
155546
|
-
query:
|
|
155595
|
+
query: model_default41.select
|
|
155547
155596
|
}).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default42.create(body), {
|
|
155548
|
-
body:
|
|
155597
|
+
body: model_default41.create
|
|
155549
155598
|
}).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default42.update(id, body), {
|
|
155550
|
-
body:
|
|
155599
|
+
body: model_default41.update
|
|
155551
155600
|
}).delete("/:id", async ({ params: { id } }) => logic_default42.remove(id));
|
|
155552
155601
|
var productKind_default = productKindRoutes;
|
|
155553
155602
|
|
|
@@ -155605,18 +155654,18 @@ var TechdocProductKindRelateModel;
|
|
|
155605
155654
|
}))
|
|
155606
155655
|
]);
|
|
155607
155656
|
})(TechdocProductKindRelateModel ||= {});
|
|
155608
|
-
var
|
|
155657
|
+
var model_default42 = TechdocProductKindRelateModel;
|
|
155609
155658
|
|
|
155610
155659
|
// src/routes/techdoc/productKindRelate/index.ts
|
|
155611
155660
|
var productKindRelateRoutes = new Elysia({
|
|
155612
155661
|
prefix: "/product-kind-relate",
|
|
155613
155662
|
tags: ["TechdocProductKindRelate"]
|
|
155614
155663
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query }) => logic_default43.select(query), {
|
|
155615
|
-
query:
|
|
155664
|
+
query: model_default42.select
|
|
155616
155665
|
}).guard({ userKind: "ADMIN" }).post("/", async ({ body }) => logic_default43.create(body), {
|
|
155617
|
-
body:
|
|
155666
|
+
body: model_default42.create
|
|
155618
155667
|
}).guard({ params: IdSchema }).put("/:id", async ({ body, params: { id } }) => logic_default43.update(id, body), {
|
|
155619
|
-
body:
|
|
155668
|
+
body: model_default42.update
|
|
155620
155669
|
}).delete("/:id", async ({ params: { id } }) => logic_default43.remove(id));
|
|
155621
155670
|
var productKindRelate_default = productKindRelateRoutes;
|
|
155622
155671
|
|
|
@@ -155675,23 +155724,23 @@ var TechdocSupplierModel;
|
|
|
155675
155724
|
const updateSchema = createUpdateSchema(techdocSupplierTable);
|
|
155676
155725
|
TechdocSupplierModel.update = OmitBaseSchema(updateSchema);
|
|
155677
155726
|
})(TechdocSupplierModel ||= {});
|
|
155678
|
-
var
|
|
155727
|
+
var model_default43 = TechdocSupplierModel;
|
|
155679
155728
|
|
|
155680
155729
|
// src/routes/techdoc/supplier/index.ts
|
|
155681
155730
|
var supplierRoutes = new Elysia({
|
|
155682
155731
|
prefix: "/supplier",
|
|
155683
155732
|
tags: ["TechdocSupplier"]
|
|
155684
155733
|
}).use(better_auth_default).get("/", async ({ query, user: user2 }) => logic_default44.select(query, user2), {
|
|
155685
|
-
query:
|
|
155734
|
+
query: model_default43.select,
|
|
155686
155735
|
auth: true
|
|
155687
155736
|
}).guard({
|
|
155688
155737
|
userKind: "ADMIN"
|
|
155689
155738
|
}).post("/", async ({ body }) => logic_default44.create(body), {
|
|
155690
|
-
body:
|
|
155739
|
+
body: model_default43.create
|
|
155691
155740
|
}).guard({
|
|
155692
155741
|
params: IdSchema
|
|
155693
155742
|
}).put("/:id", ({ body, params: { id } }) => logic_default44.update(id, body), {
|
|
155694
|
-
body:
|
|
155743
|
+
body: model_default43.update
|
|
155695
155744
|
}).delete("/:id", ({ params: { id } }) => logic_default44.remove(id));
|
|
155696
155745
|
var supplier_default = supplierRoutes;
|
|
155697
155746
|
|
|
@@ -155708,7 +155757,7 @@ var TechdocVehicleKindModel;
|
|
|
155708
155757
|
const createSchema = createInsertSchema(techdocVehicleKindTable);
|
|
155709
155758
|
TechdocVehicleKindModel.create = OmitBaseSchema(createSchema);
|
|
155710
155759
|
})(TechdocVehicleKindModel ||= {});
|
|
155711
|
-
var
|
|
155760
|
+
var model_default44 = TechdocVehicleKindModel;
|
|
155712
155761
|
|
|
155713
155762
|
// src/routes/techdoc/vehicleKind/index.ts
|
|
155714
155763
|
var vehicleKindRoutes = new Elysia({
|
|
@@ -155717,12 +155766,12 @@ var vehicleKindRoutes = new Elysia({
|
|
|
155717
155766
|
}).use(better_auth_default).guard({
|
|
155718
155767
|
auth: true
|
|
155719
155768
|
}).get("/", async ({ query }) => logic_default13.select(query), {
|
|
155720
|
-
query:
|
|
155769
|
+
query: model_default44.select
|
|
155721
155770
|
}).post("/", async ({ body }) => logic_default13.findOrCreate(body), {
|
|
155722
|
-
body:
|
|
155771
|
+
body: model_default44.create,
|
|
155723
155772
|
userKind: "ADMIN"
|
|
155724
155773
|
}).put("/:id", async ({ body, params: { id } }) => logic_default13.update(id, body), {
|
|
155725
|
-
body:
|
|
155774
|
+
body: model_default44.update,
|
|
155726
155775
|
params: IdSchema,
|
|
155727
155776
|
userKind: "ADMIN"
|
|
155728
155777
|
});
|
|
@@ -155776,7 +155825,7 @@ var UomCategoryModel;
|
|
|
155776
155825
|
UomCategoryModel.update = OmitBaseSchema(updateSchema);
|
|
155777
155826
|
UomCategoryModel.select = t.Composite([PaginationSchema]);
|
|
155778
155827
|
})(UomCategoryModel ||= {});
|
|
155779
|
-
var
|
|
155828
|
+
var model_default45 = UomCategoryModel;
|
|
155780
155829
|
|
|
155781
155830
|
// src/routes/uom/category/index.ts
|
|
155782
155831
|
var categoryRoutes = new Elysia({
|
|
@@ -155785,13 +155834,13 @@ var categoryRoutes = new Elysia({
|
|
|
155785
155834
|
}).use(better_auth_default).guard({
|
|
155786
155835
|
auth: true
|
|
155787
155836
|
}).get("/", async ({ query }) => logic_default45.select(query), {
|
|
155788
|
-
query:
|
|
155837
|
+
query: model_default45.select
|
|
155789
155838
|
}).post("/", async ({ body }) => logic_default45.create(body), {
|
|
155790
|
-
body:
|
|
155839
|
+
body: model_default45.create
|
|
155791
155840
|
}).guard({
|
|
155792
155841
|
params: IdSchema
|
|
155793
155842
|
}).put("/:id", async ({ body, params: { id } }) => logic_default45.update(id, body), {
|
|
155794
|
-
body:
|
|
155843
|
+
body: model_default45.update
|
|
155795
155844
|
}).delete("/:id", async ({ params: { id } }) => logic_default45.remove(id));
|
|
155796
155845
|
var category_default = categoryRoutes;
|
|
155797
155846
|
|
|
@@ -155843,7 +155892,7 @@ var UomConversionModel;
|
|
|
155843
155892
|
})
|
|
155844
155893
|
]);
|
|
155845
155894
|
})(UomConversionModel ||= {});
|
|
155846
|
-
var
|
|
155895
|
+
var model_default46 = UomConversionModel;
|
|
155847
155896
|
|
|
155848
155897
|
// src/routes/uom/conversion/index.ts
|
|
155849
155898
|
var conversionRoutes = new Elysia({
|
|
@@ -155852,13 +155901,13 @@ var conversionRoutes = new Elysia({
|
|
|
155852
155901
|
}).use(better_auth_default).guard({
|
|
155853
155902
|
auth: true
|
|
155854
155903
|
}).get("/", async ({ query }) => logic_default46.select(query), {
|
|
155855
|
-
query:
|
|
155904
|
+
query: model_default46.select
|
|
155856
155905
|
}).post("/", async ({ body }) => logic_default46.create(body), {
|
|
155857
|
-
body:
|
|
155906
|
+
body: model_default46.create
|
|
155858
155907
|
}).guard({
|
|
155859
155908
|
params: IdSchema
|
|
155860
155909
|
}).put("/:id", async ({ body, params: { id } }) => logic_default46.update(id, body), {
|
|
155861
|
-
body:
|
|
155910
|
+
body: model_default46.update
|
|
155862
155911
|
}).delete("/:id", async ({ params: { id } }) => logic_default46.remove(id));
|
|
155863
155912
|
var conversion_default = conversionRoutes;
|
|
155864
155913
|
|
|
@@ -155909,7 +155958,7 @@ var UomModel;
|
|
|
155909
155958
|
})
|
|
155910
155959
|
]);
|
|
155911
155960
|
})(UomModel ||= {});
|
|
155912
|
-
var
|
|
155961
|
+
var model_default47 = UomModel;
|
|
155913
155962
|
|
|
155914
155963
|
// src/routes/uom/index.ts
|
|
155915
155964
|
var uomSchemaRoutes = new Elysia({
|
|
@@ -155918,13 +155967,13 @@ var uomSchemaRoutes = new Elysia({
|
|
|
155918
155967
|
userKind: "ADMIN",
|
|
155919
155968
|
tags: ["Uom"]
|
|
155920
155969
|
}).get("/", async ({ query }) => logic_default47.select(query), {
|
|
155921
|
-
query:
|
|
155970
|
+
query: model_default47.select
|
|
155922
155971
|
}).post("/", async ({ body }) => logic_default47.create(body), {
|
|
155923
|
-
body:
|
|
155972
|
+
body: model_default47.create
|
|
155924
155973
|
}).guard({
|
|
155925
155974
|
params: IdSchema
|
|
155926
155975
|
}).put("/:id", async ({ body, params: { id } }) => logic_default47.update(id, body), {
|
|
155927
|
-
body:
|
|
155976
|
+
body: model_default47.update
|
|
155928
155977
|
}).delete("/:id", async ({ params: { id } }) => logic_default47.remove(id));
|
|
155929
155978
|
var uom_default = uomSchemaRoutes;
|
|
155930
155979
|
|
|
@@ -156210,7 +156259,7 @@ var WarehouseProductModel;
|
|
|
156210
156259
|
PaginationSchema
|
|
156211
156260
|
]);
|
|
156212
156261
|
})(WarehouseProductModel ||= {});
|
|
156213
|
-
var
|
|
156262
|
+
var model_default48 = WarehouseProductModel;
|
|
156214
156263
|
|
|
156215
156264
|
// src/routes/warehouse/item/model.ts
|
|
156216
156265
|
var WarehouseItemModel;
|
|
@@ -156228,7 +156277,7 @@ var WarehouseItemModel;
|
|
|
156228
156277
|
WarehouseItemModel.select = t.Composite([
|
|
156229
156278
|
PaginationSchema,
|
|
156230
156279
|
t.Partial(t.Object({
|
|
156231
|
-
product: t.Omit(
|
|
156280
|
+
product: t.Omit(model_default48.select, ["pagination"]),
|
|
156232
156281
|
shelfNumber: t.String(),
|
|
156233
156282
|
safetyStock: t.Number(),
|
|
156234
156283
|
warehouseId: t.String({ format: "uuid" }),
|
|
@@ -156251,7 +156300,7 @@ var WarehouseItemModel;
|
|
|
156251
156300
|
transferId: t.String({ format: "uuid", default: undefined })
|
|
156252
156301
|
})),
|
|
156253
156302
|
t.Partial(t.Object({
|
|
156254
|
-
product: t.Omit(
|
|
156303
|
+
product: t.Omit(model_default48.select, ["pagination"]),
|
|
156255
156304
|
itemId: t.String({ format: "uuid", default: undefined }),
|
|
156256
156305
|
dateFrom: t.String({ format: "date-time", default: undefined }),
|
|
156257
156306
|
dateTo: t.String({ format: "date-time", default: undefined }),
|
|
@@ -156276,7 +156325,7 @@ var WarehouseItemModel;
|
|
|
156276
156325
|
transactionDetails
|
|
156277
156326
|
});
|
|
156278
156327
|
})(WarehouseItemModel ||= {});
|
|
156279
|
-
var
|
|
156328
|
+
var model_default49 = WarehouseItemModel;
|
|
156280
156329
|
|
|
156281
156330
|
// src/routes/warehouse/item/index.ts
|
|
156282
156331
|
var itemRoutes2 = new Elysia({
|
|
@@ -156285,15 +156334,15 @@ var itemRoutes2 = new Elysia({
|
|
|
156285
156334
|
}).use(better_auth_default).guard({
|
|
156286
156335
|
userKind: "CUSTOMER"
|
|
156287
156336
|
}).get("/", async ({ query, user: user2 }) => logic_default9.select(query, user2), {
|
|
156288
|
-
query:
|
|
156337
|
+
query: model_default49.select
|
|
156289
156338
|
}).get("/sos", async ({ user: user2 }) => logic_default9.selectSos(user2)).post("/", async ({ body }) => logic_default9.create(body), {
|
|
156290
|
-
body:
|
|
156339
|
+
body: model_default49.create
|
|
156291
156340
|
}).post("/many", async ({ body, user: user2 }) => logic_default9.createMany(body, user2), {
|
|
156292
|
-
body:
|
|
156341
|
+
body: model_default49.createMany
|
|
156293
156342
|
}).get("/transaction", async ({ query, user: user2 }) => logic_default9.selectTransaction(query, user2), {
|
|
156294
|
-
query:
|
|
156343
|
+
query: model_default49.selectTransaction
|
|
156295
156344
|
}).post("/change-quantity", async ({ body, user: user2 }) => logic_default9.changeQuantity(body, user2), {
|
|
156296
|
-
body:
|
|
156345
|
+
body: model_default49.changeQuantity
|
|
156297
156346
|
}).post("/order", async ({ user: user2 }) => {
|
|
156298
156347
|
const current = await db_default.select({
|
|
156299
156348
|
id: warehouseItemTable.id
|
|
@@ -156306,7 +156355,7 @@ var itemRoutes2 = new Elysia({
|
|
|
156306
156355
|
}).guard({
|
|
156307
156356
|
params: IdSchema
|
|
156308
156357
|
}).put("/:id", async ({ body, params: { id } }) => logic_default9.update(id, body), {
|
|
156309
|
-
body:
|
|
156358
|
+
body: model_default49.update
|
|
156310
156359
|
}).delete("/:id", async ({ params: { id } }) => logic_default9.remove(id));
|
|
156311
156360
|
var item_default3 = itemRoutes2;
|
|
156312
156361
|
|
|
@@ -156317,14 +156366,14 @@ var productRoutes6 = new Elysia({
|
|
|
156317
156366
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => {
|
|
156318
156367
|
return logic_default8.select(query, user2);
|
|
156319
156368
|
}, {
|
|
156320
|
-
query:
|
|
156369
|
+
query: model_default48.select
|
|
156321
156370
|
}).post("/", async ({ body, user: user2 }) => logic_default8.create(body, user2), {
|
|
156322
|
-
body:
|
|
156371
|
+
body: model_default48.create
|
|
156323
156372
|
}).post("/many", async ({ body, user: user2 }) => logic_default8.createMany(body, user2), {
|
|
156324
|
-
body: t.Array(
|
|
156325
|
-
}).post("/download", async ({ query, user: user2 }) => logic_default8.downloadExcel(query, user2), { query: t.Omit(
|
|
156373
|
+
body: t.Array(model_default48.create)
|
|
156374
|
+
}).post("/download", async ({ query, user: user2 }) => logic_default8.downloadExcel(query, user2), { query: t.Omit(model_default48.select, ["pagination"]) }).guard({
|
|
156326
156375
|
params: IdSchema
|
|
156327
|
-
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default8.update(id, body, user2), { body:
|
|
156376
|
+
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default8.update(id, body, user2), { body: model_default48.update });
|
|
156328
156377
|
var product_default6 = productRoutes6;
|
|
156329
156378
|
|
|
156330
156379
|
// src/routes/warehouse/warehouse/logic.ts
|
|
@@ -156355,7 +156404,7 @@ var WarehouseWarehouseLogic;
|
|
|
156355
156404
|
return result;
|
|
156356
156405
|
};
|
|
156357
156406
|
WarehouseWarehouseLogic.update = async (id, body, user2) => {
|
|
156358
|
-
const [result] = await db_default.update(warehouseWarehouseTable).set(body).where(and(eq(warehouseWarehouseTable.id, id), eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, user2.branchId))).returning();
|
|
156407
|
+
const [result] = await db_default.update(warehouseWarehouseTable).set(body).where(and(eq(warehouseWarehouseTable.id, id), eq(warehouseWarehouseTable.companyId, user2.companyId), eq(warehouseWarehouseTable.branchId, user2.branchId).if(user2.kind === "CUSTOMER"))).returning();
|
|
156359
156408
|
if (!result) {
|
|
156360
156409
|
return status("Not Found", "\u0410\u0433\u0443\u0443\u043B\u0430\u0445 \u043E\u043B\u0434\u0441\u043E\u043D\u0433\u04AF\u0439.");
|
|
156361
156410
|
}
|
|
@@ -156386,22 +156435,22 @@ var WarehouseWarehouseModel;
|
|
|
156386
156435
|
PaginationSchema
|
|
156387
156436
|
]);
|
|
156388
156437
|
})(WarehouseWarehouseModel ||= {});
|
|
156389
|
-
var
|
|
156438
|
+
var model_default50 = WarehouseWarehouseModel;
|
|
156390
156439
|
|
|
156391
156440
|
// src/routes/warehouse/warehouse/index.ts
|
|
156392
156441
|
var warehouseRoutes = new Elysia({
|
|
156393
156442
|
prefix: "/warehouse",
|
|
156394
156443
|
tags: ["Warehouse"]
|
|
156395
156444
|
}).use(better_auth_default).guard({ auth: true }).get("/", async ({ query, user: user2 }) => logic_default49.select(query, user2), {
|
|
156396
|
-
query:
|
|
156445
|
+
query: model_default50.select
|
|
156397
156446
|
}).guard({
|
|
156398
156447
|
userKind: "COMPANY_ADMIN"
|
|
156399
156448
|
}).post("/", async ({ body, user: user2 }) => logic_default49.create(body, user2), {
|
|
156400
|
-
body:
|
|
156449
|
+
body: model_default50.create
|
|
156401
156450
|
}).guard({
|
|
156402
156451
|
params: IdSchema
|
|
156403
156452
|
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default49.update(id, body, user2), {
|
|
156404
|
-
body:
|
|
156453
|
+
body: model_default50.update
|
|
156405
156454
|
}).delete("/:id", async ({ params: { id }, user: user2 }) => logic_default49.remove(id, user2));
|
|
156406
156455
|
var warehouse_default = warehouseRoutes;
|
|
156407
156456
|
|