autosync_backend2 1.2.7 → 1.2.9
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 +91 -19
- package/dist/index.js +63 -37
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -619,7 +619,6 @@ export declare const app: Elysia<"", {
|
|
619
619
|
supplierId?: string | undefined;
|
620
620
|
productId?: string | undefined;
|
621
621
|
priceSell?: number | undefined;
|
622
|
-
alias?: string | undefined;
|
623
622
|
ids?: string[] | undefined;
|
624
623
|
pagination: {
|
625
624
|
size: number;
|
@@ -784,12 +783,7 @@ export declare const app: Elysia<"", {
|
|
784
783
|
supplierId?: string | undefined;
|
785
784
|
productId?: string | undefined;
|
786
785
|
priceSell?: number | undefined;
|
787
|
-
alias?: string | undefined;
|
788
786
|
ids?: string[] | undefined;
|
789
|
-
pagination: {
|
790
|
-
size: number;
|
791
|
-
page: number;
|
792
|
-
};
|
793
787
|
};
|
794
788
|
headers: unknown;
|
795
789
|
response: {
|
@@ -1031,12 +1025,7 @@ export declare const app: Elysia<"", {
|
|
1031
1025
|
supplierId?: string | undefined;
|
1032
1026
|
productId?: string | undefined;
|
1033
1027
|
priceSell?: number | undefined;
|
1034
|
-
alias?: string | undefined;
|
1035
1028
|
ids?: string[] | undefined;
|
1036
|
-
pagination: {
|
1037
|
-
size: number;
|
1038
|
-
page: number;
|
1039
|
-
};
|
1040
1029
|
} | undefined;
|
1041
1030
|
warehouseId?: string | undefined;
|
1042
1031
|
safetyStock?: number | undefined;
|
@@ -1199,7 +1188,6 @@ export declare const app: Elysia<"", {
|
|
1199
1188
|
supplierId?: string | undefined;
|
1200
1189
|
productId?: string | undefined;
|
1201
1190
|
priceSell?: number | undefined;
|
1202
|
-
alias?: string | undefined;
|
1203
1191
|
ids?: string[] | undefined;
|
1204
1192
|
} | undefined;
|
1205
1193
|
itemId?: string | undefined;
|
@@ -2203,6 +2191,7 @@ export declare const app: Elysia<"", {
|
|
2203
2191
|
query: {
|
2204
2192
|
search?: string | undefined;
|
2205
2193
|
companyId?: string | undefined;
|
2194
|
+
branchId?: string | null | undefined;
|
2206
2195
|
pagination: {
|
2207
2196
|
size: number;
|
2208
2197
|
page: number;
|
@@ -3517,6 +3506,35 @@ export declare const app: Elysia<"", {
|
|
3517
3506
|
};
|
3518
3507
|
};
|
3519
3508
|
};
|
3509
|
+
} & {
|
3510
|
+
payment: {
|
3511
|
+
ubpay: {
|
3512
|
+
test: {
|
3513
|
+
":id": {
|
3514
|
+
post: {
|
3515
|
+
body: unknown;
|
3516
|
+
params: {
|
3517
|
+
id: string;
|
3518
|
+
};
|
3519
|
+
query: unknown;
|
3520
|
+
headers: unknown;
|
3521
|
+
response: {
|
3522
|
+
200: string;
|
3523
|
+
422: {
|
3524
|
+
type: "validation";
|
3525
|
+
on: string;
|
3526
|
+
summary?: string;
|
3527
|
+
message?: string;
|
3528
|
+
found?: unknown;
|
3529
|
+
property?: string;
|
3530
|
+
expected?: string;
|
3531
|
+
};
|
3532
|
+
};
|
3533
|
+
};
|
3534
|
+
};
|
3535
|
+
};
|
3536
|
+
};
|
3537
|
+
};
|
3520
3538
|
} & {
|
3521
3539
|
payment: {
|
3522
3540
|
ubpay: {
|
@@ -5527,7 +5545,10 @@ export declare const app: Elysia<"", {
|
|
5527
5545
|
query: unknown;
|
5528
5546
|
headers: unknown;
|
5529
5547
|
response: {
|
5530
|
-
200:
|
5548
|
+
200: {
|
5549
|
+
count: number;
|
5550
|
+
month: string;
|
5551
|
+
}[];
|
5531
5552
|
401: "Session not found";
|
5532
5553
|
};
|
5533
5554
|
};
|
@@ -5542,7 +5563,10 @@ export declare const app: Elysia<"", {
|
|
5542
5563
|
query: unknown;
|
5543
5564
|
headers: unknown;
|
5544
5565
|
response: {
|
5545
|
-
200:
|
5566
|
+
200: {
|
5567
|
+
count: number;
|
5568
|
+
month: string;
|
5569
|
+
}[];
|
5546
5570
|
401: "Session not found";
|
5547
5571
|
};
|
5548
5572
|
};
|
@@ -5557,7 +5581,10 @@ export declare const app: Elysia<"", {
|
|
5557
5581
|
query: unknown;
|
5558
5582
|
headers: unknown;
|
5559
5583
|
response: {
|
5560
|
-
200:
|
5584
|
+
200: {
|
5585
|
+
count: number;
|
5586
|
+
month: string;
|
5587
|
+
}[];
|
5561
5588
|
401: "Session not found";
|
5562
5589
|
};
|
5563
5590
|
};
|
@@ -5572,7 +5599,10 @@ export declare const app: Elysia<"", {
|
|
5572
5599
|
query: unknown;
|
5573
5600
|
headers: unknown;
|
5574
5601
|
response: {
|
5575
|
-
200:
|
5602
|
+
200: {
|
5603
|
+
amount: number;
|
5604
|
+
month: string;
|
5605
|
+
}[];
|
5576
5606
|
401: "Session not found";
|
5577
5607
|
};
|
5578
5608
|
};
|
@@ -5600,6 +5630,48 @@ export declare const app: Elysia<"", {
|
|
5600
5630
|
};
|
5601
5631
|
};
|
5602
5632
|
};
|
5633
|
+
} & {
|
5634
|
+
dashboard: {
|
5635
|
+
"most-sold-services": {
|
5636
|
+
get: {
|
5637
|
+
body: unknown;
|
5638
|
+
params: {};
|
5639
|
+
query: unknown;
|
5640
|
+
headers: unknown;
|
5641
|
+
response: {
|
5642
|
+
200: {
|
5643
|
+
quantity: number;
|
5644
|
+
service: {
|
5645
|
+
id: string;
|
5646
|
+
name: string;
|
5647
|
+
};
|
5648
|
+
}[];
|
5649
|
+
401: "Session not found";
|
5650
|
+
};
|
5651
|
+
};
|
5652
|
+
};
|
5653
|
+
};
|
5654
|
+
} & {
|
5655
|
+
dashboard: {
|
5656
|
+
"most-sold-vehicles": {
|
5657
|
+
get: {
|
5658
|
+
body: unknown;
|
5659
|
+
params: {};
|
5660
|
+
query: unknown;
|
5661
|
+
headers: unknown;
|
5662
|
+
response: {
|
5663
|
+
200: {
|
5664
|
+
quantity: number;
|
5665
|
+
vehicleKind: {
|
5666
|
+
id: string;
|
5667
|
+
name: string;
|
5668
|
+
};
|
5669
|
+
}[];
|
5670
|
+
401: "Session not found";
|
5671
|
+
};
|
5672
|
+
};
|
5673
|
+
};
|
5674
|
+
};
|
5603
5675
|
} & {
|
5604
5676
|
dashboard: {
|
5605
5677
|
"daily-sales": {
|
@@ -5610,7 +5682,7 @@ export declare const app: Elysia<"", {
|
|
5610
5682
|
headers: unknown;
|
5611
5683
|
response: {
|
5612
5684
|
200: {
|
5613
|
-
amount:
|
5685
|
+
amount: number;
|
5614
5686
|
date: string;
|
5615
5687
|
}[];
|
5616
5688
|
401: "Session not found";
|
@@ -6630,7 +6702,7 @@ export declare const app: Elysia<"", {
|
|
6630
6702
|
companyBranchId?: string | undefined;
|
6631
6703
|
startDate?: string | undefined;
|
6632
6704
|
endDate?: string | undefined;
|
6633
|
-
groupBy: "
|
6705
|
+
groupBy: "month" | "day" | "week" | "year";
|
6634
6706
|
};
|
6635
6707
|
headers: unknown;
|
6636
6708
|
response: {
|
@@ -6854,7 +6926,7 @@ export declare const app: Elysia<"", {
|
|
6854
6926
|
companyBranchId?: string | undefined;
|
6855
6927
|
startDate?: string | undefined;
|
6856
6928
|
endDate?: string | undefined;
|
6857
|
-
groupBy: "
|
6929
|
+
groupBy: "month" | "day" | "week" | "year";
|
6858
6930
|
};
|
6859
6931
|
headers: unknown;
|
6860
6932
|
response: {
|
package/dist/index.js
CHANGED
@@ -1924,8 +1924,8 @@ var import_debug, debug, syncBufferSize, ddSignatureArray, eocdSignatureBytes;
|
|
1924
1924
|
var init_lib3 = __esm(() => {
|
1925
1925
|
init_lib2();
|
1926
1926
|
init_esm();
|
1927
|
-
import_debug = __toESM(require_src(), 1);
|
1928
1927
|
init_ZipToken();
|
1928
|
+
import_debug = __toESM(require_src(), 1);
|
1929
1929
|
debug = import_debug.default("tokenizer:inflate");
|
1930
1930
|
syncBufferSize = 256 * 1024;
|
1931
1931
|
ddSignatureArray = signatureToArray(Signature.DataDescriptor);
|
@@ -17019,10 +17019,12 @@ var init_infer_result = () => {};
|
|
17019
17019
|
|
17020
17020
|
// node_modules/kysely/dist/esm/index.js
|
17021
17021
|
var init_esm2 = __esm(() => {
|
17022
|
+
init_expression_builder();
|
17023
|
+
init_log_once();
|
17024
|
+
init_query_id();
|
17022
17025
|
init_kysely();
|
17023
17026
|
init_query_creator();
|
17024
17027
|
init_expression();
|
17025
|
-
init_expression_builder();
|
17026
17028
|
init_expression_wrapper();
|
17027
17029
|
init_where_interface();
|
17028
17030
|
init_returning_interface();
|
@@ -17218,8 +17220,6 @@ var init_esm2 = __esm(() => {
|
|
17218
17220
|
init_streamable();
|
17219
17221
|
init_log();
|
17220
17222
|
init_infer_result();
|
17221
|
-
init_log_once();
|
17222
|
-
init_query_id();
|
17223
17223
|
});
|
17224
17224
|
|
17225
17225
|
// node_modules/better-auth/dist/chunks/bun-sqlite-dialect.mjs
|
@@ -146420,7 +146420,7 @@ var CompanyEmployeeModel;
|
|
146420
146420
|
CompanyEmployeeModel.create = OmitBaseSchema(createSchema);
|
146421
146421
|
CompanyEmployeeModel.update = OmitBaseSchema(updateSchema);
|
146422
146422
|
CompanyEmployeeModel.select = t.Composite([
|
146423
|
-
t.Partial(t.Pick(selectSchema, ["companyId"])),
|
146423
|
+
t.Partial(t.Pick(selectSchema, ["companyId", "branchId"])),
|
146424
146424
|
t.Partial(t.Object({
|
146425
146425
|
search: t.String()
|
146426
146426
|
})),
|
@@ -146453,7 +146453,7 @@ var CompanyEmployeeLogic;
|
|
146453
146453
|
};
|
146454
146454
|
CompanyEmployeeLogic.select = async (query, user2) => {
|
146455
146455
|
const columns = getTableColumns(companyEmployeeTable);
|
146456
|
-
const filter = and(eq(companyEmployeeTable.companyId, user2.companyId), or(isNull2(companyEmployeeTable.branchId), eq(companyEmployeeTable.branchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), or(ilike(companyEmployeeTable.firstname, `%${query.search}%`), ilike(companyEmployeeTable.lastname, `%${query.search}%`), ilike(companyEmployeeTable.phone, `%${query.search}%`), ilike(companyEmployeeTable.regNumber, `%${query.search}%`))?.if(query.search), eq(companyEmployeeTable.companyId, query.companyId ?? "").if(query.companyId && user2.kind === "ADMIN"), softDeletedFilter(companyEmployeeTable));
|
146456
|
+
const filter = and(eq(companyEmployeeTable.companyId, user2.companyId), eq(companyEmployeeTable.branchId, query.branchId).if(query.branchId && user2.kind !== "CUSTOMER"), or(isNull2(companyEmployeeTable.branchId), eq(companyEmployeeTable.branchId, user2.branchId))?.if(user2.kind === "CUSTOMER"), or(ilike(companyEmployeeTable.firstname, `%${query.search}%`), ilike(companyEmployeeTable.lastname, `%${query.search}%`), ilike(companyEmployeeTable.phone, `%${query.search}%`), ilike(companyEmployeeTable.regNumber, `%${query.search}%`))?.if(query.search), eq(companyEmployeeTable.companyId, query.companyId ?? "").if(query.companyId && user2.kind === "ADMIN"), softDeletedFilter(companyEmployeeTable));
|
146457
146457
|
const baseQuery = db_default.select({
|
146458
146458
|
...columns,
|
146459
146459
|
totalCount: totalCountSql
|
@@ -146759,6 +146759,7 @@ var logic_default5 = WarehouseProductLogic;
|
|
146759
146759
|
var WarehouseItemLogic;
|
146760
146760
|
((WarehouseItemLogic) => {
|
146761
146761
|
WarehouseItemLogic.select = async (query, user2) => {
|
146762
|
+
console.log(query);
|
146762
146763
|
const filter = and(softDeletedFilter(warehouseItemTable).if(query.isActive), isNotNull(warehouseItemTable.deletedAt).if(query.isActive !== undefined && query.isActive === false), ...query.product ? [logic_default5.getFilter(query.product, user2)] : [], eq(warehouseItemTable.safetyStock, query.safetyStock ?? 0).if(query.safetyStock), ilike(warehouseItemTable.shelfNumber, `%${query.shelfNumber}%`).if(query.shelfNumber), eq(warehouseItemTable.warehouseId, query.warehouseId).if(query.warehouseId));
|
146763
146764
|
const baseQuery = db_default.select({
|
146764
146765
|
item: warehouseItemTable,
|
@@ -149964,7 +149965,9 @@ class UbPayGateway extends PaymentGateway {
|
|
149964
149965
|
const invoice = await this.ubPay.createInvoice({
|
149965
149966
|
amount: payment.amount,
|
149966
149967
|
description: "Autosync",
|
149967
|
-
customData:
|
149968
|
+
customData: {
|
149969
|
+
bnplProductId: 2
|
149970
|
+
},
|
149968
149971
|
callbackUrl: `${CALLBACK_URL}/ubpay/${payment.id}`
|
149969
149972
|
}, this.token);
|
149970
149973
|
if (invoice.data.success === false) {
|
@@ -150986,6 +150989,9 @@ var paymentRoutes = new Elysia({
|
|
150986
150989
|
}).post("/storepay", async ({ body, user: user2 }) => logic_default12.createStorepay(body, user2), { body: model_default10.storepay, auth: true }).get("/storepay/:id", async ({ params: { id } }) => logic_default12.checkStorePay(id)).post("/ubpay", async ({ body, user: user2 }) => logic_default12.createUbPay(body, user2), {
|
150987
150990
|
body: model_default10.create,
|
150988
150991
|
auth: true
|
150992
|
+
}).post("/ubpay/test/:id", async ({ params: { id } }) => {
|
150993
|
+
app.server?.publish(`cp_order_payment:${id}`, "Testing web socket");
|
150994
|
+
return "ok";
|
150989
150995
|
}).post("/ubpay/:id", async ({ params: { id } }) => logic_default12.checkUbPay(id)).get("/qpay/:id", async ({ params: { id } }) => logic_default12.checkQpay(id)).post("/qpay", async ({ body, user: user2 }) => logic_default12.createQpay(body, user2), {
|
150990
150996
|
body: model_default10.create,
|
150991
150997
|
auth: true
|
@@ -151065,48 +151071,69 @@ var customer_default = customerRoutes;
|
|
151065
151071
|
var CrmDashboardLogic;
|
151066
151072
|
((CrmDashboardLogic) => {
|
151067
151073
|
CrmDashboardLogic.getCarCount = async (user2) => {
|
151068
|
-
const
|
151069
|
-
count: sql3`count(distinct ${crmCpOrderTable.vehicleId})
|
151070
|
-
|
151071
|
-
|
151074
|
+
const result = await db_default.select({
|
151075
|
+
count: sql3`count(distinct ${crmCpOrderTable.vehicleId})`.mapWith(Number),
|
151076
|
+
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
151077
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - INTERVAL '1 month'`)).groupBy((t2) => t2.month);
|
151078
|
+
return result;
|
151072
151079
|
};
|
151073
151080
|
CrmDashboardLogic.getCpOrderCount = async (user2) => {
|
151074
|
-
const
|
151075
|
-
count: sql3`count(${crmCpOrderTable.id})
|
151076
|
-
|
151077
|
-
|
151081
|
+
const result = await db_default.select({
|
151082
|
+
count: sql3`count(${crmCpOrderTable.id})`.mapWith(Number),
|
151083
|
+
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
151084
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).groupBy((t2) => t2.month);
|
151085
|
+
return result;
|
151078
151086
|
};
|
151079
151087
|
CrmDashboardLogic.getCpOrderServiceCount = async (user2) => {
|
151080
|
-
const
|
151081
|
-
count: sql3`count(${crmCpOrderTable.id})
|
151082
|
-
|
151083
|
-
|
151088
|
+
const result = await db_default.select({
|
151089
|
+
count: sql3`count(${crmCpOrderTable.id})`.mapWith(Number),
|
151090
|
+
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
151091
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), eq(crmCpOrderTable.type, "Service"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).groupBy((t2) => t2.month);
|
151092
|
+
return result;
|
151084
151093
|
};
|
151085
151094
|
CrmDashboardLogic.getCpOrderTotalAmount = async (user2) => {
|
151086
|
-
const
|
151087
|
-
amount: sum(crmCpOrderItemTable.priceTotal)
|
151088
|
-
|
151089
|
-
|
151095
|
+
const result = await db_default.select({
|
151096
|
+
amount: sum(crmCpOrderItemTable.priceTotal).mapWith(Number),
|
151097
|
+
month: sql3`date_trunc('month', ${crmCpOrderTable.createdAt})`.as("month")
|
151098
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.month);
|
151099
|
+
return result;
|
151090
151100
|
};
|
151091
151101
|
CrmDashboardLogic.getMostSelledProduct = async (user2) => {
|
151092
151102
|
const result = await db_default.select({
|
151093
|
-
quantity: sum(crmCpOrderItemTable.quantity),
|
151103
|
+
quantity: sum(crmCpOrderItemTable.quantity).mapWith(Number),
|
151094
151104
|
product: {
|
151095
151105
|
id: warehouseProductTable.id,
|
151096
151106
|
name: warehouseProductTable.name,
|
151097
151107
|
partNumber: warehouseProductTable.partNumber
|
151098
151108
|
}
|
151099
|
-
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"))).orderBy((t2) => desc(t2.quantity)).groupBy(warehouseProductTable.id, warehouseProductTable.name, warehouseProductTable.partNumber).limit(5);
|
151100
|
-
return result
|
151101
|
-
|
151102
|
-
|
151103
|
-
|
151109
|
+
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(warehouseProductTable, eq(warehouseProductTable.id, crmCpOrderItemTable.companyProductId)).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), 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);
|
151110
|
+
return result;
|
151111
|
+
};
|
151112
|
+
CrmDashboardLogic.getMostSelledService = async (user2) => {
|
151113
|
+
const result = await db_default.select({
|
151114
|
+
quantity: sum(crmCpOrderItemTable.quantity).mapWith(Number),
|
151115
|
+
service: {
|
151116
|
+
id: companyServiceKindTable.id,
|
151117
|
+
name: companyServiceKindTable.name
|
151118
|
+
}
|
151119
|
+
}).from(crmCpOrderTable).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).innerJoin(companyServiceKindTable, eq(companyServiceKindTable.id, crmCpOrderItemTable.companyServiceKindId)).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), 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);
|
151120
|
+
return result;
|
151121
|
+
};
|
151122
|
+
CrmDashboardLogic.getMostSelledVehicleKind = async (user2) => {
|
151123
|
+
const result = await db_default.select({
|
151124
|
+
quantity: count(crmCpOrderTable.id).mapWith(Number),
|
151125
|
+
vehicleKind: {
|
151126
|
+
id: techdocVehicleKindTable.id,
|
151127
|
+
name: techdocVehicleKindTable.name
|
151128
|
+
}
|
151129
|
+
}).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(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), 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);
|
151130
|
+
return result;
|
151104
151131
|
};
|
151105
151132
|
CrmDashboardLogic.getCpOrderTotalAmountByDay = async (user2) => {
|
151106
151133
|
const result = await db_default.select({
|
151107
|
-
amount: sum(crmCpOrderItemTable.priceTotal),
|
151108
|
-
date: sql3`
|
151109
|
-
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"))).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.date);
|
151134
|
+
amount: sum(crmCpOrderItemTable.priceTotal).mapWith(Number),
|
151135
|
+
date: sql3`date_trunc('day', ${crmCpOrderTable.createdAt})`.as("day")
|
151136
|
+
}).from(crmCpOrderTable).where(and(eq(crmCpOrderTable.companyId, user2.companyId), eq(crmCpOrderTable.companyBranchId, user2.branchId).if(user2.kind === "CUSTOMER"), sql3`${crmCpOrderTable.createdAt} >= date_trunc('month', CURRENT_DATE) - interval '1 month'`)).leftJoin(crmCpOrderItemTable, eq(crmCpOrderItemTable.cpOrderId, crmCpOrderTable.id)).groupBy((t2) => t2.date).orderBy((t2) => t2.date);
|
151110
151137
|
return result;
|
151111
151138
|
};
|
151112
151139
|
})(CrmDashboardLogic ||= {});
|
@@ -151118,7 +151145,7 @@ var dashboardRoutes = new Elysia({
|
|
151118
151145
|
tags: ["CrmDashboard"]
|
151119
151146
|
}).use(better_auth_default).guard({
|
151120
151147
|
auth: true
|
151121
|
-
}).get("/car-count", async ({ user: user2 }) => logic_default16.getCarCount(user2)).get("/cp-order-count", async ({ user: user2 }) => logic_default16.getCpOrderCount(user2)).get("/cp-order-service-count", async ({ user: user2 }) => logic_default16.getCpOrderServiceCount(user2)).get("/cp-order-total-amount", async ({ user: user2 }) => logic_default16.getCpOrderTotalAmount(user2)).get("/most-sold-products", async ({ user: user2 }) => logic_default16.getMostSelledProduct(user2)).get("/daily-sales", async ({ user: user2 }) => logic_default16.getCpOrderTotalAmountByDay(user2));
|
151148
|
+
}).get("/car-count", async ({ user: user2 }) => logic_default16.getCarCount(user2)).get("/cp-order-count", async ({ user: user2 }) => logic_default16.getCpOrderCount(user2)).get("/cp-order-service-count", async ({ user: user2 }) => logic_default16.getCpOrderServiceCount(user2)).get("/cp-order-total-amount", async ({ user: user2 }) => logic_default16.getCpOrderTotalAmount(user2)).get("/most-sold-products", async ({ user: user2 }) => logic_default16.getMostSelledProduct(user2)).get("/most-sold-services", async ({ user: user2 }) => logic_default16.getMostSelledService(user2)).get("/most-sold-vehicles", async ({ user: user2 }) => logic_default16.getMostSelledVehicleKind(user2)).get("/daily-sales", async ({ user: user2 }) => logic_default16.getCpOrderTotalAmountByDay(user2));
|
151122
151149
|
var dashboard_default = dashboardRoutes;
|
151123
151150
|
|
151124
151151
|
// src/routes/crm/discount/model.ts
|
@@ -151354,7 +151381,7 @@ var CrmInspectionLogic;
|
|
151354
151381
|
status: crmInspectionTable.status
|
151355
151382
|
}
|
151356
151383
|
}).from(crmInspectionTable).where(eq(crmInspectionTable.id, inspection.id)).leftJoin(companyCompanyTable, eq(companyCompanyTable.id, crmInspectionTable.companyId)).leftJoin(crmVehicleTable, eq(crmVehicleTable.id, crmInspectionTable.vehicleId)).leftJoin(techdocVehicleKindTable, eq(techdocVehicleKindTable.id, crmVehicleTable.vehicleKindId)).leftJoin(companyEmployeeTable, eq(companyEmployeeTable.id, crmInspectionTable.employeeId));
|
151357
|
-
distribution_default.post("https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection", {
|
151384
|
+
distribution_default.post(env_default.NODE_ENV === "development" ? "https://driver-partner-api.dev.ubcabtech.com/v1/webhook/autosync/inspection" : "https://driver-partner-api.ubcabtech.com/v1/webhook/autosync/inspection", {
|
151358
151385
|
json: result[0],
|
151359
151386
|
retry: 3
|
151360
151387
|
});
|
@@ -152828,7 +152855,6 @@ var WarehouseProductModel;
|
|
152828
152855
|
supplierId: t.String({ format: "uuid" }),
|
152829
152856
|
search: t.String(),
|
152830
152857
|
priceSell: t.Number(),
|
152831
|
-
alias: t.String(),
|
152832
152858
|
productId: t.String({ format: "uuid" }),
|
152833
152859
|
id: t.String({ format: "uuid" }),
|
152834
152860
|
ids: t.Array(t.String({ format: "uuid" })),
|
@@ -152854,7 +152880,7 @@ var WarehouseItemModel;
|
|
152854
152880
|
WarehouseItemModel.select = t.Composite([
|
152855
152881
|
PaginationSchema,
|
152856
152882
|
t.Partial(t.Object({
|
152857
|
-
product: model_default22.select,
|
152883
|
+
product: t.Omit(model_default22.select, ["pagination"]),
|
152858
152884
|
shelfNumber: t.String(),
|
152859
152885
|
safetyStock: t.Number(),
|
152860
152886
|
warehouseId: t.String({ format: "uuid" }),
|
@@ -152936,7 +152962,7 @@ var productRoutes3 = new Elysia({
|
|
152936
152962
|
body: model_default22.create
|
152937
152963
|
}).post("/many", async ({ body, user: user2 }) => logic_default5.createMany(body, user2), {
|
152938
152964
|
body: t.Array(model_default22.create)
|
152939
|
-
}).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: model_default22.select }).guard({
|
152965
|
+
}).post("/download", async ({ query, user: user2 }) => logic_default5.downloadExcel(query, user2), { query: t.Omit(model_default22.select, ["pagination"]) }).guard({
|
152940
152966
|
params: IdSchema
|
152941
152967
|
}).put("/:id", async ({ params: { id }, body, user: user2 }) => logic_default5.update(id, body, user2), { body: model_default22.update });
|
152942
152968
|
var product_default3 = productRoutes3;
|