@infuro/cms-core 1.0.33 → 1.0.34
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/README.md +9 -6
- package/dist/admin.cjs +980 -801
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +7 -2
- package/dist/admin.d.ts +7 -2
- package/dist/admin.js +1021 -842
- package/dist/admin.js.map +1 -1
- package/dist/api.cjs +1858 -848
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1824 -815
- package/dist/api.js.map +1 -1
- package/dist/auth.cjs +94 -11
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +17 -1
- package/dist/auth.d.ts +17 -1
- package/dist/auth.js +89 -11
- package/dist/auth.js.map +1 -1
- package/dist/cli.cjs +39 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +39 -0
- package/dist/cli.js.map +1 -1
- package/dist/{index-rZTnpK7y.d.cts → index-Bf5GO8fu.d.cts} +3 -2
- package/dist/{index-DWd5Gjc4.d.ts → index-DOiJuMQA.d.ts} +3 -2
- package/dist/index.cjs +2078 -841
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +83 -8
- package/dist/index.d.ts +83 -8
- package/dist/index.js +2013 -786
- package/dist/index.js.map +1 -1
- package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
- package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
- package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
- package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
- package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
- package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
- package/package.json +4 -3
package/dist/api.js
CHANGED
|
@@ -81,6 +81,30 @@ var init_permission_entities = __esm({
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
+
// src/auth/role-helpers.ts
|
|
85
|
+
function isSuperAdmin(user) {
|
|
86
|
+
if (!user) return false;
|
|
87
|
+
if (user.groupId === SUPER_ADMIN_GROUP_ID) return true;
|
|
88
|
+
if (user.isRBACAdmin === true) return true;
|
|
89
|
+
return isSuperAdminGroupName(user.groupName);
|
|
90
|
+
}
|
|
91
|
+
function isVendorAdmin(user) {
|
|
92
|
+
if (!user?.email || isSuperAdmin(user)) return false;
|
|
93
|
+
if (user.groupId === VENDOR_ADMIN_GROUP_ID) return true;
|
|
94
|
+
if ((user.vendorIds?.length ?? 0) > 0) return true;
|
|
95
|
+
return isVendorGroupName(user.groupName);
|
|
96
|
+
}
|
|
97
|
+
var SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID;
|
|
98
|
+
var init_role_helpers = __esm({
|
|
99
|
+
"src/auth/role-helpers.ts"() {
|
|
100
|
+
"use strict";
|
|
101
|
+
init_permission_entities();
|
|
102
|
+
init_vendor_scope();
|
|
103
|
+
SUPER_ADMIN_GROUP_ID = 1;
|
|
104
|
+
VENDOR_ADMIN_GROUP_ID = 5;
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
84
108
|
// src/auth/vendor-scope.ts
|
|
85
109
|
function isVendorGroupName(name) {
|
|
86
110
|
if (!name?.trim()) return false;
|
|
@@ -89,12 +113,12 @@ function isVendorGroupName(name) {
|
|
|
89
113
|
}
|
|
90
114
|
function isPlatformAdministrator(user) {
|
|
91
115
|
if (!user?.email) return false;
|
|
92
|
-
return
|
|
116
|
+
return isSuperAdmin(user);
|
|
93
117
|
}
|
|
94
118
|
function isVendorPortalUser(user) {
|
|
95
119
|
if (user?.isVendorPortal === true) return true;
|
|
96
120
|
if (!user?.email || isPlatformAdministrator(user)) return false;
|
|
97
|
-
if ((user
|
|
121
|
+
if (isVendorAdmin(user)) return true;
|
|
98
122
|
return isVendorGroupName(user.groupName);
|
|
99
123
|
}
|
|
100
124
|
function isVendorOwner(user) {
|
|
@@ -130,7 +154,7 @@ var VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_OWNER_GROUP
|
|
|
130
154
|
var init_vendor_scope = __esm({
|
|
131
155
|
"src/auth/vendor-scope.ts"() {
|
|
132
156
|
"use strict";
|
|
133
|
-
|
|
157
|
+
init_role_helpers();
|
|
134
158
|
VENDOR_SCOPED_STORE_ENTITIES = /* @__PURE__ */ new Set([
|
|
135
159
|
"products",
|
|
136
160
|
"collections",
|
|
@@ -227,6 +251,7 @@ var email_queue_exports = {};
|
|
|
227
251
|
__export(email_queue_exports, {
|
|
228
252
|
queueEmail: () => queueEmail,
|
|
229
253
|
queueOrderPlacedEmails: () => queueOrderPlacedEmails,
|
|
254
|
+
queueVendorOnboardEmails: () => queueVendorOnboardEmails,
|
|
230
255
|
registerEmailQueueProcessor: () => registerEmailQueueProcessor
|
|
231
256
|
});
|
|
232
257
|
function registerEmailQueueProcessor(cms) {
|
|
@@ -319,6 +344,60 @@ async function queueOrderPlacedEmails(cms, payload) {
|
|
|
319
344
|
}
|
|
320
345
|
await Promise.all(jobs);
|
|
321
346
|
}
|
|
347
|
+
async function queueVendorOnboardEmails(cms, payload) {
|
|
348
|
+
const {
|
|
349
|
+
vendorName,
|
|
350
|
+
vendorSlug,
|
|
351
|
+
ownerName,
|
|
352
|
+
ownerEmail,
|
|
353
|
+
activation,
|
|
354
|
+
inviteLink,
|
|
355
|
+
signInLink,
|
|
356
|
+
kind = "vendor_onboard",
|
|
357
|
+
notifyEmails,
|
|
358
|
+
companyDetails,
|
|
359
|
+
sendToOwner = true
|
|
360
|
+
} = payload;
|
|
361
|
+
const base = {
|
|
362
|
+
vendorName,
|
|
363
|
+
vendorSlug,
|
|
364
|
+
ownerName,
|
|
365
|
+
ownerEmail,
|
|
366
|
+
activation,
|
|
367
|
+
inviteLink,
|
|
368
|
+
signInLink,
|
|
369
|
+
kind,
|
|
370
|
+
companyDetails: companyDetails ?? {}
|
|
371
|
+
};
|
|
372
|
+
const ownerLower = ownerEmail?.trim().toLowerCase() ?? "";
|
|
373
|
+
const jobs = [];
|
|
374
|
+
if (sendToOwner && ownerEmail?.trim()) {
|
|
375
|
+
jobs.push(
|
|
376
|
+
queueEmail(cms, {
|
|
377
|
+
to: ownerEmail.trim(),
|
|
378
|
+
templateName: "vendorOnboarded",
|
|
379
|
+
ctx: { ...base, audience: "owner" }
|
|
380
|
+
})
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
const seen = /* @__PURE__ */ new Set();
|
|
384
|
+
for (const raw of notifyEmails) {
|
|
385
|
+
const to = raw.trim();
|
|
386
|
+
if (!to) continue;
|
|
387
|
+
const key = to.toLowerCase();
|
|
388
|
+
if (seen.has(key)) continue;
|
|
389
|
+
seen.add(key);
|
|
390
|
+
if (ownerLower && key === ownerLower) continue;
|
|
391
|
+
jobs.push(
|
|
392
|
+
queueEmail(cms, {
|
|
393
|
+
to,
|
|
394
|
+
templateName: "vendorOnboarded",
|
|
395
|
+
ctx: { ...base, audience: "internal" }
|
|
396
|
+
})
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
await Promise.all(jobs);
|
|
400
|
+
}
|
|
322
401
|
var EMAIL_QUEUE_NAME;
|
|
323
402
|
var init_email_queue = __esm({
|
|
324
403
|
"src/plugins/email/email-queue.ts"() {
|
|
@@ -897,12 +976,417 @@ var init_paid_order_erp = __esm({
|
|
|
897
976
|
}
|
|
898
977
|
});
|
|
899
978
|
|
|
979
|
+
// src/admin/pages/OrderTrackPage.ts
|
|
980
|
+
var OrderTrackPage_exports = {};
|
|
981
|
+
__export(OrderTrackPage_exports, {
|
|
982
|
+
renderOrderTrackingPage: () => renderOrderTrackingPage
|
|
983
|
+
});
|
|
984
|
+
function renderOrderTrackingPage(order) {
|
|
985
|
+
const contact = order.contact;
|
|
986
|
+
const items = order.items ?? [];
|
|
987
|
+
const currency = String(order.currency ?? "INR");
|
|
988
|
+
function formatMoney(amount) {
|
|
989
|
+
return new Intl.NumberFormat("en-IN", {
|
|
990
|
+
style: "currency",
|
|
991
|
+
currency,
|
|
992
|
+
minimumFractionDigits: 2
|
|
993
|
+
}).format(Number(amount));
|
|
994
|
+
}
|
|
995
|
+
function formatDate(dateStr) {
|
|
996
|
+
return new Date(dateStr).toLocaleDateString("en-IN", {
|
|
997
|
+
year: "numeric",
|
|
998
|
+
month: "long",
|
|
999
|
+
day: "numeric"
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
const statusConfig = {
|
|
1003
|
+
pending: { label: "Order Placed", color: "#f59e0b", step: 1 },
|
|
1004
|
+
confirmed: { label: "Confirmed", color: "#3b82f6", step: 2 },
|
|
1005
|
+
processing: { label: "Processing", color: "#8b5cf6", step: 3 },
|
|
1006
|
+
completed: { label: "Completed", color: "#10b981", step: 4 },
|
|
1007
|
+
cancelled: { label: "Cancelled", color: "#ef4444", step: 0 }
|
|
1008
|
+
};
|
|
1009
|
+
const status = String(order.status ?? "pending");
|
|
1010
|
+
const sc = statusConfig[status] ?? { label: status, color: "#6b7280", step: 1 };
|
|
1011
|
+
const isCancelled = status === "cancelled";
|
|
1012
|
+
const steps = [
|
|
1013
|
+
{ label: "Order Placed", icon: "\u{1F4CB}" },
|
|
1014
|
+
{ label: "Confirmed", icon: "\u2705" },
|
|
1015
|
+
{ label: "Processing", icon: "\u2699\uFE0F" },
|
|
1016
|
+
{ label: "Completed", icon: "\u{1F389}" }
|
|
1017
|
+
];
|
|
1018
|
+
const stepsHtml = isCancelled ? `<div class="cancelled-banner">Order Cancelled</div>` : steps.map((s, i) => {
|
|
1019
|
+
const stepNum = i + 1;
|
|
1020
|
+
const isActive = sc.step === stepNum;
|
|
1021
|
+
const isDone = sc.step > stepNum;
|
|
1022
|
+
return `
|
|
1023
|
+
<div class="step ${isDone ? "done" : ""} ${isActive ? "active" : ""}">
|
|
1024
|
+
<div class="step-circle">${isDone ? "\u2713" : s.icon}</div>
|
|
1025
|
+
<div class="step-label">${s.label}</div>
|
|
1026
|
+
</div>
|
|
1027
|
+
${stepNum < 4 ? `<div class="step-line ${sc.step > stepNum ? "done" : ""}"></div>` : ""}
|
|
1028
|
+
`;
|
|
1029
|
+
}).join("");
|
|
1030
|
+
const itemsHtml = items.map((item) => {
|
|
1031
|
+
const name = item.product?.collection?.name ?? item.product?.name ?? `Product #${item.id}`;
|
|
1032
|
+
const sku = item.product?.sku ?? "\u2014";
|
|
1033
|
+
return `
|
|
1034
|
+
<div class="item-row">
|
|
1035
|
+
<div class="item-avatar">${name.charAt(0).toUpperCase()}</div>
|
|
1036
|
+
<div class="item-info">
|
|
1037
|
+
<div class="item-name">${name}</div>
|
|
1038
|
+
<div class="item-sku">SKU: ${sku}</div>
|
|
1039
|
+
</div>
|
|
1040
|
+
<div class="item-qty">\xD7${item.quantity}</div>
|
|
1041
|
+
<div class="item-price">${formatMoney(Number(item.unitPrice))}</div>
|
|
1042
|
+
</div>
|
|
1043
|
+
`;
|
|
1044
|
+
}).join("");
|
|
1045
|
+
const discountRow = Number(order.discount) > 0 ? `<div class="summary-row discount"><span>Discount</span><span>\u2212${formatMoney(Number(order.discount))}</span></div>` : "";
|
|
1046
|
+
const taxRow = Number(order.tax) > 0 ? `<div class="summary-row"><span>Tax</span><span>${formatMoney(Number(order.tax))}</span></div>` : "";
|
|
1047
|
+
return `<!DOCTYPE html>
|
|
1048
|
+
<html lang="en">
|
|
1049
|
+
<head>
|
|
1050
|
+
<meta charset="UTF-8">
|
|
1051
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
1052
|
+
<title>Order ${order.orderNumber} \u2014 Tracking</title>
|
|
1053
|
+
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
|
1054
|
+
<style>
|
|
1055
|
+
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
1056
|
+
|
|
1057
|
+
:root {
|
|
1058
|
+
--accent: ${sc.color};
|
|
1059
|
+
--bg: #f8f7f4;
|
|
1060
|
+
--card: #ffffff;
|
|
1061
|
+
--text: #1a1a2e;
|
|
1062
|
+
--muted: #6b7280;
|
|
1063
|
+
--border: #e5e7eb;
|
|
1064
|
+
--radius: 16px;
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
body {
|
|
1068
|
+
font-family: 'DM Sans', sans-serif;
|
|
1069
|
+
background: var(--bg);
|
|
1070
|
+
color: var(--text);
|
|
1071
|
+
min-height: 100vh;
|
|
1072
|
+
padding: 24px 16px 48px;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.container { max-width: 640px; margin: 0 auto; }
|
|
1076
|
+
|
|
1077
|
+
/* Header */
|
|
1078
|
+
.header {
|
|
1079
|
+
text-align: center;
|
|
1080
|
+
margin-bottom: 32px;
|
|
1081
|
+
animation: fadeDown 0.5s ease both;
|
|
1082
|
+
}
|
|
1083
|
+
.header-eyebrow {
|
|
1084
|
+
font-size: 12px;
|
|
1085
|
+
font-weight: 600;
|
|
1086
|
+
letter-spacing: 0.15em;
|
|
1087
|
+
text-transform: uppercase;
|
|
1088
|
+
color: var(--accent);
|
|
1089
|
+
margin-bottom: 8px;
|
|
1090
|
+
}
|
|
1091
|
+
.header h1 {
|
|
1092
|
+
font-family: 'Playfair Display', serif;
|
|
1093
|
+
font-size: clamp(26px, 6vw, 36px);
|
|
1094
|
+
color: var(--text);
|
|
1095
|
+
line-height: 1.2;
|
|
1096
|
+
}
|
|
1097
|
+
.header-meta {
|
|
1098
|
+
font-size: 13px;
|
|
1099
|
+
color: var(--muted);
|
|
1100
|
+
margin-top: 6px;
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/* Status badge */
|
|
1104
|
+
.status-badge {
|
|
1105
|
+
display: inline-flex;
|
|
1106
|
+
align-items: center;
|
|
1107
|
+
gap: 6px;
|
|
1108
|
+
background: color-mix(in srgb, var(--accent) 12%, transparent);
|
|
1109
|
+
color: var(--accent);
|
|
1110
|
+
border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
|
|
1111
|
+
border-radius: 100px;
|
|
1112
|
+
padding: 5px 14px;
|
|
1113
|
+
font-size: 13px;
|
|
1114
|
+
font-weight: 600;
|
|
1115
|
+
margin-top: 14px;
|
|
1116
|
+
}
|
|
1117
|
+
.status-dot {
|
|
1118
|
+
width: 7px; height: 7px;
|
|
1119
|
+
border-radius: 50%;
|
|
1120
|
+
background: var(--accent);
|
|
1121
|
+
animation: pulse 2s ease infinite;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/* Card */
|
|
1125
|
+
.card {
|
|
1126
|
+
background: var(--card);
|
|
1127
|
+
border-radius: var(--radius);
|
|
1128
|
+
border: 1px solid var(--border);
|
|
1129
|
+
overflow: hidden;
|
|
1130
|
+
margin-bottom: 16px;
|
|
1131
|
+
animation: fadeUp 0.5s ease both;
|
|
1132
|
+
}
|
|
1133
|
+
.card:nth-child(2) { animation-delay: 0.08s; }
|
|
1134
|
+
.card:nth-child(3) { animation-delay: 0.16s; }
|
|
1135
|
+
.card:nth-child(4) { animation-delay: 0.24s; }
|
|
1136
|
+
|
|
1137
|
+
.card-header {
|
|
1138
|
+
display: flex; align-items: center; gap: 10px;
|
|
1139
|
+
padding: 16px 20px;
|
|
1140
|
+
border-bottom: 1px solid var(--border);
|
|
1141
|
+
background: #fafafa;
|
|
1142
|
+
}
|
|
1143
|
+
.card-header-icon {
|
|
1144
|
+
width: 32px; height: 32px;
|
|
1145
|
+
border-radius: 8px;
|
|
1146
|
+
background: color-mix(in srgb, var(--accent) 12%, transparent);
|
|
1147
|
+
display: flex; align-items: center; justify-content: center;
|
|
1148
|
+
font-size: 15px;
|
|
1149
|
+
}
|
|
1150
|
+
.card-title {
|
|
1151
|
+
font-size: 13px;
|
|
1152
|
+
font-weight: 600;
|
|
1153
|
+
letter-spacing: 0.05em;
|
|
1154
|
+
text-transform: uppercase;
|
|
1155
|
+
color: var(--muted);
|
|
1156
|
+
}
|
|
1157
|
+
.card-body { padding: 20px; }
|
|
1158
|
+
|
|
1159
|
+
/* Progress tracker */
|
|
1160
|
+
.progress-track {
|
|
1161
|
+
display: flex;
|
|
1162
|
+
align-items: flex-start;
|
|
1163
|
+
justify-content: space-between;
|
|
1164
|
+
padding: 8px 0;
|
|
1165
|
+
overflow-x: auto;
|
|
1166
|
+
}
|
|
1167
|
+
.step {
|
|
1168
|
+
display: flex; flex-direction: column; align-items: center;
|
|
1169
|
+
gap: 8px; min-width: 60px;
|
|
1170
|
+
}
|
|
1171
|
+
.step-circle {
|
|
1172
|
+
width: 44px; height: 44px;
|
|
1173
|
+
border-radius: 50%;
|
|
1174
|
+
border: 2px solid var(--border);
|
|
1175
|
+
background: white;
|
|
1176
|
+
display: flex; align-items: center; justify-content: center;
|
|
1177
|
+
font-size: 18px;
|
|
1178
|
+
color: var(--muted);
|
|
1179
|
+
transition: all 0.3s;
|
|
1180
|
+
}
|
|
1181
|
+
.step.done .step-circle {
|
|
1182
|
+
background: color-mix(in srgb, var(--accent) 15%, white);
|
|
1183
|
+
border-color: var(--accent);
|
|
1184
|
+
color: var(--accent);
|
|
1185
|
+
font-size: 16px;
|
|
1186
|
+
font-weight: 700;
|
|
1187
|
+
}
|
|
1188
|
+
.step.active .step-circle {
|
|
1189
|
+
background: var(--accent);
|
|
1190
|
+
border-color: var(--accent);
|
|
1191
|
+
color: white;
|
|
1192
|
+
box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
|
|
1193
|
+
}
|
|
1194
|
+
.step-label {
|
|
1195
|
+
font-size: 11px; font-weight: 500; color: var(--muted);
|
|
1196
|
+
text-align: center; line-height: 1.3;
|
|
1197
|
+
}
|
|
1198
|
+
.step.active .step-label, .step.done .step-label { color: var(--accent); font-weight: 600; }
|
|
1199
|
+
.step-line {
|
|
1200
|
+
flex: 1; height: 2px;
|
|
1201
|
+
background: var(--border);
|
|
1202
|
+
margin-top: 22px; min-width: 20px;
|
|
1203
|
+
transition: background 0.3s;
|
|
1204
|
+
}
|
|
1205
|
+
.step-line.done { background: var(--accent); }
|
|
1206
|
+
.cancelled-banner {
|
|
1207
|
+
text-align: center; padding: 16px;
|
|
1208
|
+
background: #fef2f2; color: #ef4444;
|
|
1209
|
+
border-radius: 10px;
|
|
1210
|
+
font-weight: 600; font-size: 15px;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/* Info grid */
|
|
1214
|
+
.info-grid {
|
|
1215
|
+
display: grid;
|
|
1216
|
+
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
|
1217
|
+
gap: 16px;
|
|
1218
|
+
}
|
|
1219
|
+
.info-item dt {
|
|
1220
|
+
font-size: 11px; font-weight: 600;
|
|
1221
|
+
text-transform: uppercase; letter-spacing: 0.08em;
|
|
1222
|
+
color: var(--muted); margin-bottom: 4px;
|
|
1223
|
+
}
|
|
1224
|
+
.info-item dd { font-size: 14px; font-weight: 500; color: var(--text); }
|
|
1225
|
+
|
|
1226
|
+
/* Customer */
|
|
1227
|
+
.customer-row {
|
|
1228
|
+
display: flex; align-items: center; gap: 14px;
|
|
1229
|
+
}
|
|
1230
|
+
.customer-avatar {
|
|
1231
|
+
width: 46px; height: 46px; border-radius: 50%;
|
|
1232
|
+
background: color-mix(in srgb, var(--accent) 15%, #f3f4f6);
|
|
1233
|
+
color: var(--accent);
|
|
1234
|
+
display: flex; align-items: center; justify-content: center;
|
|
1235
|
+
font-family: 'Playfair Display', serif;
|
|
1236
|
+
font-size: 18px; font-weight: 700; flex-shrink: 0;
|
|
1237
|
+
}
|
|
1238
|
+
.customer-name { font-size: 15px; font-weight: 600; }
|
|
1239
|
+
.customer-email { font-size: 13px; color: var(--muted); margin-top: 2px; }
|
|
1240
|
+
|
|
1241
|
+
/* Items */
|
|
1242
|
+
.item-row {
|
|
1243
|
+
display: flex; align-items: center; gap: 12px;
|
|
1244
|
+
padding: 12px 0;
|
|
1245
|
+
border-bottom: 1px solid var(--border);
|
|
1246
|
+
}
|
|
1247
|
+
.item-row:last-child { border-bottom: none; padding-bottom: 0; }
|
|
1248
|
+
.item-row:first-child { padding-top: 0; }
|
|
1249
|
+
.item-avatar {
|
|
1250
|
+
width: 40px; height: 40px; border-radius: 10px;
|
|
1251
|
+
background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, #e5e7eb), color-mix(in srgb, var(--accent) 5%, #f9fafb));
|
|
1252
|
+
color: var(--accent);
|
|
1253
|
+
display: flex; align-items: center; justify-content: center;
|
|
1254
|
+
font-size: 16px; font-weight: 700; flex-shrink: 0;
|
|
1255
|
+
}
|
|
1256
|
+
.item-info { flex: 1; min-width: 0; }
|
|
1257
|
+
.item-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
1258
|
+
.item-sku { font-size: 12px; color: var(--muted); margin-top: 2px; }
|
|
1259
|
+
.item-qty { font-size: 13px; color: var(--muted); min-width: 28px; text-align: center; }
|
|
1260
|
+
.item-price { font-size: 14px; font-weight: 600; min-width: 80px; text-align: right; }
|
|
1261
|
+
|
|
1262
|
+
/* Summary */
|
|
1263
|
+
.summary-row {
|
|
1264
|
+
display: flex; justify-content: space-between;
|
|
1265
|
+
font-size: 14px; padding: 7px 0; color: var(--muted);
|
|
1266
|
+
}
|
|
1267
|
+
.summary-row.discount { color: #10b981; }
|
|
1268
|
+
.summary-row.total {
|
|
1269
|
+
font-size: 17px; font-weight: 700; color: var(--text);
|
|
1270
|
+
border-top: 2px solid var(--border); margin-top: 6px; padding-top: 14px;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/* Footer */
|
|
1274
|
+
.footer {
|
|
1275
|
+
text-align: center; margin-top: 32px;
|
|
1276
|
+
font-size: 12px; color: #9ca3af;
|
|
1277
|
+
animation: fadeUp 0.5s ease 0.4s both;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/* Animations */
|
|
1281
|
+
@keyframes fadeDown {
|
|
1282
|
+
from { opacity: 0; transform: translateY(-16px); }
|
|
1283
|
+
to { opacity: 1; transform: translateY(0); }
|
|
1284
|
+
}
|
|
1285
|
+
@keyframes fadeUp {
|
|
1286
|
+
from { opacity: 0; transform: translateY(16px); }
|
|
1287
|
+
to { opacity: 1; transform: translateY(0); }
|
|
1288
|
+
}
|
|
1289
|
+
@keyframes pulse {
|
|
1290
|
+
0%, 100% { opacity: 1; }
|
|
1291
|
+
50% { opacity: 0.4; }
|
|
1292
|
+
}
|
|
1293
|
+
</style>
|
|
1294
|
+
</head>
|
|
1295
|
+
<body>
|
|
1296
|
+
<div class="container">
|
|
1297
|
+
|
|
1298
|
+
<!-- Header -->
|
|
1299
|
+
<div class="header">
|
|
1300
|
+
<div class="header-eyebrow">Order Tracking</div>
|
|
1301
|
+
<h1>${String(order.orderNumber)}</h1>
|
|
1302
|
+
<div class="header-meta">Placed on ${formatDate(String(order.createdAt))}</div>
|
|
1303
|
+
<div><span class="status-badge"><span class="status-dot"></span>${sc.label}</span></div>
|
|
1304
|
+
</div>
|
|
1305
|
+
|
|
1306
|
+
<!-- Progress -->
|
|
1307
|
+
<div class="card">
|
|
1308
|
+
<div class="card-header">
|
|
1309
|
+
<div class="card-header-icon">\u{1F69A}</div>
|
|
1310
|
+
<div class="card-title">Order Progress</div>
|
|
1311
|
+
</div>
|
|
1312
|
+
<div class="card-body">
|
|
1313
|
+
<div class="progress-track">${stepsHtml}</div>
|
|
1314
|
+
</div>
|
|
1315
|
+
</div>
|
|
1316
|
+
|
|
1317
|
+
${contact ? `
|
|
1318
|
+
<!-- Customer -->
|
|
1319
|
+
<div class="card">
|
|
1320
|
+
<div class="card-header">
|
|
1321
|
+
<div class="card-header-icon">\u{1F464}</div>
|
|
1322
|
+
<div class="card-title">Customer</div>
|
|
1323
|
+
</div>
|
|
1324
|
+
<div class="card-body">
|
|
1325
|
+
<div class="customer-row">
|
|
1326
|
+
<div class="customer-avatar">${String(contact.name ?? "?").charAt(0).toUpperCase()}</div>
|
|
1327
|
+
<div>
|
|
1328
|
+
<div class="customer-name">${String(contact.name ?? "\u2014")}</div>
|
|
1329
|
+
<div class="customer-email">${String(contact.email ?? "\u2014")}</div>
|
|
1330
|
+
${contact.phone ? `<div class="customer-email">${String(contact.phone)}</div>` : ""}
|
|
1331
|
+
</div>
|
|
1332
|
+
</div>
|
|
1333
|
+
</div>
|
|
1334
|
+
</div>` : ""}
|
|
1335
|
+
|
|
1336
|
+
<!-- Items -->
|
|
1337
|
+
<div class="card">
|
|
1338
|
+
<div class="card-header">
|
|
1339
|
+
<div class="card-header-icon">\u{1F4E6}</div>
|
|
1340
|
+
<div class="card-title">Items (${items.length})</div>
|
|
1341
|
+
</div>
|
|
1342
|
+
<div class="card-body">
|
|
1343
|
+
${items.length === 0 ? '<p style="color:var(--muted);font-size:14px;">No items</p>' : itemsHtml}
|
|
1344
|
+
</div>
|
|
1345
|
+
</div>
|
|
1346
|
+
|
|
1347
|
+
<!-- Summary -->
|
|
1348
|
+
<div class="card">
|
|
1349
|
+
<div class="card-header">
|
|
1350
|
+
<div class="card-header-icon">\u{1F9FE}</div>
|
|
1351
|
+
<div class="card-title">Order Summary</div>
|
|
1352
|
+
</div>
|
|
1353
|
+
<div class="card-body">
|
|
1354
|
+
<div class="summary-row"><span>Subtotal</span><span>${formatMoney(Number(order.subtotal))}</span></div>
|
|
1355
|
+
${discountRow}
|
|
1356
|
+
${taxRow}
|
|
1357
|
+
<div class="summary-row total"><span>Total</span><span>${formatMoney(Number(order.total))}</span></div>
|
|
1358
|
+
</div>
|
|
1359
|
+
</div>
|
|
1360
|
+
|
|
1361
|
+
<div class="footer">Scan the QR code on your receipt to return to this page.</div>
|
|
1362
|
+
</div>
|
|
1363
|
+
</body>
|
|
1364
|
+
</html>`;
|
|
1365
|
+
}
|
|
1366
|
+
var init_OrderTrackPage = __esm({
|
|
1367
|
+
"src/admin/pages/OrderTrackPage.ts"() {
|
|
1368
|
+
"use strict";
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
|
|
900
1372
|
// src/api/crud.ts
|
|
901
1373
|
import { Between, ILike, LessThanOrEqual, MoreThan, MoreThanOrEqual, Not } from "typeorm";
|
|
902
1374
|
|
|
903
1375
|
// src/api/vendor-scope-crud.ts
|
|
904
1376
|
init_vendor_scope();
|
|
905
1377
|
import { In } from "typeorm";
|
|
1378
|
+
|
|
1379
|
+
// src/lib/default-vendor-id.ts
|
|
1380
|
+
function getDefaultVendorId() {
|
|
1381
|
+
const raw = process.env.DEFAULT_VENDOR_ID;
|
|
1382
|
+
if (raw != null && String(raw).trim() !== "") {
|
|
1383
|
+
const n = Number(raw);
|
|
1384
|
+
if (Number.isFinite(n) && n > 0) return Math.floor(n);
|
|
1385
|
+
}
|
|
1386
|
+
return 1;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
// src/api/vendor-scope-crud.ts
|
|
906
1390
|
function repoHasVendorIdColumn(repo) {
|
|
907
1391
|
return repo.metadata.columns.some((c) => c.propertyName === "vendorId");
|
|
908
1392
|
}
|
|
@@ -949,26 +1433,39 @@ function rowMatchesVendorScope(row, scope, resource) {
|
|
|
949
1433
|
}
|
|
950
1434
|
return Number(row.vendorId) === scope.vendorId;
|
|
951
1435
|
}
|
|
1436
|
+
function vendorScopeRowAccess(row, scope, resource) {
|
|
1437
|
+
if (!row) return "not_found";
|
|
1438
|
+
if (rowMatchesVendorScope(row, scope, resource)) return "ok";
|
|
1439
|
+
return scope.type === "vendor" ? "forbidden" : "not_found";
|
|
1440
|
+
}
|
|
952
1441
|
function enforceVendorIdOnCreateBody(body, scope, repo) {
|
|
953
1442
|
if (!repoHasVendorIdColumn(repo)) return;
|
|
954
1443
|
if (scope.type === "vendor") {
|
|
1444
|
+
delete body.vendorId;
|
|
955
1445
|
body.vendorId = scope.vendorId;
|
|
956
1446
|
}
|
|
957
1447
|
}
|
|
958
|
-
function
|
|
1448
|
+
function resolveVendorIdForWrite(scope, session, rawBody) {
|
|
1449
|
+
if (scope.type === "vendor") return scope.vendorId;
|
|
1450
|
+
if (scope.type === "deny") return null;
|
|
1451
|
+
if (rawBody) {
|
|
1452
|
+
const fromBody = Number(rawBody.vendorId);
|
|
1453
|
+
if (Number.isFinite(fromBody) && fromBody > 0) return fromBody;
|
|
1454
|
+
}
|
|
1455
|
+
const active = session?.activeVendorId;
|
|
1456
|
+
if (active != null && Number.isFinite(Number(active)) && Number(active) > 0) {
|
|
1457
|
+
return Number(active);
|
|
1458
|
+
}
|
|
1459
|
+
return getDefaultVendorId();
|
|
1460
|
+
}
|
|
1461
|
+
function requireVendorIdForScopedCreate(resource, persistBody, scope, repo, context) {
|
|
959
1462
|
if (!resourceUsesVendorScope(resource) || !repoHasVendorIdColumn(repo)) {
|
|
960
1463
|
return { ok: true };
|
|
961
1464
|
}
|
|
1465
|
+
const ctx = context && ("session" in context || "rawBody" in context) ? context : { rawBody: context };
|
|
962
1466
|
enforceVendorIdOnCreateBody(persistBody, scope, repo);
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
if (scope.type === "all" && rawBody) {
|
|
966
|
-
const n = Number(rawBody.vendorId);
|
|
967
|
-
if (Number.isFinite(n) && n > 0) {
|
|
968
|
-
persistBody.vendorId = n;
|
|
969
|
-
return { ok: true };
|
|
970
|
-
}
|
|
971
|
-
return { ok: false, error: "vendorId is required", status: 400 };
|
|
1467
|
+
if (scope.type === "vendor") {
|
|
1468
|
+
return { ok: true };
|
|
972
1469
|
}
|
|
973
1470
|
if (scope.type === "deny") {
|
|
974
1471
|
return {
|
|
@@ -977,6 +1474,13 @@ function requireVendorIdForScopedCreate(resource, persistBody, scope, repo, rawB
|
|
|
977
1474
|
status: 403
|
|
978
1475
|
};
|
|
979
1476
|
}
|
|
1477
|
+
const vid = Number(persistBody.vendorId);
|
|
1478
|
+
if (Number.isFinite(vid) && vid > 0) return { ok: true };
|
|
1479
|
+
const resolved = resolveVendorIdForWrite(scope, ctx.session ?? null, ctx.rawBody ?? persistBody);
|
|
1480
|
+
if (resolved != null && resolved > 0) {
|
|
1481
|
+
persistBody.vendorId = resolved;
|
|
1482
|
+
return { ok: true };
|
|
1483
|
+
}
|
|
980
1484
|
return { ok: false, error: "vendorId is required", status: 400 };
|
|
981
1485
|
}
|
|
982
1486
|
|
|
@@ -1126,17 +1630,37 @@ async function contactIsVendorCustomer(dataSource, entityMap, vendorId, contactI
|
|
|
1126
1630
|
const contactEntity = entityMap.contacts;
|
|
1127
1631
|
if (!vcEntity || !contactEntity) return false;
|
|
1128
1632
|
const vcRepo = dataSource.getRepository(vcEntity);
|
|
1129
|
-
const link = await vcRepo.findOne({
|
|
1130
|
-
where: { vendorId, contactId }
|
|
1131
|
-
});
|
|
1132
|
-
if (!link) return false;
|
|
1133
1633
|
const contactRepo = dataSource.getRepository(contactEntity);
|
|
1134
1634
|
const contact = await contactRepo.findOne({
|
|
1135
1635
|
where: { id: contactId, deleted: false }
|
|
1136
1636
|
});
|
|
1137
1637
|
if (!contact) return false;
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1638
|
+
const email = contact.email;
|
|
1639
|
+
if (entityMap.customer && email) {
|
|
1640
|
+
const customerRepo = dataSource.getRepository(entityMap.customer);
|
|
1641
|
+
const customer = await customerRepo.findOne({
|
|
1642
|
+
where: { email, deleted: false }
|
|
1643
|
+
});
|
|
1644
|
+
if (customer) {
|
|
1645
|
+
const customerId = Number(customer.id);
|
|
1646
|
+
const customerLink = await vcRepo.findOne({
|
|
1647
|
+
where: { vendorId, customerId }
|
|
1648
|
+
});
|
|
1649
|
+
if (customerLink != null) return true;
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
const vcMeta = dataSource.getRepository(vcEntity).metadata;
|
|
1653
|
+
const hasContactIdCol = vcMeta.columns.some((c) => c.propertyName === "contactId");
|
|
1654
|
+
if (hasContactIdCol) {
|
|
1655
|
+
const directLink = await vcRepo.findOne({
|
|
1656
|
+
where: { vendorId, contactId }
|
|
1657
|
+
});
|
|
1658
|
+
if (directLink) {
|
|
1659
|
+
const t = contact.type;
|
|
1660
|
+
return t == null || t == "" || isCustomerTypeContact(t);
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
return false;
|
|
1140
1664
|
}
|
|
1141
1665
|
async function assertContactAllowedForVendorOrder(dataSource, entityMap, vendorId, contactId) {
|
|
1142
1666
|
if (!Number.isFinite(contactId)) {
|
|
@@ -2447,9 +2971,13 @@ async function calculateOrderTotals(dataSource, entityMap, itemsSummary, discoun
|
|
|
2447
2971
|
};
|
|
2448
2972
|
}
|
|
2449
2973
|
function createCrudHandler(dataSource, entityMap, options) {
|
|
2450
|
-
const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getVendorScope } = options;
|
|
2974
|
+
const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getVendorScope, getHydratedSessionUser } = options;
|
|
2451
2975
|
const syncContactRowToErp = makeContactErpSync(dataSource, entityMap, getCms);
|
|
2452
2976
|
const resolveScope = getVendorScope ?? (async () => ({ type: "all" }));
|
|
2977
|
+
async function vendorCreateContext(rawBody) {
|
|
2978
|
+
const session = await getHydratedSessionUser?.() ?? null;
|
|
2979
|
+
return { rawBody, session };
|
|
2980
|
+
}
|
|
2453
2981
|
async function authz(req, resource, action) {
|
|
2454
2982
|
const authError = await requireAuth(req);
|
|
2455
2983
|
if (authError) return authError;
|
|
@@ -2713,34 +3241,27 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
2713
3241
|
});
|
|
2714
3242
|
return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
|
|
2715
3243
|
}
|
|
2716
|
-
if (resource === "vendor_customers" && entityMap
|
|
3244
|
+
if (resource === "vendor_customers" && entityMap["customer"]) {
|
|
2717
3245
|
const scope = await resolveScope();
|
|
2718
3246
|
const repo2 = dataSource.getRepository(entity);
|
|
2719
|
-
const qb = repo2.createQueryBuilder("vc").leftJoinAndSelect("vc.
|
|
3247
|
+
const qb = repo2.createQueryBuilder("vc").leftJoinAndSelect("vc.customer", "customer").leftJoinAndSelect("customer.user", "user").orderBy("vc.createdAt", sortOrder === "DESC" ? "DESC" : "ASC").skip(skip).take(limit);
|
|
2720
3248
|
applyVendorScopeToQueryBuilder(qb, "vc", scope);
|
|
2721
3249
|
if (search && typeof search === "string" && search.trim()) {
|
|
2722
3250
|
const term = `%${search.trim()}%`;
|
|
2723
3251
|
qb.andWhere(
|
|
2724
|
-
"(
|
|
3252
|
+
"(customer.name ILIKE :term OR customer.email ILIKE :term OR customer.phone ILIKE :term)",
|
|
2725
3253
|
{ term }
|
|
2726
3254
|
);
|
|
2727
3255
|
}
|
|
2728
3256
|
const [rows, total2] = await qb.getManyAndCount();
|
|
2729
3257
|
const data2 = rows.map((row) => {
|
|
2730
|
-
const
|
|
3258
|
+
const customer = row.customer;
|
|
2731
3259
|
return {
|
|
2732
3260
|
...row,
|
|
2733
|
-
name:
|
|
2734
|
-
email:
|
|
2735
|
-
phone:
|
|
2736
|
-
company:
|
|
2737
|
-
contact: contact ? {
|
|
2738
|
-
id: contact.id,
|
|
2739
|
-
name: contact.name,
|
|
2740
|
-
email: contact.email,
|
|
2741
|
-
phone: contact.phone,
|
|
2742
|
-
company: contact.company
|
|
2743
|
-
} : null
|
|
3261
|
+
name: customer?.name ?? null,
|
|
3262
|
+
email: customer?.email ?? null,
|
|
3263
|
+
phone: customer?.phone ?? null,
|
|
3264
|
+
company: customer?.company ?? null
|
|
2744
3265
|
};
|
|
2745
3266
|
});
|
|
2746
3267
|
return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
|
|
@@ -3000,7 +3521,7 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
3000
3521
|
persistBody2,
|
|
3001
3522
|
scopeDiscount,
|
|
3002
3523
|
repo2,
|
|
3003
|
-
body
|
|
3524
|
+
await vendorCreateContext(body)
|
|
3004
3525
|
);
|
|
3005
3526
|
if (!vendorIdCheck2.ok) {
|
|
3006
3527
|
return json({ error: vendorIdCheck2.error }, { status: vendorIdCheck2.status });
|
|
@@ -3028,6 +3549,135 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
3028
3549
|
});
|
|
3029
3550
|
return json(reloaded ?? created2, { status: 201 });
|
|
3030
3551
|
}
|
|
3552
|
+
if (resource === "vendor_customers") {
|
|
3553
|
+
if (!entityMap["customer"]) {
|
|
3554
|
+
return json({ error: "Customer entity not configured" }, { status: 503 });
|
|
3555
|
+
}
|
|
3556
|
+
if (!entityMap["users"]) {
|
|
3557
|
+
return json({ error: "Users entity not configured" }, { status: 503 });
|
|
3558
|
+
}
|
|
3559
|
+
let customerGroupId = null;
|
|
3560
|
+
if (entityMap["user_groups"]) {
|
|
3561
|
+
const userGroupRepo = dataSource.getRepository(entityMap["user_groups"]);
|
|
3562
|
+
const customerGroup = await userGroupRepo.findOne({
|
|
3563
|
+
where: { name: "Customer", deleted: false }
|
|
3564
|
+
});
|
|
3565
|
+
if (!customerGroup) {
|
|
3566
|
+
return json({ error: "User group 'customer' not found" }, { status: 500 });
|
|
3567
|
+
}
|
|
3568
|
+
customerGroupId = Number(customerGroup.id);
|
|
3569
|
+
} else {
|
|
3570
|
+
return json({ error: "user_groups entity not configured" }, { status: 503 });
|
|
3571
|
+
}
|
|
3572
|
+
const name = String(body.name ?? "").trim();
|
|
3573
|
+
const email = String(body.email ?? "").trim();
|
|
3574
|
+
const phone = String(body.phone ?? "").trim();
|
|
3575
|
+
const rawPw = String(body._password ?? "").trim();
|
|
3576
|
+
if (!name) return json({ error: "name is required" }, { status: 400 });
|
|
3577
|
+
if (!email) return json({ error: "email is required" }, { status: 400 });
|
|
3578
|
+
if (!phone) return json({ error: "phone is required" }, { status: 400 });
|
|
3579
|
+
if (!rawPw) return json({ error: "password is required" }, { status: 400 });
|
|
3580
|
+
if (rawPw.length < 6) {
|
|
3581
|
+
return json({ error: "Password must be at least 6 characters" }, { status: 400 });
|
|
3582
|
+
}
|
|
3583
|
+
const customerRepo = dataSource.getRepository(entityMap["customer"]);
|
|
3584
|
+
const userRepo = dataSource.getRepository(entityMap["users"]);
|
|
3585
|
+
const dupCustEmail = await customerRepo.findOne({
|
|
3586
|
+
where: { email, deleted: false }
|
|
3587
|
+
});
|
|
3588
|
+
if (dupCustEmail) {
|
|
3589
|
+
return json({ error: "A customer with this email already exists" }, { status: 409 });
|
|
3590
|
+
}
|
|
3591
|
+
const dupCustPhone = await customerRepo.findOne({
|
|
3592
|
+
where: { phone, deleted: false }
|
|
3593
|
+
});
|
|
3594
|
+
if (dupCustPhone) {
|
|
3595
|
+
return json({ error: "A customer with this phone number already exists" }, { status: 409 });
|
|
3596
|
+
}
|
|
3597
|
+
let userId;
|
|
3598
|
+
const dupUser = await userRepo.findOne({
|
|
3599
|
+
where: { email, deleted: false }
|
|
3600
|
+
});
|
|
3601
|
+
if (dupUser) {
|
|
3602
|
+
userId = Number(dupUser.id);
|
|
3603
|
+
} else {
|
|
3604
|
+
const bcrypt = await import("bcryptjs");
|
|
3605
|
+
const hashedPassword = await bcrypt.hash(rawPw, 10);
|
|
3606
|
+
const savedUser = await userRepo.save(
|
|
3607
|
+
userRepo.create({
|
|
3608
|
+
name,
|
|
3609
|
+
email,
|
|
3610
|
+
phone,
|
|
3611
|
+
password: hashedPassword,
|
|
3612
|
+
groupId: customerGroupId,
|
|
3613
|
+
adminAccess: false,
|
|
3614
|
+
blocked: false
|
|
3615
|
+
})
|
|
3616
|
+
);
|
|
3617
|
+
userId = Number(savedUser.id);
|
|
3618
|
+
}
|
|
3619
|
+
const { _password, ...customerFields } = body;
|
|
3620
|
+
const customerRepo2 = dataSource.getRepository(entityMap["customer"]);
|
|
3621
|
+
const persistCustomer = pickColumnUpdates(customerRepo2, {
|
|
3622
|
+
...customerFields,
|
|
3623
|
+
name,
|
|
3624
|
+
email,
|
|
3625
|
+
phone,
|
|
3626
|
+
userId
|
|
3627
|
+
});
|
|
3628
|
+
sanitizeBodyForEntity(customerRepo2, persistCustomer);
|
|
3629
|
+
const savedCustomer = await customerRepo2.save(
|
|
3630
|
+
customerRepo2.create(persistCustomer)
|
|
3631
|
+
);
|
|
3632
|
+
if (entityMap["contacts"]) {
|
|
3633
|
+
const contactRepo = dataSource.getRepository(entityMap["contacts"]);
|
|
3634
|
+
const existingContact = await contactRepo.findOne({
|
|
3635
|
+
where: { email, deleted: false }
|
|
3636
|
+
});
|
|
3637
|
+
if (!existingContact) {
|
|
3638
|
+
await contactRepo.save(
|
|
3639
|
+
contactRepo.create({
|
|
3640
|
+
name,
|
|
3641
|
+
email,
|
|
3642
|
+
phone: phone || null,
|
|
3643
|
+
type: "customer"
|
|
3644
|
+
})
|
|
3645
|
+
);
|
|
3646
|
+
} else {
|
|
3647
|
+
const t = existingContact.type;
|
|
3648
|
+
if (t == null || t === "" || String(t).toLowerCase() !== "customer") {
|
|
3649
|
+
await contactRepo.update(
|
|
3650
|
+
existingContact.id,
|
|
3651
|
+
{ type: "customer" }
|
|
3652
|
+
);
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
const scope = await resolveScope();
|
|
3657
|
+
let vendorId = null;
|
|
3658
|
+
if (scope.type === "vendor") {
|
|
3659
|
+
vendorId = scope.vendorId;
|
|
3660
|
+
} else if (scope.type === "all") {
|
|
3661
|
+
const n = Number(body.vendorId);
|
|
3662
|
+
if (Number.isFinite(n)) vendorId = n;
|
|
3663
|
+
}
|
|
3664
|
+
if (vendorId == null) {
|
|
3665
|
+
return json({ error: "Vendor scope required to link customer" }, { status: 400 });
|
|
3666
|
+
}
|
|
3667
|
+
const vcRepo = dataSource.getRepository(entity);
|
|
3668
|
+
const existingLink = await vcRepo.findOne({
|
|
3669
|
+
where: { customerId: savedCustomer.id }
|
|
3670
|
+
});
|
|
3671
|
+
if (!existingLink) {
|
|
3672
|
+
await vcRepo.save(
|
|
3673
|
+
vcRepo.create({
|
|
3674
|
+
customerId: savedCustomer.id,
|
|
3675
|
+
vendorId
|
|
3676
|
+
})
|
|
3677
|
+
);
|
|
3678
|
+
}
|
|
3679
|
+
return json(savedCustomer, { status: 201 });
|
|
3680
|
+
}
|
|
3031
3681
|
if (resource === "media") {
|
|
3032
3682
|
const b = body;
|
|
3033
3683
|
const kind = b.kind === "folder" ? "folder" : "file";
|
|
@@ -3098,12 +3748,23 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
3098
3748
|
if ((resource === "orders" || resource === "payments") && persistBody.contactId != null && entityMap.vendor_customers) {
|
|
3099
3749
|
const scopeOrder = await resolveScope();
|
|
3100
3750
|
const vendorId = resolveVendorIdForContactCheck(scopeOrder, persistBody);
|
|
3751
|
+
console.log("[ORDER CREATE] vendor check", {
|
|
3752
|
+
resource,
|
|
3753
|
+
contactId: persistBody.contactId,
|
|
3754
|
+
vendorId,
|
|
3755
|
+
scopeType: scopeOrder.type,
|
|
3756
|
+
persistBodyVendorId: persistBody.vendorId,
|
|
3757
|
+
hasVendorCustomers: !!entityMap.vendor_customers,
|
|
3758
|
+
hasCustomer: !!entityMap.customer,
|
|
3759
|
+
hasContacts: !!entityMap.contacts
|
|
3760
|
+
});
|
|
3101
3761
|
const contactErr = await assertContactAllowedForVendorOrder(
|
|
3102
3762
|
dataSource,
|
|
3103
3763
|
entityMap,
|
|
3104
3764
|
vendorId ?? NaN,
|
|
3105
3765
|
Number(persistBody.contactId)
|
|
3106
3766
|
);
|
|
3767
|
+
console.log("[ORDER CREATE] vendor check result:", contactErr);
|
|
3107
3768
|
if (contactErr) {
|
|
3108
3769
|
return json({ error: contactErr }, { status: 400 });
|
|
3109
3770
|
}
|
|
@@ -3192,7 +3853,13 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
3192
3853
|
}
|
|
3193
3854
|
const scopeCreate = await resolveScope();
|
|
3194
3855
|
await tryAssignSingleVendorOnAdminCreate(resource, scopeCreate, persistBody);
|
|
3195
|
-
const vendorIdCheck = requireVendorIdForScopedCreate(
|
|
3856
|
+
const vendorIdCheck = requireVendorIdForScopedCreate(
|
|
3857
|
+
resource,
|
|
3858
|
+
persistBody,
|
|
3859
|
+
scopeCreate,
|
|
3860
|
+
repo,
|
|
3861
|
+
await vendorCreateContext(body)
|
|
3862
|
+
);
|
|
3196
3863
|
if (!vendorIdCheck.ok) {
|
|
3197
3864
|
return json({ error: vendorIdCheck.error }, { status: vendorIdCheck.status });
|
|
3198
3865
|
}
|
|
@@ -3522,6 +4189,12 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3522
4189
|
const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getDeletedByUserId, getVendorScope } = options;
|
|
3523
4190
|
const syncContactRowToErp = makeContactErpSync(dataSource, entityMap, getCms);
|
|
3524
4191
|
const resolveScopeById = getVendorScope ?? (async () => ({ type: "all" }));
|
|
4192
|
+
function vendorScopeAccessJson(row, scope, resource) {
|
|
4193
|
+
const access = vendorScopeRowAccess(row, scope, resource);
|
|
4194
|
+
if (access === "ok") return null;
|
|
4195
|
+
if (access === "forbidden") return json({ error: "Forbidden" }, { status: 403 });
|
|
4196
|
+
return json({ message: "Not found" }, { status: 404 });
|
|
4197
|
+
}
|
|
3525
4198
|
async function authz(req, resource, action) {
|
|
3526
4199
|
const authError = await requireAuth(req);
|
|
3527
4200
|
if (authError) return authError;
|
|
@@ -3565,9 +4238,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3565
4238
|
where: { id: Number(id) },
|
|
3566
4239
|
relations: ["rules"]
|
|
3567
4240
|
});
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
}
|
|
4241
|
+
const discountDenied = vendorScopeAccessJson(discount, scope2, resource);
|
|
4242
|
+
if (discountDenied) return discountDenied;
|
|
3571
4243
|
const flatRules = discount.rules ?? [];
|
|
3572
4244
|
const nestedRules = nestDiscountRules2(flatRules);
|
|
3573
4245
|
let storeCurrency = "INR";
|
|
@@ -3605,9 +4277,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3605
4277
|
where: { id: Number(id), deleted: false },
|
|
3606
4278
|
relations: ["contact", "billingAddress", "shippingAddress", "items", "items.product", "items.product.collection", "payments"]
|
|
3607
4279
|
});
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
}
|
|
4280
|
+
const orderDenied = vendorScopeAccessJson(order, scope2, resource);
|
|
4281
|
+
if (orderDenied) return orderDenied;
|
|
3611
4282
|
const relatedOrders = await repo.find({
|
|
3612
4283
|
where: { parentOrderId: Number(id), deleted: false },
|
|
3613
4284
|
order: { id: "ASC" }
|
|
@@ -3642,9 +4313,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3642
4313
|
where: { id: Number(id), deleted: false },
|
|
3643
4314
|
relations: ["order", "order.contact", "contact"]
|
|
3644
4315
|
});
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
}
|
|
4316
|
+
const paymentDenied = vendorScopeAccessJson(payment, scope2, resource);
|
|
4317
|
+
if (paymentDenied) return paymentDenied;
|
|
3648
4318
|
const p = payment;
|
|
3649
4319
|
const order = p.order;
|
|
3650
4320
|
const orderContact = order?.contact;
|
|
@@ -3657,10 +4327,13 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3657
4327
|
});
|
|
3658
4328
|
}
|
|
3659
4329
|
if (resource === "products") {
|
|
4330
|
+
const scope2 = await resolveScopeById();
|
|
3660
4331
|
const product = await repo.findOne({
|
|
3661
4332
|
where: { id: Number(id), deleted: false },
|
|
3662
4333
|
relations: ["collection", "brand", "category", "attributes", "attributes.attribute"]
|
|
3663
4334
|
});
|
|
4335
|
+
const productDenied = vendorScopeAccessJson(product, scope2, resource);
|
|
4336
|
+
if (productDenied) return productDenied;
|
|
3664
4337
|
return product ? json(product) : json({ message: "Not found" }, { status: 404 });
|
|
3665
4338
|
}
|
|
3666
4339
|
if (resource === "vendor_customers" && entityMap.contacts) {
|
|
@@ -3669,9 +4342,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3669
4342
|
where: { id: Number(id) },
|
|
3670
4343
|
relations: ["contact"]
|
|
3671
4344
|
});
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
}
|
|
4345
|
+
const vcDenied = vendorScopeAccessJson(row, scope2, resource);
|
|
4346
|
+
if (vcDenied) return vcDenied;
|
|
3675
4347
|
const contact = row.contact;
|
|
3676
4348
|
return json({
|
|
3677
4349
|
...row,
|
|
@@ -3691,7 +4363,10 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3691
4363
|
const scope = await resolveScopeById();
|
|
3692
4364
|
const idWhere = entityHasSoftDelete(repo) ? { id: Number(id), deleted: false } : { id: Number(id) };
|
|
3693
4365
|
const item = await repo.findOne({ where: idWhere });
|
|
3694
|
-
if (
|
|
4366
|
+
if (resourceUsesVendorScope(resource)) {
|
|
4367
|
+
const itemDenied = vendorScopeAccessJson(item, scope, resource);
|
|
4368
|
+
if (itemDenied) return itemDenied;
|
|
4369
|
+
} else if (!item) {
|
|
3695
4370
|
return json({ message: "Not found" }, { status: 404 });
|
|
3696
4371
|
}
|
|
3697
4372
|
return json(item);
|
|
@@ -3955,9 +4630,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3955
4630
|
const existing = await repo.findOne({
|
|
3956
4631
|
where: { id: numericId }
|
|
3957
4632
|
});
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
}
|
|
4633
|
+
const discountPutDenied = vendorScopeAccessJson(existing, scopePut2, resource);
|
|
4634
|
+
if (discountPutDenied) return discountPutDenied;
|
|
3961
4635
|
const updatePayload2 = pickColumnUpdates(repo, rawBody);
|
|
3962
4636
|
delete updatePayload2.vendorId;
|
|
3963
4637
|
if (!rawBody.isAutomatic && rawBody.couponCode != null && String(rawBody.couponCode).trim() !== "") {
|
|
@@ -3991,9 +4665,12 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
3991
4665
|
if (resourceUsesVendorScope(resource)) {
|
|
3992
4666
|
const idWhereCheck = entityHasSoftDelete(repo) ? { id: numericId, deleted: false } : { id: numericId };
|
|
3993
4667
|
const existingScope = await repo.findOne({ where: idWhereCheck });
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4668
|
+
const scopePutDenied = vendorScopeAccessJson(
|
|
4669
|
+
existingScope,
|
|
4670
|
+
scopePut,
|
|
4671
|
+
resource
|
|
4672
|
+
);
|
|
4673
|
+
if (scopePutDenied) return scopePutDenied;
|
|
3997
4674
|
}
|
|
3998
4675
|
const updatePayload = rawBody && typeof rawBody === "object" ? pickColumnUpdates(repo, rawBody) : {};
|
|
3999
4676
|
if (resourceUsesVendorScope(resource)) {
|
|
@@ -4153,11 +4830,17 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
4153
4830
|
}
|
|
4154
4831
|
const repo = dataSource.getRepository(entity);
|
|
4155
4832
|
const numericId = Number(id);
|
|
4833
|
+
const scopeDelete = await resolveScopeById();
|
|
4156
4834
|
if (entityHasSoftDelete(repo)) {
|
|
4157
4835
|
const existing = await repo.findOne({
|
|
4158
4836
|
where: { id: numericId, deleted: false }
|
|
4159
4837
|
});
|
|
4160
|
-
if (
|
|
4838
|
+
if (resourceUsesVendorScope(resource)) {
|
|
4839
|
+
const deleteDenied = vendorScopeAccessJson(existing, scopeDelete, resource);
|
|
4840
|
+
if (deleteDenied) return deleteDenied;
|
|
4841
|
+
} else if (!existing) {
|
|
4842
|
+
return json({ message: "Not found" }, { status: 404 });
|
|
4843
|
+
}
|
|
4161
4844
|
if (resource === "contacts") {
|
|
4162
4845
|
const result2 = await repo.delete(numericId);
|
|
4163
4846
|
if (result2.affected === 0) return json({ message: "Not found" }, { status: 404 });
|
|
@@ -4192,6 +4875,17 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
|
|
|
4192
4875
|
await repo.update(numericId, buildSoftDeletePayload(repo.metadata, deletedBy));
|
|
4193
4876
|
return json({ message: "Deleted successfully" }, { status: 200 });
|
|
4194
4877
|
}
|
|
4878
|
+
if (resourceUsesVendorScope(resource)) {
|
|
4879
|
+
const existingHard = await repo.findOne({
|
|
4880
|
+
where: { id: numericId }
|
|
4881
|
+
});
|
|
4882
|
+
const hardDeleteDenied = vendorScopeAccessJson(
|
|
4883
|
+
existingHard,
|
|
4884
|
+
scopeDelete,
|
|
4885
|
+
resource
|
|
4886
|
+
);
|
|
4887
|
+
if (hardDeleteDenied) return hardDeleteDenied;
|
|
4888
|
+
}
|
|
4195
4889
|
const result = await repo.delete(numericId);
|
|
4196
4890
|
if (result.affected === 0) return json({ message: "Not found" }, { status: 404 });
|
|
4197
4891
|
return json({ message: "Deleted successfully" }, { status: 200 });
|
|
@@ -7830,9 +8524,54 @@ function createAdminRolesHandlers(config) {
|
|
|
7830
8524
|
|
|
7831
8525
|
// src/api/vendor-handlers.ts
|
|
7832
8526
|
init_vendor_scope();
|
|
7833
|
-
init_email_queue();
|
|
7834
8527
|
init_vendor_invite_status();
|
|
7835
8528
|
import { In as In4 } from "typeorm";
|
|
8529
|
+
|
|
8530
|
+
// src/lib/send-vendor-onboard-emails.ts
|
|
8531
|
+
init_email_queue();
|
|
8532
|
+
async function getSettingsGroup(deps, group) {
|
|
8533
|
+
const ds = await deps.getDataSource();
|
|
8534
|
+
const rows = await ds.getRepository(deps.entityMap.configs).find({
|
|
8535
|
+
where: { settings: group, deleted: false }
|
|
8536
|
+
});
|
|
8537
|
+
return Object.fromEntries(
|
|
8538
|
+
rows.map((r) => [r.key, r.value])
|
|
8539
|
+
);
|
|
8540
|
+
}
|
|
8541
|
+
async function sendVendorOnboardEmails(input, deps) {
|
|
8542
|
+
let ownerEmailSent = false;
|
|
8543
|
+
try {
|
|
8544
|
+
const [branding, emailSettings] = await Promise.all([
|
|
8545
|
+
getSettingsGroup(deps, "branding"),
|
|
8546
|
+
getSettingsGroup(deps, "email")
|
|
8547
|
+
]);
|
|
8548
|
+
const companyDetails = mergeEmailLayoutCompanyDetails(branding, emailSettings);
|
|
8549
|
+
const notifyEmails = parseEmailRecipientsFromConfig(
|
|
8550
|
+
emailSettings.salesTeamEmails ?? emailSettings.salesTeamEmail
|
|
8551
|
+
);
|
|
8552
|
+
const sendToOwner = input.sendToOwner !== false;
|
|
8553
|
+
const ownerEmail = input.ownerEmail?.trim() || "";
|
|
8554
|
+
const cms = await deps.getCms();
|
|
8555
|
+
await queueVendorOnboardEmails(cms, {
|
|
8556
|
+
vendorName: input.vendorName,
|
|
8557
|
+
vendorSlug: input.vendorSlug,
|
|
8558
|
+
ownerName: input.ownerName,
|
|
8559
|
+
ownerEmail,
|
|
8560
|
+
activation: input.activation,
|
|
8561
|
+
inviteLink: input.inviteLink,
|
|
8562
|
+
signInLink: input.signInLink,
|
|
8563
|
+
kind: input.kind ?? "vendor_onboard",
|
|
8564
|
+
notifyEmails,
|
|
8565
|
+
companyDetails,
|
|
8566
|
+
sendToOwner: sendToOwner && Boolean(ownerEmail)
|
|
8567
|
+
});
|
|
8568
|
+
ownerEmailSent = sendToOwner && Boolean(ownerEmail);
|
|
8569
|
+
} catch {
|
|
8570
|
+
}
|
|
8571
|
+
return { ownerEmailSent };
|
|
8572
|
+
}
|
|
8573
|
+
|
|
8574
|
+
// src/api/vendor-handlers.ts
|
|
7836
8575
|
function slugify(input) {
|
|
7837
8576
|
return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
7838
8577
|
}
|
|
@@ -7844,7 +8583,6 @@ function createVendorOnboardHandlers(config) {
|
|
|
7844
8583
|
getSessionUser,
|
|
7845
8584
|
baseUrl,
|
|
7846
8585
|
getCms,
|
|
7847
|
-
getCompanyDetails,
|
|
7848
8586
|
hashPassword,
|
|
7849
8587
|
minPasswordLength = 6
|
|
7850
8588
|
} = config;
|
|
@@ -7873,22 +8611,30 @@ function createVendorOnboardHandlers(config) {
|
|
|
7873
8611
|
}
|
|
7874
8612
|
return { user: u, vendorId };
|
|
7875
8613
|
}
|
|
7876
|
-
async function
|
|
7877
|
-
if (!getCms) return;
|
|
8614
|
+
async function trySendVendorOnboardEmails(input) {
|
|
8615
|
+
if (!getCms) return false;
|
|
7878
8616
|
try {
|
|
7879
|
-
const
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
8617
|
+
const { ownerEmailSent } = await sendVendorOnboardEmails(
|
|
8618
|
+
{
|
|
8619
|
+
vendorName: input.vendorName,
|
|
8620
|
+
vendorSlug: input.vendorSlug,
|
|
8621
|
+
ownerName: input.ownerName,
|
|
8622
|
+
ownerEmail: input.ownerEmail,
|
|
8623
|
+
activation: input.activation,
|
|
8624
|
+
inviteLink: input.inviteLink,
|
|
8625
|
+
signInLink: `${baseUrl.replace(/\/$/, "")}/admin`,
|
|
8626
|
+
kind: input.kind ?? "vendor_onboard",
|
|
8627
|
+
sendToOwner: input.sendToOwner
|
|
8628
|
+
},
|
|
8629
|
+
{
|
|
8630
|
+
getDataSource: async () => dataSource,
|
|
8631
|
+
entityMap: { configs: entityMap.configs },
|
|
8632
|
+
getCms
|
|
7889
8633
|
}
|
|
7890
|
-
|
|
8634
|
+
);
|
|
8635
|
+
return ownerEmailSent;
|
|
7891
8636
|
} catch {
|
|
8637
|
+
return false;
|
|
7892
8638
|
}
|
|
7893
8639
|
}
|
|
7894
8640
|
return {
|
|
@@ -7908,7 +8654,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
7908
8654
|
return json({ error: "vendor.name, user.name, and user.email are required" }, { status: 400 });
|
|
7909
8655
|
}
|
|
7910
8656
|
const activation = body.activation === "password" ? "password" : "invite";
|
|
7911
|
-
const
|
|
8657
|
+
const sendOwnerEmail = body.sendOwnerEmail !== false && body.sendInviteEmail !== false;
|
|
7912
8658
|
let ownerPasswordHash = null;
|
|
7913
8659
|
if (activation === "password") {
|
|
7914
8660
|
const plain = body.user?.password?.trim();
|
|
@@ -7996,12 +8742,29 @@ function createVendorOnboardHandlers(config) {
|
|
|
7996
8742
|
if (activation === "invite") {
|
|
7997
8743
|
const emailToken = Buffer.from(result.user.email).toString("base64");
|
|
7998
8744
|
inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
|
|
7999
|
-
if (sendInviteEmail) {
|
|
8000
|
-
await trySendInviteEmail(result.user.email, inviteLink, result.user.name ?? "");
|
|
8001
|
-
emailSent = true;
|
|
8002
|
-
}
|
|
8003
8745
|
}
|
|
8004
|
-
|
|
8746
|
+
if (sendOwnerEmail) {
|
|
8747
|
+
emailSent = await trySendVendorOnboardEmails({
|
|
8748
|
+
vendorName,
|
|
8749
|
+
vendorSlug: slug,
|
|
8750
|
+
ownerName: userName,
|
|
8751
|
+
ownerEmail: userEmail,
|
|
8752
|
+
activation,
|
|
8753
|
+
inviteLink,
|
|
8754
|
+
sendToOwner: true
|
|
8755
|
+
});
|
|
8756
|
+
} else if (getCms) {
|
|
8757
|
+
await trySendVendorOnboardEmails({
|
|
8758
|
+
vendorName,
|
|
8759
|
+
vendorSlug: slug,
|
|
8760
|
+
ownerName: userName,
|
|
8761
|
+
ownerEmail: userEmail,
|
|
8762
|
+
activation,
|
|
8763
|
+
inviteLink,
|
|
8764
|
+
sendToOwner: false
|
|
8765
|
+
});
|
|
8766
|
+
}
|
|
8767
|
+
const message = activation === "password" ? emailSent ? "Vendor onboarded successfully. Welcome email sent to the owner." : sendOwnerEmail ? "Vendor onboarded successfully. Owner can sign in with the password you set (welcome email may not have been sent \u2014 check email plugin)." : "Vendor onboarded successfully. Owner can sign in with the password you set." : emailSent ? "Vendor onboarded successfully. Invite email sent." : sendOwnerEmail ? "Vendor onboarded successfully. Invite link created (email may not have been sent \u2014 check email plugin)." : "Vendor onboarded successfully. Share the invite link with the owner.";
|
|
8005
8768
|
return json(
|
|
8006
8769
|
{
|
|
8007
8770
|
message,
|
|
@@ -8073,7 +8836,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
8073
8836
|
const gated = await gateVendorTeam();
|
|
8074
8837
|
if (gated instanceof Response) return gated;
|
|
8075
8838
|
const { vendorId, user: actor } = gated;
|
|
8076
|
-
if (!entityMap.users || !entityMap.vendor_users || !entityMap.user_groups) {
|
|
8839
|
+
if (!entityMap.users || !entityMap.vendor_users || !entityMap.user_groups || !entityMap.vendors) {
|
|
8077
8840
|
return json({ error: "Vendor entities not configured" }, { status: 500 });
|
|
8078
8841
|
}
|
|
8079
8842
|
try {
|
|
@@ -8084,7 +8847,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
8084
8847
|
return json({ error: "name and email are required" }, { status: 400 });
|
|
8085
8848
|
}
|
|
8086
8849
|
const activation = body.activation === "password" ? "password" : "invite";
|
|
8087
|
-
const
|
|
8850
|
+
const sendOwnerEmail = body.sendOwnerEmail !== false && body.sendInviteEmail !== false;
|
|
8088
8851
|
let ownerPasswordHash = null;
|
|
8089
8852
|
if (activation === "password") {
|
|
8090
8853
|
const plain = body.user?.password?.trim();
|
|
@@ -8170,17 +8933,33 @@ function createVendorOnboardHandlers(config) {
|
|
|
8170
8933
|
}
|
|
8171
8934
|
return newUser;
|
|
8172
8935
|
});
|
|
8936
|
+
const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
|
|
8937
|
+
where: { id: vendorId, deleted: false }
|
|
8938
|
+
});
|
|
8939
|
+
const vendorName = String(vendorRow?.name ?? "Vendor store");
|
|
8940
|
+
const vendorSlug = String(vendorRow?.slug ?? "");
|
|
8173
8941
|
let inviteLink;
|
|
8942
|
+
let emailSent = false;
|
|
8174
8943
|
if (activation === "invite") {
|
|
8175
8944
|
const emailToken = Buffer.from(result.email).toString("base64");
|
|
8176
8945
|
inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8946
|
+
}
|
|
8947
|
+
if (sendOwnerEmail || getCms) {
|
|
8948
|
+
emailSent = await trySendVendorOnboardEmails({
|
|
8949
|
+
vendorName,
|
|
8950
|
+
vendorSlug,
|
|
8951
|
+
ownerName: userName,
|
|
8952
|
+
ownerEmail: userEmail,
|
|
8953
|
+
activation,
|
|
8954
|
+
inviteLink,
|
|
8955
|
+
kind: "team_invite",
|
|
8956
|
+
sendToOwner: sendOwnerEmail
|
|
8957
|
+
});
|
|
8180
8958
|
}
|
|
8181
8959
|
return json(
|
|
8182
8960
|
{
|
|
8183
|
-
message: "Team member added",
|
|
8961
|
+
message: emailSent ? "Team member added. Invitation email sent." : sendOwnerEmail ? "Team member added (email may not have been sent \u2014 check email plugin)." : "Team member added",
|
|
8962
|
+
emailSent,
|
|
8184
8963
|
user: { id: result.id, name: result.name, email: result.email },
|
|
8185
8964
|
inviteLink
|
|
8186
8965
|
},
|
|
@@ -8222,7 +9001,7 @@ init_vendor_scope();
|
|
|
8222
9001
|
|
|
8223
9002
|
// src/lib/hydrate-vendor-session-user.ts
|
|
8224
9003
|
init_rbac_debug();
|
|
8225
|
-
|
|
9004
|
+
init_role_helpers();
|
|
8226
9005
|
init_vendor_scope();
|
|
8227
9006
|
|
|
8228
9007
|
// src/lib/load-user-vendor-context.ts
|
|
@@ -8248,7 +9027,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
8248
9027
|
if (!Number.isFinite(id)) {
|
|
8249
9028
|
const byEmailRows = await dataSource.query(
|
|
8250
9029
|
`
|
|
8251
|
-
SELECT u.id AS id, u."adminAccess" AS "adminAccess", g.name AS "groupName"
|
|
9030
|
+
SELECT u.id AS id, u."adminAccess" AS "adminAccess", u."groupId" AS "groupId", g.name AS "groupName"
|
|
8252
9031
|
FROM users u
|
|
8253
9032
|
LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
|
|
8254
9033
|
WHERE LOWER(TRIM(u.email)) = LOWER(TRIM($1)) AND u.deleted = false
|
|
@@ -8268,7 +9047,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
8268
9047
|
}
|
|
8269
9048
|
const rows = await dataSource.query(
|
|
8270
9049
|
`
|
|
8271
|
-
SELECT u."adminAccess" AS "adminAccess", g.name AS "groupName"
|
|
9050
|
+
SELECT u."adminAccess" AS "adminAccess", u."groupId" AS "groupId", g.name AS "groupName"
|
|
8272
9051
|
FROM users u
|
|
8273
9052
|
LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
|
|
8274
9053
|
WHERE u.id = $1
|
|
@@ -8277,8 +9056,9 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
8277
9056
|
[id]
|
|
8278
9057
|
);
|
|
8279
9058
|
const groupName = rows[0]?.groupName ?? user.groupName ?? null;
|
|
9059
|
+
const groupId = rows[0]?.groupId ?? user.groupId ?? void 0;
|
|
8280
9060
|
const adminAccess = rows[0]?.adminAccess ?? user.adminAccess;
|
|
8281
|
-
const isRBACAdmin = user.isRBACAdmin ??
|
|
9061
|
+
const isRBACAdmin = user.isRBACAdmin ?? isSuperAdmin({ groupId, groupName, isRBACAdmin: user.isRBACAdmin });
|
|
8282
9062
|
const ctx = await loadUserVendorContext(dataSource, id, user.activeVendorId);
|
|
8283
9063
|
const flags = vendorPortalFlagsFromUser({
|
|
8284
9064
|
email: user.email,
|
|
@@ -8289,6 +9069,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
8289
9069
|
});
|
|
8290
9070
|
const hydrated = {
|
|
8291
9071
|
...user,
|
|
9072
|
+
groupId,
|
|
8292
9073
|
groupName: groupName ?? void 0,
|
|
8293
9074
|
adminAccess,
|
|
8294
9075
|
isRBACAdmin,
|
|
@@ -8936,7 +9717,7 @@ Blog = __decorateClass([
|
|
|
8936
9717
|
], Blog);
|
|
8937
9718
|
|
|
8938
9719
|
// src/entities/contact.entity.ts
|
|
8939
|
-
import { Entity as
|
|
9720
|
+
import { Entity as Entity24, PrimaryGeneratedColumn as PrimaryGeneratedColumn24, Column as Column24, OneToMany as OneToMany10, ManyToOne as ManyToOne15, JoinColumn as JoinColumn15 } from "typeorm";
|
|
8940
9721
|
|
|
8941
9722
|
// src/entities/form-submission.entity.ts
|
|
8942
9723
|
import { Entity as Entity14, PrimaryGeneratedColumn as PrimaryGeneratedColumn14, Column as Column14, ManyToOne as ManyToOne6, JoinColumn as JoinColumn6 } from "typeorm";
|
|
@@ -9203,7 +9984,7 @@ Address = __decorateClass([
|
|
|
9203
9984
|
], Address);
|
|
9204
9985
|
|
|
9205
9986
|
// src/entities/order.entity.ts
|
|
9206
|
-
import { Entity as
|
|
9987
|
+
import { Entity as Entity20, PrimaryGeneratedColumn as PrimaryGeneratedColumn20, Column as Column20, ManyToOne as ManyToOne11, OneToMany as OneToMany8, JoinColumn as JoinColumn11, Unique } from "typeorm";
|
|
9207
9988
|
|
|
9208
9989
|
// src/entities/vendor.entity.ts
|
|
9209
9990
|
import { Entity as Entity16, PrimaryGeneratedColumn as PrimaryGeneratedColumn16, Column as Column16, OneToMany as OneToMany6 } from "typeorm";
|
|
@@ -9363,26 +10144,120 @@ OrderAddresses = __decorateClass([
|
|
|
9363
10144
|
Entity17("order_addresses")
|
|
9364
10145
|
], OrderAddresses);
|
|
9365
10146
|
|
|
9366
|
-
// src/entities/
|
|
9367
|
-
|
|
10147
|
+
// src/entities/customer_contacts.entity.ts
|
|
10148
|
+
import { Column as Column19, Entity as Entity19, PrimaryGeneratedColumn as PrimaryGeneratedColumn19, ManyToOne as ManyToOne10, JoinColumn as JoinColumn10 } from "typeorm";
|
|
10149
|
+
|
|
10150
|
+
// src/entities/customer.entity.ts
|
|
10151
|
+
import { Entity as Entity18, PrimaryGeneratedColumn as PrimaryGeneratedColumn18, Column as Column18, ManyToOne as ManyToOne9, JoinColumn as JoinColumn9 } from "typeorm";
|
|
10152
|
+
var Customer = class {
|
|
9368
10153
|
id;
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
|
|
10154
|
+
userId;
|
|
10155
|
+
user;
|
|
10156
|
+
name;
|
|
10157
|
+
email;
|
|
10158
|
+
phone;
|
|
10159
|
+
createdAt;
|
|
10160
|
+
updatedAt;
|
|
10161
|
+
deletedAt;
|
|
10162
|
+
deleted;
|
|
10163
|
+
createdBy;
|
|
10164
|
+
updatedBy;
|
|
10165
|
+
deletedBy;
|
|
10166
|
+
};
|
|
10167
|
+
__decorateClass([
|
|
10168
|
+
PrimaryGeneratedColumn18()
|
|
10169
|
+
], Customer.prototype, "id", 2);
|
|
10170
|
+
__decorateClass([
|
|
10171
|
+
Column18("int")
|
|
10172
|
+
], Customer.prototype, "userId", 2);
|
|
10173
|
+
__decorateClass([
|
|
10174
|
+
ManyToOne9(() => User, { onDelete: "SET NULL" }),
|
|
10175
|
+
JoinColumn9({ name: "userId" })
|
|
10176
|
+
], Customer.prototype, "user", 2);
|
|
10177
|
+
__decorateClass([
|
|
10178
|
+
Column18("varchar")
|
|
10179
|
+
], Customer.prototype, "name", 2);
|
|
10180
|
+
__decorateClass([
|
|
10181
|
+
Column18("varchar", { unique: true })
|
|
10182
|
+
], Customer.prototype, "email", 2);
|
|
10183
|
+
__decorateClass([
|
|
10184
|
+
Column18("varchar", { unique: true })
|
|
10185
|
+
], Customer.prototype, "phone", 2);
|
|
10186
|
+
__decorateClass([
|
|
10187
|
+
Column18({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10188
|
+
], Customer.prototype, "createdAt", 2);
|
|
10189
|
+
__decorateClass([
|
|
10190
|
+
Column18({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10191
|
+
], Customer.prototype, "updatedAt", 2);
|
|
10192
|
+
__decorateClass([
|
|
10193
|
+
Column18({ type: "timestamp", nullable: true })
|
|
10194
|
+
], Customer.prototype, "deletedAt", 2);
|
|
10195
|
+
__decorateClass([
|
|
10196
|
+
Column18("boolean", { default: false })
|
|
10197
|
+
], Customer.prototype, "deleted", 2);
|
|
10198
|
+
__decorateClass([
|
|
10199
|
+
Column18("int", { nullable: true })
|
|
10200
|
+
], Customer.prototype, "createdBy", 2);
|
|
10201
|
+
__decorateClass([
|
|
10202
|
+
Column18("int", { nullable: true })
|
|
10203
|
+
], Customer.prototype, "updatedBy", 2);
|
|
10204
|
+
__decorateClass([
|
|
10205
|
+
Column18("int", { nullable: true })
|
|
10206
|
+
], Customer.prototype, "deletedBy", 2);
|
|
10207
|
+
Customer = __decorateClass([
|
|
10208
|
+
Entity18("customer")
|
|
10209
|
+
], Customer);
|
|
10210
|
+
|
|
10211
|
+
// src/entities/customer_contacts.entity.ts
|
|
10212
|
+
var Customer_Contacts = class {
|
|
10213
|
+
id;
|
|
10214
|
+
customerId;
|
|
10215
|
+
customer;
|
|
10216
|
+
contactId;
|
|
10217
|
+
contact;
|
|
10218
|
+
};
|
|
10219
|
+
__decorateClass([
|
|
10220
|
+
PrimaryGeneratedColumn19()
|
|
10221
|
+
], Customer_Contacts.prototype, "id", 2);
|
|
10222
|
+
__decorateClass([
|
|
10223
|
+
Column19("int")
|
|
10224
|
+
], Customer_Contacts.prototype, "customerId", 2);
|
|
10225
|
+
__decorateClass([
|
|
10226
|
+
ManyToOne10(() => Customer, { onDelete: "CASCADE" }),
|
|
10227
|
+
JoinColumn10({ name: "customerId" })
|
|
10228
|
+
], Customer_Contacts.prototype, "customer", 2);
|
|
10229
|
+
__decorateClass([
|
|
10230
|
+
Column19("int")
|
|
10231
|
+
], Customer_Contacts.prototype, "contactId", 2);
|
|
10232
|
+
__decorateClass([
|
|
10233
|
+
ManyToOne10(() => Contact, { onDelete: "CASCADE" }),
|
|
10234
|
+
JoinColumn10({ name: "contactId" })
|
|
10235
|
+
], Customer_Contacts.prototype, "contact", 2);
|
|
10236
|
+
Customer_Contacts = __decorateClass([
|
|
10237
|
+
Entity19("customer_contacts")
|
|
10238
|
+
], Customer_Contacts);
|
|
10239
|
+
|
|
10240
|
+
// src/entities/order.entity.ts
|
|
10241
|
+
var Order = class {
|
|
10242
|
+
id;
|
|
10243
|
+
vendorId;
|
|
10244
|
+
orderNumber;
|
|
10245
|
+
qrToken;
|
|
10246
|
+
orderKind;
|
|
10247
|
+
parentOrderId;
|
|
10248
|
+
contactId;
|
|
10249
|
+
customerContactId;
|
|
10250
|
+
billingAddressId;
|
|
10251
|
+
shippingAddressId;
|
|
10252
|
+
status;
|
|
10253
|
+
subtotal;
|
|
10254
|
+
tax;
|
|
10255
|
+
discount;
|
|
10256
|
+
total;
|
|
10257
|
+
currency;
|
|
10258
|
+
metadata;
|
|
10259
|
+
createdAt;
|
|
10260
|
+
updatedAt;
|
|
9386
10261
|
deletedAt;
|
|
9387
10262
|
deleted;
|
|
9388
10263
|
createdBy;
|
|
@@ -9392,102 +10267,110 @@ var Order = class {
|
|
|
9392
10267
|
parentOrder;
|
|
9393
10268
|
children;
|
|
9394
10269
|
contact;
|
|
10270
|
+
customerContact;
|
|
9395
10271
|
billingAddress;
|
|
9396
10272
|
shippingAddress;
|
|
9397
10273
|
items;
|
|
9398
10274
|
payments;
|
|
9399
10275
|
};
|
|
9400
10276
|
__decorateClass([
|
|
9401
|
-
|
|
10277
|
+
PrimaryGeneratedColumn20()
|
|
9402
10278
|
], Order.prototype, "id", 2);
|
|
9403
10279
|
__decorateClass([
|
|
9404
|
-
|
|
10280
|
+
Column20("int")
|
|
9405
10281
|
], Order.prototype, "vendorId", 2);
|
|
9406
10282
|
__decorateClass([
|
|
9407
|
-
|
|
10283
|
+
Column20("varchar")
|
|
9408
10284
|
], Order.prototype, "orderNumber", 2);
|
|
9409
10285
|
__decorateClass([
|
|
9410
|
-
|
|
10286
|
+
Column20("varchar", { unique: true, nullable: true })
|
|
9411
10287
|
], Order.prototype, "qrToken", 2);
|
|
9412
10288
|
__decorateClass([
|
|
9413
|
-
|
|
10289
|
+
Column20("varchar", { default: "sale" })
|
|
9414
10290
|
], Order.prototype, "orderKind", 2);
|
|
9415
10291
|
__decorateClass([
|
|
9416
|
-
|
|
10292
|
+
Column20("int", { nullable: true })
|
|
9417
10293
|
], Order.prototype, "parentOrderId", 2);
|
|
9418
10294
|
__decorateClass([
|
|
9419
|
-
|
|
10295
|
+
Column20("int")
|
|
9420
10296
|
], Order.prototype, "contactId", 2);
|
|
9421
10297
|
__decorateClass([
|
|
9422
|
-
|
|
10298
|
+
Column20("int", { nullable: true })
|
|
10299
|
+
], Order.prototype, "customerContactId", 2);
|
|
10300
|
+
__decorateClass([
|
|
10301
|
+
Column20("int", { nullable: true })
|
|
9423
10302
|
], Order.prototype, "billingAddressId", 2);
|
|
9424
10303
|
__decorateClass([
|
|
9425
|
-
|
|
10304
|
+
Column20("int", { nullable: true })
|
|
9426
10305
|
], Order.prototype, "shippingAddressId", 2);
|
|
9427
10306
|
__decorateClass([
|
|
9428
|
-
|
|
10307
|
+
Column20("varchar", { default: "pending" })
|
|
9429
10308
|
], Order.prototype, "status", 2);
|
|
9430
10309
|
__decorateClass([
|
|
9431
|
-
|
|
10310
|
+
Column20("decimal", { precision: 12, scale: 2, default: 0 })
|
|
9432
10311
|
], Order.prototype, "subtotal", 2);
|
|
9433
10312
|
__decorateClass([
|
|
9434
|
-
|
|
10313
|
+
Column20("decimal", { precision: 12, scale: 2, default: 0 })
|
|
9435
10314
|
], Order.prototype, "tax", 2);
|
|
9436
10315
|
__decorateClass([
|
|
9437
|
-
|
|
10316
|
+
Column20("decimal", { precision: 12, scale: 2, default: 0 })
|
|
9438
10317
|
], Order.prototype, "discount", 2);
|
|
9439
10318
|
__decorateClass([
|
|
9440
|
-
|
|
10319
|
+
Column20("decimal", { precision: 12, scale: 2, default: 0 })
|
|
9441
10320
|
], Order.prototype, "total", 2);
|
|
9442
10321
|
__decorateClass([
|
|
9443
|
-
|
|
10322
|
+
Column20("varchar", { default: "INR" })
|
|
9444
10323
|
], Order.prototype, "currency", 2);
|
|
9445
10324
|
__decorateClass([
|
|
9446
|
-
|
|
10325
|
+
Column20("jsonb", { nullable: true })
|
|
9447
10326
|
], Order.prototype, "metadata", 2);
|
|
9448
10327
|
__decorateClass([
|
|
9449
|
-
|
|
10328
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9450
10329
|
], Order.prototype, "createdAt", 2);
|
|
9451
10330
|
__decorateClass([
|
|
9452
|
-
|
|
10331
|
+
Column20({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9453
10332
|
], Order.prototype, "updatedAt", 2);
|
|
9454
10333
|
__decorateClass([
|
|
9455
|
-
|
|
10334
|
+
Column20({ type: "timestamp", nullable: true })
|
|
9456
10335
|
], Order.prototype, "deletedAt", 2);
|
|
9457
10336
|
__decorateClass([
|
|
9458
|
-
|
|
10337
|
+
Column20("boolean", { default: false })
|
|
9459
10338
|
], Order.prototype, "deleted", 2);
|
|
9460
10339
|
__decorateClass([
|
|
9461
|
-
|
|
10340
|
+
Column20("int", { nullable: true })
|
|
9462
10341
|
], Order.prototype, "createdBy", 2);
|
|
9463
10342
|
__decorateClass([
|
|
9464
|
-
|
|
10343
|
+
Column20("int", { nullable: true })
|
|
9465
10344
|
], Order.prototype, "updatedBy", 2);
|
|
9466
10345
|
__decorateClass([
|
|
9467
|
-
|
|
10346
|
+
Column20("int", { nullable: true })
|
|
9468
10347
|
], Order.prototype, "deletedBy", 2);
|
|
9469
10348
|
__decorateClass([
|
|
9470
|
-
|
|
9471
|
-
|
|
10349
|
+
ManyToOne11(() => Vendor, { onDelete: "RESTRICT" }),
|
|
10350
|
+
JoinColumn11({ name: "vendorId" })
|
|
9472
10351
|
], Order.prototype, "vendor", 2);
|
|
9473
10352
|
__decorateClass([
|
|
9474
|
-
|
|
9475
|
-
|
|
10353
|
+
ManyToOne11(() => Order, (o) => o.children, { nullable: true, onDelete: "SET NULL" }),
|
|
10354
|
+
JoinColumn11({ name: "parentOrderId" })
|
|
9476
10355
|
], Order.prototype, "parentOrder", 2);
|
|
9477
10356
|
__decorateClass([
|
|
9478
10357
|
OneToMany8(() => Order, (o) => o.parentOrder)
|
|
9479
10358
|
], Order.prototype, "children", 2);
|
|
9480
10359
|
__decorateClass([
|
|
9481
|
-
|
|
9482
|
-
|
|
10360
|
+
ManyToOne11(() => Contact, { onDelete: "CASCADE" }),
|
|
10361
|
+
JoinColumn11({ name: "contactId" })
|
|
9483
10362
|
], Order.prototype, "contact", 2);
|
|
9484
10363
|
__decorateClass([
|
|
9485
|
-
|
|
9486
|
-
|
|
10364
|
+
ManyToOne11(() => Customer_Contacts, { onDelete: "SET NULL" }),
|
|
10365
|
+
JoinColumn11({ name: "customerContactId" })
|
|
10366
|
+
], Order.prototype, "customerContact", 2);
|
|
10367
|
+
__decorateClass([
|
|
10368
|
+
ManyToOne11(() => OrderAddresses, { onDelete: "SET NULL" }),
|
|
10369
|
+
JoinColumn11({ name: "billingAddressId" })
|
|
9487
10370
|
], Order.prototype, "billingAddress", 2);
|
|
9488
10371
|
__decorateClass([
|
|
9489
|
-
|
|
9490
|
-
|
|
10372
|
+
ManyToOne11(() => OrderAddresses, { onDelete: "SET NULL" }),
|
|
10373
|
+
JoinColumn11({ name: "shippingAddressId" })
|
|
9491
10374
|
], Order.prototype, "shippingAddress", 2);
|
|
9492
10375
|
__decorateClass([
|
|
9493
10376
|
OneToMany8("OrderItem", "order")
|
|
@@ -9496,12 +10379,12 @@ __decorateClass([
|
|
|
9496
10379
|
OneToMany8("Payment", "order")
|
|
9497
10380
|
], Order.prototype, "payments", 2);
|
|
9498
10381
|
Order = __decorateClass([
|
|
9499
|
-
|
|
10382
|
+
Entity20("orders"),
|
|
9500
10383
|
Unique("UQ_orders_vendor_orderNumber", ["vendorId", "orderNumber"])
|
|
9501
10384
|
], Order);
|
|
9502
10385
|
|
|
9503
10386
|
// src/entities/payment.entity.ts
|
|
9504
|
-
import { Entity as
|
|
10387
|
+
import { Entity as Entity21, PrimaryGeneratedColumn as PrimaryGeneratedColumn21, Column as Column21, ManyToOne as ManyToOne12, JoinColumn as JoinColumn12 } from "typeorm";
|
|
9505
10388
|
var Payment = class {
|
|
9506
10389
|
id;
|
|
9507
10390
|
vendorId;
|
|
@@ -9526,80 +10409,80 @@ var Payment = class {
|
|
|
9526
10409
|
contact;
|
|
9527
10410
|
};
|
|
9528
10411
|
__decorateClass([
|
|
9529
|
-
|
|
10412
|
+
PrimaryGeneratedColumn21()
|
|
9530
10413
|
], Payment.prototype, "id", 2);
|
|
9531
10414
|
__decorateClass([
|
|
9532
|
-
|
|
10415
|
+
Column21("int")
|
|
9533
10416
|
], Payment.prototype, "vendorId", 2);
|
|
9534
10417
|
__decorateClass([
|
|
9535
|
-
|
|
10418
|
+
Column21("int")
|
|
9536
10419
|
], Payment.prototype, "orderId", 2);
|
|
9537
10420
|
__decorateClass([
|
|
9538
|
-
|
|
10421
|
+
Column21("int", { nullable: true })
|
|
9539
10422
|
], Payment.prototype, "contactId", 2);
|
|
9540
10423
|
__decorateClass([
|
|
9541
|
-
|
|
10424
|
+
Column21("decimal", { precision: 12, scale: 2 })
|
|
9542
10425
|
], Payment.prototype, "amount", 2);
|
|
9543
10426
|
__decorateClass([
|
|
9544
|
-
|
|
10427
|
+
Column21("varchar", { default: "INR" })
|
|
9545
10428
|
], Payment.prototype, "currency", 2);
|
|
9546
10429
|
__decorateClass([
|
|
9547
|
-
|
|
10430
|
+
Column21("varchar", { default: "pending" })
|
|
9548
10431
|
], Payment.prototype, "status", 2);
|
|
9549
10432
|
__decorateClass([
|
|
9550
|
-
|
|
10433
|
+
Column21("varchar", { nullable: true })
|
|
9551
10434
|
], Payment.prototype, "method", 2);
|
|
9552
10435
|
__decorateClass([
|
|
9553
|
-
|
|
10436
|
+
Column21("varchar", { nullable: true })
|
|
9554
10437
|
], Payment.prototype, "externalReference", 2);
|
|
9555
10438
|
__decorateClass([
|
|
9556
|
-
|
|
10439
|
+
Column21("jsonb", { nullable: true })
|
|
9557
10440
|
], Payment.prototype, "metadata", 2);
|
|
9558
10441
|
__decorateClass([
|
|
9559
|
-
|
|
10442
|
+
Column21({ type: "timestamp", nullable: true })
|
|
9560
10443
|
], Payment.prototype, "paidAt", 2);
|
|
9561
10444
|
__decorateClass([
|
|
9562
|
-
|
|
10445
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9563
10446
|
], Payment.prototype, "createdAt", 2);
|
|
9564
10447
|
__decorateClass([
|
|
9565
|
-
|
|
10448
|
+
Column21({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9566
10449
|
], Payment.prototype, "updatedAt", 2);
|
|
9567
10450
|
__decorateClass([
|
|
9568
|
-
|
|
10451
|
+
Column21({ type: "timestamp", nullable: true })
|
|
9569
10452
|
], Payment.prototype, "deletedAt", 2);
|
|
9570
10453
|
__decorateClass([
|
|
9571
|
-
|
|
10454
|
+
Column21("boolean", { default: false })
|
|
9572
10455
|
], Payment.prototype, "deleted", 2);
|
|
9573
10456
|
__decorateClass([
|
|
9574
|
-
|
|
10457
|
+
Column21("int", { nullable: true })
|
|
9575
10458
|
], Payment.prototype, "createdBy", 2);
|
|
9576
10459
|
__decorateClass([
|
|
9577
|
-
|
|
10460
|
+
Column21("int", { nullable: true })
|
|
9578
10461
|
], Payment.prototype, "updatedBy", 2);
|
|
9579
10462
|
__decorateClass([
|
|
9580
|
-
|
|
10463
|
+
Column21("int", { nullable: true })
|
|
9581
10464
|
], Payment.prototype, "deletedBy", 2);
|
|
9582
10465
|
__decorateClass([
|
|
9583
|
-
|
|
9584
|
-
|
|
10466
|
+
ManyToOne12(() => Vendor, { onDelete: "RESTRICT" }),
|
|
10467
|
+
JoinColumn12({ name: "vendorId" })
|
|
9585
10468
|
], Payment.prototype, "vendor", 2);
|
|
9586
10469
|
__decorateClass([
|
|
9587
|
-
|
|
9588
|
-
|
|
10470
|
+
ManyToOne12(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
|
|
10471
|
+
JoinColumn12({ name: "orderId" })
|
|
9589
10472
|
], Payment.prototype, "order", 2);
|
|
9590
10473
|
__decorateClass([
|
|
9591
|
-
|
|
9592
|
-
|
|
10474
|
+
ManyToOne12(() => Contact, { onDelete: "SET NULL" }),
|
|
10475
|
+
JoinColumn12({ name: "contactId" })
|
|
9593
10476
|
], Payment.prototype, "contact", 2);
|
|
9594
10477
|
Payment = __decorateClass([
|
|
9595
|
-
|
|
10478
|
+
Entity21("payments")
|
|
9596
10479
|
], Payment);
|
|
9597
10480
|
|
|
9598
10481
|
// src/entities/chat-conversation.entity.ts
|
|
9599
|
-
import { Entity as
|
|
10482
|
+
import { Entity as Entity23, PrimaryGeneratedColumn as PrimaryGeneratedColumn23, Column as Column23, ManyToOne as ManyToOne14, OneToMany as OneToMany9, JoinColumn as JoinColumn14 } from "typeorm";
|
|
9600
10483
|
|
|
9601
10484
|
// src/entities/chat-message.entity.ts
|
|
9602
|
-
import { Entity as
|
|
10485
|
+
import { Entity as Entity22, PrimaryGeneratedColumn as PrimaryGeneratedColumn22, Column as Column22, ManyToOne as ManyToOne13, JoinColumn as JoinColumn13 } from "typeorm";
|
|
9603
10486
|
var ChatMessage = class {
|
|
9604
10487
|
id;
|
|
9605
10488
|
conversationId;
|
|
@@ -9609,26 +10492,26 @@ var ChatMessage = class {
|
|
|
9609
10492
|
conversation;
|
|
9610
10493
|
};
|
|
9611
10494
|
__decorateClass([
|
|
9612
|
-
|
|
10495
|
+
PrimaryGeneratedColumn22()
|
|
9613
10496
|
], ChatMessage.prototype, "id", 2);
|
|
9614
10497
|
__decorateClass([
|
|
9615
|
-
|
|
10498
|
+
Column22("int")
|
|
9616
10499
|
], ChatMessage.prototype, "conversationId", 2);
|
|
9617
10500
|
__decorateClass([
|
|
9618
|
-
|
|
10501
|
+
Column22("varchar")
|
|
9619
10502
|
], ChatMessage.prototype, "role", 2);
|
|
9620
10503
|
__decorateClass([
|
|
9621
|
-
|
|
10504
|
+
Column22("text")
|
|
9622
10505
|
], ChatMessage.prototype, "content", 2);
|
|
9623
10506
|
__decorateClass([
|
|
9624
|
-
|
|
10507
|
+
Column22({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9625
10508
|
], ChatMessage.prototype, "createdAt", 2);
|
|
9626
10509
|
__decorateClass([
|
|
9627
|
-
|
|
9628
|
-
|
|
10510
|
+
ManyToOne13(() => ChatConversation, (c) => c.messages, { onDelete: "CASCADE" }),
|
|
10511
|
+
JoinColumn13({ name: "conversationId" })
|
|
9629
10512
|
], ChatMessage.prototype, "conversation", 2);
|
|
9630
10513
|
ChatMessage = __decorateClass([
|
|
9631
|
-
|
|
10514
|
+
Entity22("chat_messages")
|
|
9632
10515
|
], ChatMessage);
|
|
9633
10516
|
|
|
9634
10517
|
// src/entities/chat-conversation.entity.ts
|
|
@@ -9642,29 +10525,29 @@ var ChatConversation = class {
|
|
|
9642
10525
|
messages;
|
|
9643
10526
|
};
|
|
9644
10527
|
__decorateClass([
|
|
9645
|
-
|
|
10528
|
+
PrimaryGeneratedColumn23()
|
|
9646
10529
|
], ChatConversation.prototype, "id", 2);
|
|
9647
10530
|
__decorateClass([
|
|
9648
|
-
|
|
10531
|
+
Column23("int")
|
|
9649
10532
|
], ChatConversation.prototype, "contactId", 2);
|
|
9650
10533
|
__decorateClass([
|
|
9651
|
-
|
|
10534
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9652
10535
|
], ChatConversation.prototype, "createdAt", 2);
|
|
9653
10536
|
__decorateClass([
|
|
9654
|
-
|
|
10537
|
+
Column23({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9655
10538
|
], ChatConversation.prototype, "updatedAt", 2);
|
|
9656
10539
|
__decorateClass([
|
|
9657
|
-
|
|
10540
|
+
Column23({ type: "timestamp", nullable: true })
|
|
9658
10541
|
], ChatConversation.prototype, "leadEmailSentAt", 2);
|
|
9659
10542
|
__decorateClass([
|
|
9660
|
-
|
|
9661
|
-
|
|
10543
|
+
ManyToOne14(() => Contact, (c) => c.chatConversations, { onDelete: "CASCADE" }),
|
|
10544
|
+
JoinColumn14({ name: "contactId" })
|
|
9662
10545
|
], ChatConversation.prototype, "contact", 2);
|
|
9663
10546
|
__decorateClass([
|
|
9664
10547
|
OneToMany9(() => ChatMessage, (m) => m.conversation)
|
|
9665
10548
|
], ChatConversation.prototype, "messages", 2);
|
|
9666
10549
|
ChatConversation = __decorateClass([
|
|
9667
|
-
|
|
10550
|
+
Entity23("chat_conversations")
|
|
9668
10551
|
], ChatConversation);
|
|
9669
10552
|
|
|
9670
10553
|
// src/entities/contact.entity.ts
|
|
@@ -9694,56 +10577,56 @@ var Contact = class {
|
|
|
9694
10577
|
orderAddresses;
|
|
9695
10578
|
};
|
|
9696
10579
|
__decorateClass([
|
|
9697
|
-
|
|
10580
|
+
PrimaryGeneratedColumn24()
|
|
9698
10581
|
], Contact.prototype, "id", 2);
|
|
9699
10582
|
__decorateClass([
|
|
9700
|
-
|
|
10583
|
+
Column24("varchar")
|
|
9701
10584
|
], Contact.prototype, "name", 2);
|
|
9702
10585
|
__decorateClass([
|
|
9703
|
-
|
|
10586
|
+
Column24("varchar", { unique: true })
|
|
9704
10587
|
], Contact.prototype, "email", 2);
|
|
9705
10588
|
__decorateClass([
|
|
9706
|
-
|
|
10589
|
+
Column24("varchar", { nullable: true })
|
|
9707
10590
|
], Contact.prototype, "phone", 2);
|
|
9708
10591
|
__decorateClass([
|
|
9709
|
-
|
|
10592
|
+
Column24("varchar", { nullable: true })
|
|
9710
10593
|
], Contact.prototype, "type", 2);
|
|
9711
10594
|
__decorateClass([
|
|
9712
|
-
|
|
10595
|
+
Column24("varchar", { nullable: true })
|
|
9713
10596
|
], Contact.prototype, "company", 2);
|
|
9714
10597
|
__decorateClass([
|
|
9715
|
-
|
|
10598
|
+
Column24("varchar", { nullable: true })
|
|
9716
10599
|
], Contact.prototype, "taxId", 2);
|
|
9717
10600
|
__decorateClass([
|
|
9718
|
-
|
|
10601
|
+
Column24("text", { nullable: true })
|
|
9719
10602
|
], Contact.prototype, "notes", 2);
|
|
9720
10603
|
__decorateClass([
|
|
9721
|
-
|
|
10604
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9722
10605
|
], Contact.prototype, "createdAt", 2);
|
|
9723
10606
|
__decorateClass([
|
|
9724
|
-
|
|
10607
|
+
Column24({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9725
10608
|
], Contact.prototype, "updatedAt", 2);
|
|
9726
10609
|
__decorateClass([
|
|
9727
|
-
|
|
10610
|
+
Column24({ type: "timestamp", nullable: true })
|
|
9728
10611
|
], Contact.prototype, "deletedAt", 2);
|
|
9729
10612
|
__decorateClass([
|
|
9730
|
-
|
|
10613
|
+
Column24("boolean", { default: false })
|
|
9731
10614
|
], Contact.prototype, "deleted", 2);
|
|
9732
10615
|
__decorateClass([
|
|
9733
|
-
|
|
10616
|
+
Column24("int", { nullable: true })
|
|
9734
10617
|
], Contact.prototype, "createdBy", 2);
|
|
9735
10618
|
__decorateClass([
|
|
9736
|
-
|
|
10619
|
+
Column24("int", { nullable: true })
|
|
9737
10620
|
], Contact.prototype, "updatedBy", 2);
|
|
9738
10621
|
__decorateClass([
|
|
9739
|
-
|
|
10622
|
+
Column24("int", { nullable: true })
|
|
9740
10623
|
], Contact.prototype, "deletedBy", 2);
|
|
9741
10624
|
__decorateClass([
|
|
9742
|
-
|
|
10625
|
+
Column24("int", { nullable: true })
|
|
9743
10626
|
], Contact.prototype, "userId", 2);
|
|
9744
10627
|
__decorateClass([
|
|
9745
|
-
|
|
9746
|
-
|
|
10628
|
+
ManyToOne15(() => User, { onDelete: "SET NULL" }),
|
|
10629
|
+
JoinColumn15({ name: "userId" })
|
|
9747
10630
|
], Contact.prototype, "user", 2);
|
|
9748
10631
|
__decorateClass([
|
|
9749
10632
|
OneToMany10(() => FormSubmission, (fs2) => fs2.contact)
|
|
@@ -9764,11 +10647,11 @@ __decorateClass([
|
|
|
9764
10647
|
OneToMany10(() => OrderAddresses, (orderAddresses) => orderAddresses.contact)
|
|
9765
10648
|
], Contact.prototype, "orderAddresses", 2);
|
|
9766
10649
|
Contact = __decorateClass([
|
|
9767
|
-
|
|
10650
|
+
Entity24("contacts")
|
|
9768
10651
|
], Contact);
|
|
9769
10652
|
|
|
9770
10653
|
// src/entities/config.entity.ts
|
|
9771
|
-
import { Entity as
|
|
10654
|
+
import { Entity as Entity25, PrimaryGeneratedColumn as PrimaryGeneratedColumn25, Column as Column25, Unique as Unique2 } from "typeorm";
|
|
9772
10655
|
var Config = class {
|
|
9773
10656
|
id;
|
|
9774
10657
|
settings;
|
|
@@ -9785,51 +10668,51 @@ var Config = class {
|
|
|
9785
10668
|
deletedBy;
|
|
9786
10669
|
};
|
|
9787
10670
|
__decorateClass([
|
|
9788
|
-
|
|
10671
|
+
PrimaryGeneratedColumn25()
|
|
9789
10672
|
], Config.prototype, "id", 2);
|
|
9790
10673
|
__decorateClass([
|
|
9791
|
-
|
|
10674
|
+
Column25("varchar")
|
|
9792
10675
|
], Config.prototype, "settings", 2);
|
|
9793
10676
|
__decorateClass([
|
|
9794
|
-
|
|
10677
|
+
Column25("varchar")
|
|
9795
10678
|
], Config.prototype, "key", 2);
|
|
9796
10679
|
__decorateClass([
|
|
9797
|
-
|
|
10680
|
+
Column25("varchar")
|
|
9798
10681
|
], Config.prototype, "value", 2);
|
|
9799
10682
|
__decorateClass([
|
|
9800
|
-
|
|
10683
|
+
Column25("varchar", { default: "private" })
|
|
9801
10684
|
], Config.prototype, "type", 2);
|
|
9802
10685
|
__decorateClass([
|
|
9803
|
-
|
|
10686
|
+
Column25("boolean", { default: false })
|
|
9804
10687
|
], Config.prototype, "encrypted", 2);
|
|
9805
10688
|
__decorateClass([
|
|
9806
|
-
|
|
10689
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9807
10690
|
], Config.prototype, "createdAt", 2);
|
|
9808
10691
|
__decorateClass([
|
|
9809
|
-
|
|
10692
|
+
Column25({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9810
10693
|
], Config.prototype, "updatedAt", 2);
|
|
9811
10694
|
__decorateClass([
|
|
9812
|
-
|
|
10695
|
+
Column25({ type: "timestamp", nullable: true })
|
|
9813
10696
|
], Config.prototype, "deletedAt", 2);
|
|
9814
10697
|
__decorateClass([
|
|
9815
|
-
|
|
10698
|
+
Column25("boolean", { default: false })
|
|
9816
10699
|
], Config.prototype, "deleted", 2);
|
|
9817
10700
|
__decorateClass([
|
|
9818
|
-
|
|
10701
|
+
Column25("int", { nullable: true })
|
|
9819
10702
|
], Config.prototype, "createdBy", 2);
|
|
9820
10703
|
__decorateClass([
|
|
9821
|
-
|
|
10704
|
+
Column25("int", { nullable: true })
|
|
9822
10705
|
], Config.prototype, "updatedBy", 2);
|
|
9823
10706
|
__decorateClass([
|
|
9824
|
-
|
|
10707
|
+
Column25("int", { nullable: true })
|
|
9825
10708
|
], Config.prototype, "deletedBy", 2);
|
|
9826
10709
|
Config = __decorateClass([
|
|
9827
|
-
|
|
10710
|
+
Entity25("configs"),
|
|
9828
10711
|
Unique2(["settings", "key"])
|
|
9829
10712
|
], Config);
|
|
9830
10713
|
|
|
9831
10714
|
// src/entities/message-template.entity.ts
|
|
9832
|
-
import { Entity as
|
|
10715
|
+
import { Entity as Entity26, PrimaryGeneratedColumn as PrimaryGeneratedColumn26, Column as Column26 } from "typeorm";
|
|
9833
10716
|
var MessageTemplate = class {
|
|
9834
10717
|
id;
|
|
9835
10718
|
channel;
|
|
@@ -9849,59 +10732,59 @@ var MessageTemplate = class {
|
|
|
9849
10732
|
deletedBy;
|
|
9850
10733
|
};
|
|
9851
10734
|
__decorateClass([
|
|
9852
|
-
|
|
10735
|
+
PrimaryGeneratedColumn26()
|
|
9853
10736
|
], MessageTemplate.prototype, "id", 2);
|
|
9854
10737
|
__decorateClass([
|
|
9855
|
-
|
|
10738
|
+
Column26("varchar")
|
|
9856
10739
|
], MessageTemplate.prototype, "channel", 2);
|
|
9857
10740
|
__decorateClass([
|
|
9858
|
-
|
|
10741
|
+
Column26("varchar", { name: "template_key" })
|
|
9859
10742
|
], MessageTemplate.prototype, "templateKey", 2);
|
|
9860
10743
|
__decorateClass([
|
|
9861
|
-
|
|
10744
|
+
Column26("varchar", { nullable: true })
|
|
9862
10745
|
], MessageTemplate.prototype, "name", 2);
|
|
9863
10746
|
__decorateClass([
|
|
9864
|
-
|
|
10747
|
+
Column26("varchar", { nullable: true })
|
|
9865
10748
|
], MessageTemplate.prototype, "subject", 2);
|
|
9866
10749
|
__decorateClass([
|
|
9867
|
-
|
|
10750
|
+
Column26("text", { default: "" })
|
|
9868
10751
|
], MessageTemplate.prototype, "body", 2);
|
|
9869
10752
|
__decorateClass([
|
|
9870
|
-
|
|
10753
|
+
Column26("varchar", { name: "external_template_ref", nullable: true })
|
|
9871
10754
|
], MessageTemplate.prototype, "externalTemplateRef", 2);
|
|
9872
10755
|
__decorateClass([
|
|
9873
|
-
|
|
10756
|
+
Column26({ type: "jsonb", nullable: true })
|
|
9874
10757
|
], MessageTemplate.prototype, "providerMeta", 2);
|
|
9875
10758
|
__decorateClass([
|
|
9876
|
-
|
|
10759
|
+
Column26("boolean", { default: true })
|
|
9877
10760
|
], MessageTemplate.prototype, "enabled", 2);
|
|
9878
10761
|
__decorateClass([
|
|
9879
|
-
|
|
10762
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9880
10763
|
], MessageTemplate.prototype, "createdAt", 2);
|
|
9881
10764
|
__decorateClass([
|
|
9882
|
-
|
|
10765
|
+
Column26({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9883
10766
|
], MessageTemplate.prototype, "updatedAt", 2);
|
|
9884
10767
|
__decorateClass([
|
|
9885
|
-
|
|
10768
|
+
Column26({ type: "timestamp", nullable: true })
|
|
9886
10769
|
], MessageTemplate.prototype, "deletedAt", 2);
|
|
9887
10770
|
__decorateClass([
|
|
9888
|
-
|
|
10771
|
+
Column26("boolean", { default: false })
|
|
9889
10772
|
], MessageTemplate.prototype, "deleted", 2);
|
|
9890
10773
|
__decorateClass([
|
|
9891
|
-
|
|
10774
|
+
Column26("int", { nullable: true })
|
|
9892
10775
|
], MessageTemplate.prototype, "createdBy", 2);
|
|
9893
10776
|
__decorateClass([
|
|
9894
|
-
|
|
10777
|
+
Column26("int", { nullable: true })
|
|
9895
10778
|
], MessageTemplate.prototype, "updatedBy", 2);
|
|
9896
10779
|
__decorateClass([
|
|
9897
|
-
|
|
10780
|
+
Column26("int", { nullable: true })
|
|
9898
10781
|
], MessageTemplate.prototype, "deletedBy", 2);
|
|
9899
10782
|
MessageTemplate = __decorateClass([
|
|
9900
|
-
|
|
10783
|
+
Entity26("message_templates")
|
|
9901
10784
|
], MessageTemplate);
|
|
9902
10785
|
|
|
9903
10786
|
// src/entities/media.entity.ts
|
|
9904
|
-
import { Entity as
|
|
10787
|
+
import { Entity as Entity27, PrimaryGeneratedColumn as PrimaryGeneratedColumn27, Column as Column27, ManyToOne as ManyToOne16, OneToMany as OneToMany11, JoinColumn as JoinColumn16 } from "typeorm";
|
|
9905
10788
|
var Media = class {
|
|
9906
10789
|
id;
|
|
9907
10790
|
kind;
|
|
@@ -9920,57 +10803,57 @@ var Media = class {
|
|
|
9920
10803
|
deleted;
|
|
9921
10804
|
};
|
|
9922
10805
|
__decorateClass([
|
|
9923
|
-
|
|
10806
|
+
PrimaryGeneratedColumn27()
|
|
9924
10807
|
], Media.prototype, "id", 2);
|
|
9925
10808
|
__decorateClass([
|
|
9926
|
-
|
|
10809
|
+
Column27({ type: "varchar", length: 16, default: "file" })
|
|
9927
10810
|
], Media.prototype, "kind", 2);
|
|
9928
10811
|
__decorateClass([
|
|
9929
|
-
|
|
10812
|
+
Column27({ type: "int", nullable: true })
|
|
9930
10813
|
], Media.prototype, "parentId", 2);
|
|
9931
10814
|
__decorateClass([
|
|
9932
|
-
|
|
9933
|
-
|
|
10815
|
+
ManyToOne16(() => Media, (m) => m.children, { onDelete: "CASCADE" }),
|
|
10816
|
+
JoinColumn16({ name: "parentId" })
|
|
9934
10817
|
], Media.prototype, "parent", 2);
|
|
9935
10818
|
__decorateClass([
|
|
9936
10819
|
OneToMany11(() => Media, (m) => m.parent)
|
|
9937
10820
|
], Media.prototype, "children", 2);
|
|
9938
10821
|
__decorateClass([
|
|
9939
|
-
|
|
10822
|
+
Column27("varchar")
|
|
9940
10823
|
], Media.prototype, "filename", 2);
|
|
9941
10824
|
__decorateClass([
|
|
9942
|
-
|
|
10825
|
+
Column27("varchar", { nullable: true })
|
|
9943
10826
|
], Media.prototype, "url", 2);
|
|
9944
10827
|
__decorateClass([
|
|
9945
|
-
|
|
10828
|
+
Column27("varchar", { nullable: true })
|
|
9946
10829
|
], Media.prototype, "mimeType", 2);
|
|
9947
10830
|
__decorateClass([
|
|
9948
|
-
|
|
10831
|
+
Column27("int", { default: 0 })
|
|
9949
10832
|
], Media.prototype, "size", 2);
|
|
9950
10833
|
__decorateClass([
|
|
9951
|
-
|
|
10834
|
+
Column27("varchar", { nullable: true })
|
|
9952
10835
|
], Media.prototype, "alt", 2);
|
|
9953
10836
|
__decorateClass([
|
|
9954
|
-
|
|
10837
|
+
Column27("boolean", { default: false })
|
|
9955
10838
|
], Media.prototype, "isPublic", 2);
|
|
9956
10839
|
__decorateClass([
|
|
9957
|
-
|
|
10840
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9958
10841
|
], Media.prototype, "createdAt", 2);
|
|
9959
10842
|
__decorateClass([
|
|
9960
|
-
|
|
10843
|
+
Column27({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
9961
10844
|
], Media.prototype, "updatedAt", 2);
|
|
9962
10845
|
__decorateClass([
|
|
9963
|
-
|
|
10846
|
+
Column27({ type: "timestamp", nullable: true })
|
|
9964
10847
|
], Media.prototype, "deletedAt", 2);
|
|
9965
10848
|
__decorateClass([
|
|
9966
|
-
|
|
10849
|
+
Column27("boolean", { default: false })
|
|
9967
10850
|
], Media.prototype, "deleted", 2);
|
|
9968
10851
|
Media = __decorateClass([
|
|
9969
|
-
|
|
10852
|
+
Entity27("media")
|
|
9970
10853
|
], Media);
|
|
9971
10854
|
|
|
9972
10855
|
// src/entities/page.entity.ts
|
|
9973
|
-
import { Entity as
|
|
10856
|
+
import { Entity as Entity28, PrimaryGeneratedColumn as PrimaryGeneratedColumn28, Column as Column28, ManyToOne as ManyToOne17, JoinColumn as JoinColumn17 } from "typeorm";
|
|
9974
10857
|
var Page = class {
|
|
9975
10858
|
id;
|
|
9976
10859
|
title;
|
|
@@ -9991,64 +10874,64 @@ var Page = class {
|
|
|
9991
10874
|
deletedBy;
|
|
9992
10875
|
};
|
|
9993
10876
|
__decorateClass([
|
|
9994
|
-
|
|
10877
|
+
PrimaryGeneratedColumn28()
|
|
9995
10878
|
], Page.prototype, "id", 2);
|
|
9996
10879
|
__decorateClass([
|
|
9997
|
-
|
|
10880
|
+
Column28("varchar")
|
|
9998
10881
|
], Page.prototype, "title", 2);
|
|
9999
10882
|
__decorateClass([
|
|
10000
|
-
|
|
10883
|
+
Column28("varchar", { unique: true })
|
|
10001
10884
|
], Page.prototype, "slug", 2);
|
|
10002
10885
|
__decorateClass([
|
|
10003
|
-
|
|
10886
|
+
Column28({ type: "jsonb", default: {} })
|
|
10004
10887
|
], Page.prototype, "content", 2);
|
|
10005
10888
|
__decorateClass([
|
|
10006
|
-
|
|
10889
|
+
Column28("boolean", { default: false })
|
|
10007
10890
|
], Page.prototype, "published", 2);
|
|
10008
10891
|
__decorateClass([
|
|
10009
|
-
|
|
10892
|
+
Column28("varchar", { default: "default" })
|
|
10010
10893
|
], Page.prototype, "theme", 2);
|
|
10011
10894
|
__decorateClass([
|
|
10012
|
-
|
|
10895
|
+
Column28("int", { nullable: true })
|
|
10013
10896
|
], Page.prototype, "parentId", 2);
|
|
10014
10897
|
__decorateClass([
|
|
10015
|
-
|
|
10016
|
-
|
|
10898
|
+
ManyToOne17(() => Page, { onDelete: "SET NULL" }),
|
|
10899
|
+
JoinColumn17({ name: "parentId" })
|
|
10017
10900
|
], Page.prototype, "parent", 2);
|
|
10018
10901
|
__decorateClass([
|
|
10019
|
-
|
|
10902
|
+
Column28("int", { nullable: true })
|
|
10020
10903
|
], Page.prototype, "seoId", 2);
|
|
10021
10904
|
__decorateClass([
|
|
10022
|
-
|
|
10023
|
-
|
|
10905
|
+
ManyToOne17(() => Seo, { onDelete: "SET NULL" }),
|
|
10906
|
+
JoinColumn17({ name: "seoId" })
|
|
10024
10907
|
], Page.prototype, "seo", 2);
|
|
10025
10908
|
__decorateClass([
|
|
10026
|
-
|
|
10909
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10027
10910
|
], Page.prototype, "createdAt", 2);
|
|
10028
10911
|
__decorateClass([
|
|
10029
|
-
|
|
10912
|
+
Column28({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10030
10913
|
], Page.prototype, "updatedAt", 2);
|
|
10031
10914
|
__decorateClass([
|
|
10032
|
-
|
|
10915
|
+
Column28({ type: "timestamp", nullable: true })
|
|
10033
10916
|
], Page.prototype, "deletedAt", 2);
|
|
10034
10917
|
__decorateClass([
|
|
10035
|
-
|
|
10918
|
+
Column28("boolean", { default: false })
|
|
10036
10919
|
], Page.prototype, "deleted", 2);
|
|
10037
10920
|
__decorateClass([
|
|
10038
|
-
|
|
10921
|
+
Column28("int", { nullable: true })
|
|
10039
10922
|
], Page.prototype, "createdBy", 2);
|
|
10040
10923
|
__decorateClass([
|
|
10041
|
-
|
|
10924
|
+
Column28("int", { nullable: true })
|
|
10042
10925
|
], Page.prototype, "updatedBy", 2);
|
|
10043
10926
|
__decorateClass([
|
|
10044
|
-
|
|
10927
|
+
Column28("int", { nullable: true })
|
|
10045
10928
|
], Page.prototype, "deletedBy", 2);
|
|
10046
10929
|
Page = __decorateClass([
|
|
10047
|
-
|
|
10930
|
+
Entity28("pages")
|
|
10048
10931
|
], Page);
|
|
10049
10932
|
|
|
10050
10933
|
// src/entities/product-category.entity.ts
|
|
10051
|
-
import { Entity as
|
|
10934
|
+
import { Entity as Entity29, PrimaryGeneratedColumn as PrimaryGeneratedColumn29, Column as Column29, ManyToOne as ManyToOne18, OneToMany as OneToMany12, JoinColumn as JoinColumn18, Unique as Unique3 } from "typeorm";
|
|
10052
10935
|
var ProductCategory = class {
|
|
10053
10936
|
id;
|
|
10054
10937
|
vendorId;
|
|
@@ -10074,63 +10957,63 @@ var ProductCategory = class {
|
|
|
10074
10957
|
collections;
|
|
10075
10958
|
};
|
|
10076
10959
|
__decorateClass([
|
|
10077
|
-
|
|
10960
|
+
PrimaryGeneratedColumn29()
|
|
10078
10961
|
], ProductCategory.prototype, "id", 2);
|
|
10079
10962
|
__decorateClass([
|
|
10080
|
-
|
|
10963
|
+
Column29("int")
|
|
10081
10964
|
], ProductCategory.prototype, "vendorId", 2);
|
|
10082
10965
|
__decorateClass([
|
|
10083
|
-
|
|
10966
|
+
Column29("varchar")
|
|
10084
10967
|
], ProductCategory.prototype, "name", 2);
|
|
10085
10968
|
__decorateClass([
|
|
10086
|
-
|
|
10969
|
+
Column29("varchar")
|
|
10087
10970
|
], ProductCategory.prototype, "slug", 2);
|
|
10088
10971
|
__decorateClass([
|
|
10089
|
-
|
|
10972
|
+
Column29("int", { nullable: true })
|
|
10090
10973
|
], ProductCategory.prototype, "parentId", 2);
|
|
10091
10974
|
__decorateClass([
|
|
10092
|
-
|
|
10975
|
+
Column29("varchar", { nullable: true })
|
|
10093
10976
|
], ProductCategory.prototype, "image", 2);
|
|
10094
10977
|
__decorateClass([
|
|
10095
|
-
|
|
10978
|
+
Column29("text", { nullable: true })
|
|
10096
10979
|
], ProductCategory.prototype, "description", 2);
|
|
10097
10980
|
__decorateClass([
|
|
10098
|
-
|
|
10981
|
+
Column29("jsonb", { nullable: true })
|
|
10099
10982
|
], ProductCategory.prototype, "metadata", 2);
|
|
10100
10983
|
__decorateClass([
|
|
10101
|
-
|
|
10984
|
+
Column29("boolean", { default: true })
|
|
10102
10985
|
], ProductCategory.prototype, "active", 2);
|
|
10103
10986
|
__decorateClass([
|
|
10104
|
-
|
|
10987
|
+
Column29("int", { default: 0 })
|
|
10105
10988
|
], ProductCategory.prototype, "sortOrder", 2);
|
|
10106
10989
|
__decorateClass([
|
|
10107
|
-
|
|
10990
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10108
10991
|
], ProductCategory.prototype, "createdAt", 2);
|
|
10109
10992
|
__decorateClass([
|
|
10110
|
-
|
|
10993
|
+
Column29({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10111
10994
|
], ProductCategory.prototype, "updatedAt", 2);
|
|
10112
10995
|
__decorateClass([
|
|
10113
|
-
|
|
10996
|
+
Column29({ type: "timestamp", nullable: true })
|
|
10114
10997
|
], ProductCategory.prototype, "deletedAt", 2);
|
|
10115
10998
|
__decorateClass([
|
|
10116
|
-
|
|
10999
|
+
Column29("boolean", { default: false })
|
|
10117
11000
|
], ProductCategory.prototype, "deleted", 2);
|
|
10118
11001
|
__decorateClass([
|
|
10119
|
-
|
|
11002
|
+
Column29("int", { nullable: true })
|
|
10120
11003
|
], ProductCategory.prototype, "createdBy", 2);
|
|
10121
11004
|
__decorateClass([
|
|
10122
|
-
|
|
11005
|
+
Column29("int", { nullable: true })
|
|
10123
11006
|
], ProductCategory.prototype, "updatedBy", 2);
|
|
10124
11007
|
__decorateClass([
|
|
10125
|
-
|
|
11008
|
+
Column29("int", { nullable: true })
|
|
10126
11009
|
], ProductCategory.prototype, "deletedBy", 2);
|
|
10127
11010
|
__decorateClass([
|
|
10128
|
-
|
|
10129
|
-
|
|
11011
|
+
ManyToOne18(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11012
|
+
JoinColumn18({ name: "vendorId" })
|
|
10130
11013
|
], ProductCategory.prototype, "vendor", 2);
|
|
10131
11014
|
__decorateClass([
|
|
10132
|
-
|
|
10133
|
-
|
|
11015
|
+
ManyToOne18(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
|
|
11016
|
+
JoinColumn18({ name: "parentId" })
|
|
10134
11017
|
], ProductCategory.prototype, "parent", 2);
|
|
10135
11018
|
__decorateClass([
|
|
10136
11019
|
OneToMany12(() => ProductCategory, (c) => c.parent)
|
|
@@ -10142,15 +11025,15 @@ __decorateClass([
|
|
|
10142
11025
|
OneToMany12("Collection", "category")
|
|
10143
11026
|
], ProductCategory.prototype, "collections", 2);
|
|
10144
11027
|
ProductCategory = __decorateClass([
|
|
10145
|
-
|
|
11028
|
+
Entity29("product_categories"),
|
|
10146
11029
|
Unique3("UQ_product_categories_vendor_slug", ["vendorId", "slug"])
|
|
10147
11030
|
], ProductCategory);
|
|
10148
11031
|
|
|
10149
11032
|
// src/entities/collection.entity.ts
|
|
10150
|
-
import { Entity as
|
|
11033
|
+
import { Entity as Entity31, PrimaryGeneratedColumn as PrimaryGeneratedColumn31, Column as Column31, ManyToOne as ManyToOne20, OneToMany as OneToMany14, JoinColumn as JoinColumn20, Unique as Unique5 } from "typeorm";
|
|
10151
11034
|
|
|
10152
11035
|
// src/entities/brand.entity.ts
|
|
10153
|
-
import { Entity as
|
|
11036
|
+
import { Entity as Entity30, PrimaryGeneratedColumn as PrimaryGeneratedColumn30, Column as Column30, OneToMany as OneToMany13, ManyToOne as ManyToOne19, JoinColumn as JoinColumn19, Unique as Unique4 } from "typeorm";
|
|
10154
11037
|
var Brand = class {
|
|
10155
11038
|
id;
|
|
10156
11039
|
vendorId;
|
|
@@ -10175,63 +11058,63 @@ var Brand = class {
|
|
|
10175
11058
|
collections;
|
|
10176
11059
|
};
|
|
10177
11060
|
__decorateClass([
|
|
10178
|
-
|
|
11061
|
+
PrimaryGeneratedColumn30()
|
|
10179
11062
|
], Brand.prototype, "id", 2);
|
|
10180
11063
|
__decorateClass([
|
|
10181
|
-
|
|
11064
|
+
Column30("int")
|
|
10182
11065
|
], Brand.prototype, "vendorId", 2);
|
|
10183
11066
|
__decorateClass([
|
|
10184
|
-
|
|
11067
|
+
Column30("varchar")
|
|
10185
11068
|
], Brand.prototype, "name", 2);
|
|
10186
11069
|
__decorateClass([
|
|
10187
|
-
|
|
11070
|
+
Column30("varchar")
|
|
10188
11071
|
], Brand.prototype, "slug", 2);
|
|
10189
11072
|
__decorateClass([
|
|
10190
|
-
|
|
11073
|
+
Column30("varchar", { nullable: true })
|
|
10191
11074
|
], Brand.prototype, "logo", 2);
|
|
10192
11075
|
__decorateClass([
|
|
10193
|
-
|
|
11076
|
+
Column30("jsonb", { nullable: true })
|
|
10194
11077
|
], Brand.prototype, "metadata", 2);
|
|
10195
11078
|
__decorateClass([
|
|
10196
|
-
|
|
11079
|
+
Column30("text", { nullable: true })
|
|
10197
11080
|
], Brand.prototype, "description", 2);
|
|
10198
11081
|
__decorateClass([
|
|
10199
|
-
|
|
11082
|
+
Column30("boolean", { default: true })
|
|
10200
11083
|
], Brand.prototype, "active", 2);
|
|
10201
11084
|
__decorateClass([
|
|
10202
|
-
|
|
11085
|
+
Column30("int", { default: 0 })
|
|
10203
11086
|
], Brand.prototype, "sortOrder", 2);
|
|
10204
11087
|
__decorateClass([
|
|
10205
|
-
|
|
11088
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10206
11089
|
], Brand.prototype, "createdAt", 2);
|
|
10207
11090
|
__decorateClass([
|
|
10208
|
-
|
|
11091
|
+
Column30({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10209
11092
|
], Brand.prototype, "updatedAt", 2);
|
|
10210
11093
|
__decorateClass([
|
|
10211
|
-
|
|
11094
|
+
Column30({ type: "timestamp", nullable: true })
|
|
10212
11095
|
], Brand.prototype, "deletedAt", 2);
|
|
10213
11096
|
__decorateClass([
|
|
10214
|
-
|
|
11097
|
+
Column30("boolean", { default: false })
|
|
10215
11098
|
], Brand.prototype, "deleted", 2);
|
|
10216
11099
|
__decorateClass([
|
|
10217
|
-
|
|
11100
|
+
Column30("int", { nullable: true })
|
|
10218
11101
|
], Brand.prototype, "createdBy", 2);
|
|
10219
11102
|
__decorateClass([
|
|
10220
|
-
|
|
11103
|
+
Column30("int", { nullable: true })
|
|
10221
11104
|
], Brand.prototype, "updatedBy", 2);
|
|
10222
11105
|
__decorateClass([
|
|
10223
|
-
|
|
11106
|
+
Column30("int", { nullable: true })
|
|
10224
11107
|
], Brand.prototype, "deletedBy", 2);
|
|
10225
11108
|
__decorateClass([
|
|
10226
|
-
|
|
11109
|
+
Column30("int", { nullable: true })
|
|
10227
11110
|
], Brand.prototype, "seoId", 2);
|
|
10228
11111
|
__decorateClass([
|
|
10229
|
-
|
|
10230
|
-
|
|
11112
|
+
ManyToOne19(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11113
|
+
JoinColumn19({ name: "vendorId" })
|
|
10231
11114
|
], Brand.prototype, "vendor", 2);
|
|
10232
11115
|
__decorateClass([
|
|
10233
|
-
|
|
10234
|
-
|
|
11116
|
+
ManyToOne19(() => Seo, { onDelete: "SET NULL" }),
|
|
11117
|
+
JoinColumn19({ name: "seoId" })
|
|
10235
11118
|
], Brand.prototype, "seo", 2);
|
|
10236
11119
|
__decorateClass([
|
|
10237
11120
|
OneToMany13("Product", "brand")
|
|
@@ -10240,7 +11123,7 @@ __decorateClass([
|
|
|
10240
11123
|
OneToMany13("Collection", "brand")
|
|
10241
11124
|
], Brand.prototype, "collections", 2);
|
|
10242
11125
|
Brand = __decorateClass([
|
|
10243
|
-
|
|
11126
|
+
Entity30("brands"),
|
|
10244
11127
|
Unique4("UQ_brands_vendor_slug", ["vendorId", "slug"])
|
|
10245
11128
|
], Brand);
|
|
10246
11129
|
|
|
@@ -10274,94 +11157,94 @@ var Collection = class {
|
|
|
10274
11157
|
products;
|
|
10275
11158
|
};
|
|
10276
11159
|
__decorateClass([
|
|
10277
|
-
|
|
11160
|
+
PrimaryGeneratedColumn31()
|
|
10278
11161
|
], Collection.prototype, "id", 2);
|
|
10279
11162
|
__decorateClass([
|
|
10280
|
-
|
|
11163
|
+
Column31("int")
|
|
10281
11164
|
], Collection.prototype, "vendorId", 2);
|
|
10282
11165
|
__decorateClass([
|
|
10283
|
-
|
|
11166
|
+
Column31("int", { nullable: true })
|
|
10284
11167
|
], Collection.prototype, "categoryId", 2);
|
|
10285
11168
|
__decorateClass([
|
|
10286
|
-
|
|
11169
|
+
Column31("int", { nullable: true })
|
|
10287
11170
|
], Collection.prototype, "brandId", 2);
|
|
10288
11171
|
__decorateClass([
|
|
10289
|
-
|
|
11172
|
+
Column31("varchar")
|
|
10290
11173
|
], Collection.prototype, "name", 2);
|
|
10291
11174
|
__decorateClass([
|
|
10292
|
-
|
|
11175
|
+
Column31("varchar")
|
|
10293
11176
|
], Collection.prototype, "slug", 2);
|
|
10294
11177
|
__decorateClass([
|
|
10295
|
-
|
|
11178
|
+
Column31("varchar", { nullable: true })
|
|
10296
11179
|
], Collection.prototype, "hsn", 2);
|
|
10297
11180
|
__decorateClass([
|
|
10298
|
-
|
|
11181
|
+
Column31("text", { nullable: true })
|
|
10299
11182
|
], Collection.prototype, "description", 2);
|
|
10300
11183
|
__decorateClass([
|
|
10301
|
-
|
|
11184
|
+
Column31("varchar", { nullable: true })
|
|
10302
11185
|
], Collection.prototype, "image", 2);
|
|
10303
11186
|
__decorateClass([
|
|
10304
|
-
|
|
11187
|
+
Column31("jsonb", { nullable: true })
|
|
10305
11188
|
], Collection.prototype, "metadata", 2);
|
|
10306
11189
|
__decorateClass([
|
|
10307
|
-
|
|
11190
|
+
Column31("jsonb", { nullable: true })
|
|
10308
11191
|
], Collection.prototype, "variants", 2);
|
|
10309
11192
|
__decorateClass([
|
|
10310
|
-
|
|
11193
|
+
Column31("boolean", { default: true })
|
|
10311
11194
|
], Collection.prototype, "active", 2);
|
|
10312
11195
|
__decorateClass([
|
|
10313
|
-
|
|
11196
|
+
Column31("int", { default: 0 })
|
|
10314
11197
|
], Collection.prototype, "sortOrder", 2);
|
|
10315
11198
|
__decorateClass([
|
|
10316
|
-
|
|
11199
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10317
11200
|
], Collection.prototype, "createdAt", 2);
|
|
10318
11201
|
__decorateClass([
|
|
10319
|
-
|
|
11202
|
+
Column31({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10320
11203
|
], Collection.prototype, "updatedAt", 2);
|
|
10321
11204
|
__decorateClass([
|
|
10322
|
-
|
|
11205
|
+
Column31({ type: "timestamp", nullable: true })
|
|
10323
11206
|
], Collection.prototype, "deletedAt", 2);
|
|
10324
11207
|
__decorateClass([
|
|
10325
|
-
|
|
11208
|
+
Column31("boolean", { default: false })
|
|
10326
11209
|
], Collection.prototype, "deleted", 2);
|
|
10327
11210
|
__decorateClass([
|
|
10328
|
-
|
|
11211
|
+
Column31("int", { nullable: true })
|
|
10329
11212
|
], Collection.prototype, "createdBy", 2);
|
|
10330
11213
|
__decorateClass([
|
|
10331
|
-
|
|
11214
|
+
Column31("int", { nullable: true })
|
|
10332
11215
|
], Collection.prototype, "updatedBy", 2);
|
|
10333
11216
|
__decorateClass([
|
|
10334
|
-
|
|
11217
|
+
Column31("int", { nullable: true })
|
|
10335
11218
|
], Collection.prototype, "deletedBy", 2);
|
|
10336
11219
|
__decorateClass([
|
|
10337
|
-
|
|
11220
|
+
Column31("int", { nullable: true })
|
|
10338
11221
|
], Collection.prototype, "seoId", 2);
|
|
10339
11222
|
__decorateClass([
|
|
10340
|
-
|
|
10341
|
-
|
|
11223
|
+
ManyToOne20(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11224
|
+
JoinColumn20({ name: "vendorId" })
|
|
10342
11225
|
], Collection.prototype, "vendor", 2);
|
|
10343
11226
|
__decorateClass([
|
|
10344
|
-
|
|
10345
|
-
|
|
11227
|
+
ManyToOne20(() => Seo, { onDelete: "SET NULL" }),
|
|
11228
|
+
JoinColumn20({ name: "seoId" })
|
|
10346
11229
|
], Collection.prototype, "seo", 2);
|
|
10347
11230
|
__decorateClass([
|
|
10348
|
-
|
|
10349
|
-
|
|
11231
|
+
ManyToOne20(() => ProductCategory, (c) => c.collections, { onDelete: "SET NULL" }),
|
|
11232
|
+
JoinColumn20({ name: "categoryId" })
|
|
10350
11233
|
], Collection.prototype, "category", 2);
|
|
10351
11234
|
__decorateClass([
|
|
10352
|
-
|
|
10353
|
-
|
|
11235
|
+
ManyToOne20(() => Brand, (b) => b.collections, { onDelete: "SET NULL" }),
|
|
11236
|
+
JoinColumn20({ name: "brandId" })
|
|
10354
11237
|
], Collection.prototype, "brand", 2);
|
|
10355
11238
|
__decorateClass([
|
|
10356
11239
|
OneToMany14("Product", "collection")
|
|
10357
11240
|
], Collection.prototype, "products", 2);
|
|
10358
11241
|
Collection = __decorateClass([
|
|
10359
|
-
|
|
11242
|
+
Entity31("collections"),
|
|
10360
11243
|
Unique5("UQ_collections_vendor_slug", ["vendorId", "slug"])
|
|
10361
11244
|
], Collection);
|
|
10362
11245
|
|
|
10363
11246
|
// src/entities/product.entity.ts
|
|
10364
|
-
import { Entity as
|
|
11247
|
+
import { Entity as Entity32, PrimaryGeneratedColumn as PrimaryGeneratedColumn32, Column as Column32, ManyToOne as ManyToOne21, OneToMany as OneToMany15, JoinColumn as JoinColumn21, Unique as Unique6 } from "typeorm";
|
|
10365
11248
|
var Product = class {
|
|
10366
11249
|
id;
|
|
10367
11250
|
vendorId;
|
|
@@ -10397,99 +11280,99 @@ var Product = class {
|
|
|
10397
11280
|
taxes;
|
|
10398
11281
|
};
|
|
10399
11282
|
__decorateClass([
|
|
10400
|
-
|
|
11283
|
+
PrimaryGeneratedColumn32()
|
|
10401
11284
|
], Product.prototype, "id", 2);
|
|
10402
11285
|
__decorateClass([
|
|
10403
|
-
|
|
11286
|
+
Column32("int")
|
|
10404
11287
|
], Product.prototype, "vendorId", 2);
|
|
10405
11288
|
__decorateClass([
|
|
10406
|
-
|
|
11289
|
+
Column32("int", { nullable: true })
|
|
10407
11290
|
], Product.prototype, "collectionId", 2);
|
|
10408
11291
|
__decorateClass([
|
|
10409
|
-
|
|
11292
|
+
Column32("int", { nullable: true })
|
|
10410
11293
|
], Product.prototype, "brandId", 2);
|
|
10411
11294
|
__decorateClass([
|
|
10412
|
-
|
|
11295
|
+
Column32("int", { nullable: true })
|
|
10413
11296
|
], Product.prototype, "categoryId", 2);
|
|
10414
11297
|
__decorateClass([
|
|
10415
|
-
|
|
11298
|
+
Column32("varchar", { nullable: true })
|
|
10416
11299
|
], Product.prototype, "sku", 2);
|
|
10417
11300
|
__decorateClass([
|
|
10418
|
-
|
|
11301
|
+
Column32("varchar", { nullable: true })
|
|
10419
11302
|
], Product.prototype, "hsn", 2);
|
|
10420
11303
|
__decorateClass([
|
|
10421
|
-
|
|
11304
|
+
Column32("varchar", { nullable: true })
|
|
10422
11305
|
], Product.prototype, "uom", 2);
|
|
10423
11306
|
__decorateClass([
|
|
10424
|
-
|
|
11307
|
+
Column32("varchar", { default: "product" })
|
|
10425
11308
|
], Product.prototype, "type", 2);
|
|
10426
11309
|
__decorateClass([
|
|
10427
|
-
|
|
11310
|
+
Column32("varchar", { nullable: true })
|
|
10428
11311
|
], Product.prototype, "slug", 2);
|
|
10429
11312
|
__decorateClass([
|
|
10430
|
-
|
|
11313
|
+
Column32("varchar", { nullable: true })
|
|
10431
11314
|
], Product.prototype, "name", 2);
|
|
10432
11315
|
__decorateClass([
|
|
10433
|
-
|
|
11316
|
+
Column32("decimal", { precision: 12, scale: 2 })
|
|
10434
11317
|
], Product.prototype, "price", 2);
|
|
10435
11318
|
__decorateClass([
|
|
10436
|
-
|
|
11319
|
+
Column32("decimal", { precision: 12, scale: 2, nullable: true })
|
|
10437
11320
|
], Product.prototype, "compareAtPrice", 2);
|
|
10438
11321
|
__decorateClass([
|
|
10439
|
-
|
|
11322
|
+
Column32("int", { default: 0 })
|
|
10440
11323
|
], Product.prototype, "quantity", 2);
|
|
10441
11324
|
__decorateClass([
|
|
10442
|
-
|
|
11325
|
+
Column32("varchar", { default: "draft" })
|
|
10443
11326
|
], Product.prototype, "status", 2);
|
|
10444
11327
|
__decorateClass([
|
|
10445
|
-
|
|
11328
|
+
Column32("boolean", { default: false })
|
|
10446
11329
|
], Product.prototype, "featured", 2);
|
|
10447
11330
|
__decorateClass([
|
|
10448
|
-
|
|
11331
|
+
Column32("jsonb", { nullable: true })
|
|
10449
11332
|
], Product.prototype, "metadata", 2);
|
|
10450
11333
|
__decorateClass([
|
|
10451
|
-
|
|
11334
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10452
11335
|
], Product.prototype, "createdAt", 2);
|
|
10453
11336
|
__decorateClass([
|
|
10454
|
-
|
|
11337
|
+
Column32({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10455
11338
|
], Product.prototype, "updatedAt", 2);
|
|
10456
11339
|
__decorateClass([
|
|
10457
|
-
|
|
11340
|
+
Column32({ type: "timestamp", nullable: true })
|
|
10458
11341
|
], Product.prototype, "deletedAt", 2);
|
|
10459
11342
|
__decorateClass([
|
|
10460
|
-
|
|
11343
|
+
Column32("boolean", { default: false })
|
|
10461
11344
|
], Product.prototype, "deleted", 2);
|
|
10462
11345
|
__decorateClass([
|
|
10463
|
-
|
|
11346
|
+
Column32("int", { nullable: true })
|
|
10464
11347
|
], Product.prototype, "createdBy", 2);
|
|
10465
11348
|
__decorateClass([
|
|
10466
|
-
|
|
11349
|
+
Column32("int", { nullable: true })
|
|
10467
11350
|
], Product.prototype, "updatedBy", 2);
|
|
10468
11351
|
__decorateClass([
|
|
10469
|
-
|
|
11352
|
+
Column32("int", { nullable: true })
|
|
10470
11353
|
], Product.prototype, "deletedBy", 2);
|
|
10471
11354
|
__decorateClass([
|
|
10472
|
-
|
|
11355
|
+
Column32("int", { nullable: true })
|
|
10473
11356
|
], Product.prototype, "seoId", 2);
|
|
10474
11357
|
__decorateClass([
|
|
10475
|
-
|
|
10476
|
-
|
|
11358
|
+
ManyToOne21(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11359
|
+
JoinColumn21({ name: "vendorId" })
|
|
10477
11360
|
], Product.prototype, "vendor", 2);
|
|
10478
11361
|
__decorateClass([
|
|
10479
|
-
|
|
10480
|
-
|
|
11362
|
+
ManyToOne21(() => Seo, { onDelete: "SET NULL" }),
|
|
11363
|
+
JoinColumn21({ name: "seoId" })
|
|
10481
11364
|
], Product.prototype, "seo", 2);
|
|
10482
11365
|
__decorateClass([
|
|
10483
|
-
|
|
10484
|
-
|
|
11366
|
+
ManyToOne21(() => Collection, (c) => c.products, { onDelete: "SET NULL" }),
|
|
11367
|
+
JoinColumn21({ name: "collectionId" })
|
|
10485
11368
|
], Product.prototype, "collection", 2);
|
|
10486
11369
|
__decorateClass([
|
|
10487
|
-
|
|
10488
|
-
|
|
11370
|
+
ManyToOne21(() => Brand, (b) => b.products, { onDelete: "SET NULL" }),
|
|
11371
|
+
JoinColumn21({ name: "brandId" })
|
|
10489
11372
|
], Product.prototype, "brand", 2);
|
|
10490
11373
|
__decorateClass([
|
|
10491
|
-
|
|
10492
|
-
|
|
11374
|
+
ManyToOne21(() => ProductCategory, (c) => c.products, { onDelete: "SET NULL" }),
|
|
11375
|
+
JoinColumn21({ name: "categoryId" })
|
|
10493
11376
|
], Product.prototype, "category", 2);
|
|
10494
11377
|
__decorateClass([
|
|
10495
11378
|
OneToMany15("ProductAttribute", "product")
|
|
@@ -10498,12 +11381,12 @@ __decorateClass([
|
|
|
10498
11381
|
OneToMany15("ProductTax", "product")
|
|
10499
11382
|
], Product.prototype, "taxes", 2);
|
|
10500
11383
|
Product = __decorateClass([
|
|
10501
|
-
|
|
11384
|
+
Entity32("products"),
|
|
10502
11385
|
Unique6("UQ_products_vendor_slug", ["vendorId", "slug"])
|
|
10503
11386
|
], Product);
|
|
10504
11387
|
|
|
10505
11388
|
// src/entities/attribute.entity.ts
|
|
10506
|
-
import { Entity as
|
|
11389
|
+
import { Entity as Entity33, PrimaryGeneratedColumn as PrimaryGeneratedColumn33, Column as Column33, ManyToOne as ManyToOne22, JoinColumn as JoinColumn22, Unique as Unique7 } from "typeorm";
|
|
10507
11390
|
var Attribute = class {
|
|
10508
11391
|
id;
|
|
10509
11392
|
vendorId;
|
|
@@ -10524,64 +11407,64 @@ var Attribute = class {
|
|
|
10524
11407
|
vendor;
|
|
10525
11408
|
};
|
|
10526
11409
|
__decorateClass([
|
|
10527
|
-
|
|
11410
|
+
PrimaryGeneratedColumn33()
|
|
10528
11411
|
], Attribute.prototype, "id", 2);
|
|
10529
11412
|
__decorateClass([
|
|
10530
|
-
|
|
11413
|
+
Column33("int")
|
|
10531
11414
|
], Attribute.prototype, "vendorId", 2);
|
|
10532
11415
|
__decorateClass([
|
|
10533
|
-
|
|
11416
|
+
Column33("varchar")
|
|
10534
11417
|
], Attribute.prototype, "name", 2);
|
|
10535
11418
|
__decorateClass([
|
|
10536
|
-
|
|
11419
|
+
Column33("varchar")
|
|
10537
11420
|
], Attribute.prototype, "slug", 2);
|
|
10538
11421
|
__decorateClass([
|
|
10539
|
-
|
|
11422
|
+
Column33("varchar", { default: "text" })
|
|
10540
11423
|
], Attribute.prototype, "type", 2);
|
|
10541
11424
|
__decorateClass([
|
|
10542
|
-
|
|
11425
|
+
Column33("jsonb", { nullable: true })
|
|
10543
11426
|
], Attribute.prototype, "options", 2);
|
|
10544
11427
|
__decorateClass([
|
|
10545
|
-
|
|
11428
|
+
Column33("jsonb", { nullable: true })
|
|
10546
11429
|
], Attribute.prototype, "metadata", 2);
|
|
10547
11430
|
__decorateClass([
|
|
10548
|
-
|
|
11431
|
+
Column33("boolean", { default: true })
|
|
10549
11432
|
], Attribute.prototype, "active", 2);
|
|
10550
11433
|
__decorateClass([
|
|
10551
|
-
|
|
11434
|
+
Column33("int", { default: 0 })
|
|
10552
11435
|
], Attribute.prototype, "sortOrder", 2);
|
|
10553
11436
|
__decorateClass([
|
|
10554
|
-
|
|
11437
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10555
11438
|
], Attribute.prototype, "createdAt", 2);
|
|
10556
11439
|
__decorateClass([
|
|
10557
|
-
|
|
11440
|
+
Column33({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10558
11441
|
], Attribute.prototype, "updatedAt", 2);
|
|
10559
11442
|
__decorateClass([
|
|
10560
|
-
|
|
11443
|
+
Column33({ type: "timestamp", nullable: true })
|
|
10561
11444
|
], Attribute.prototype, "deletedAt", 2);
|
|
10562
11445
|
__decorateClass([
|
|
10563
|
-
|
|
11446
|
+
Column33("boolean", { default: false })
|
|
10564
11447
|
], Attribute.prototype, "deleted", 2);
|
|
10565
11448
|
__decorateClass([
|
|
10566
|
-
|
|
11449
|
+
Column33("int", { nullable: true })
|
|
10567
11450
|
], Attribute.prototype, "createdBy", 2);
|
|
10568
11451
|
__decorateClass([
|
|
10569
|
-
|
|
11452
|
+
Column33("int", { nullable: true })
|
|
10570
11453
|
], Attribute.prototype, "updatedBy", 2);
|
|
10571
11454
|
__decorateClass([
|
|
10572
|
-
|
|
11455
|
+
Column33("int", { nullable: true })
|
|
10573
11456
|
], Attribute.prototype, "deletedBy", 2);
|
|
10574
11457
|
__decorateClass([
|
|
10575
|
-
|
|
10576
|
-
|
|
11458
|
+
ManyToOne22(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11459
|
+
JoinColumn22({ name: "vendorId" })
|
|
10577
11460
|
], Attribute.prototype, "vendor", 2);
|
|
10578
11461
|
Attribute = __decorateClass([
|
|
10579
|
-
|
|
11462
|
+
Entity33("attributes"),
|
|
10580
11463
|
Unique7("UQ_attributes_vendor_slug", ["vendorId", "slug"])
|
|
10581
11464
|
], Attribute);
|
|
10582
11465
|
|
|
10583
11466
|
// src/entities/product-attribute.entity.ts
|
|
10584
|
-
import { Entity as
|
|
11467
|
+
import { Entity as Entity34, PrimaryGeneratedColumn as PrimaryGeneratedColumn34, Column as Column34, ManyToOne as ManyToOne23, JoinColumn as JoinColumn23 } from "typeorm";
|
|
10585
11468
|
var ProductAttribute = class {
|
|
10586
11469
|
id;
|
|
10587
11470
|
productId;
|
|
@@ -10594,40 +11477,40 @@ var ProductAttribute = class {
|
|
|
10594
11477
|
attribute;
|
|
10595
11478
|
};
|
|
10596
11479
|
__decorateClass([
|
|
10597
|
-
|
|
11480
|
+
PrimaryGeneratedColumn34()
|
|
10598
11481
|
], ProductAttribute.prototype, "id", 2);
|
|
10599
11482
|
__decorateClass([
|
|
10600
|
-
|
|
11483
|
+
Column34("int")
|
|
10601
11484
|
], ProductAttribute.prototype, "productId", 2);
|
|
10602
11485
|
__decorateClass([
|
|
10603
|
-
|
|
11486
|
+
Column34("int")
|
|
10604
11487
|
], ProductAttribute.prototype, "attributeId", 2);
|
|
10605
11488
|
__decorateClass([
|
|
10606
|
-
|
|
11489
|
+
Column34("varchar")
|
|
10607
11490
|
], ProductAttribute.prototype, "value", 2);
|
|
10608
11491
|
__decorateClass([
|
|
10609
|
-
|
|
11492
|
+
Column34("jsonb", { nullable: true })
|
|
10610
11493
|
], ProductAttribute.prototype, "metadata", 2);
|
|
10611
11494
|
__decorateClass([
|
|
10612
|
-
|
|
11495
|
+
Column34({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10613
11496
|
], ProductAttribute.prototype, "createdAt", 2);
|
|
10614
11497
|
__decorateClass([
|
|
10615
|
-
|
|
11498
|
+
Column34({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10616
11499
|
], ProductAttribute.prototype, "updatedAt", 2);
|
|
10617
11500
|
__decorateClass([
|
|
10618
|
-
|
|
10619
|
-
|
|
11501
|
+
ManyToOne23(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
|
|
11502
|
+
JoinColumn23({ name: "productId" })
|
|
10620
11503
|
], ProductAttribute.prototype, "product", 2);
|
|
10621
11504
|
__decorateClass([
|
|
10622
|
-
|
|
10623
|
-
|
|
11505
|
+
ManyToOne23(() => Attribute, { onDelete: "CASCADE" }),
|
|
11506
|
+
JoinColumn23({ name: "attributeId" })
|
|
10624
11507
|
], ProductAttribute.prototype, "attribute", 2);
|
|
10625
11508
|
ProductAttribute = __decorateClass([
|
|
10626
|
-
|
|
11509
|
+
Entity34("product_attributes")
|
|
10627
11510
|
], ProductAttribute);
|
|
10628
11511
|
|
|
10629
11512
|
// src/entities/tax.entity.ts
|
|
10630
|
-
import { Entity as
|
|
11513
|
+
import { Entity as Entity35, PrimaryGeneratedColumn as PrimaryGeneratedColumn35, Column as Column35, ManyToOne as ManyToOne24, JoinColumn as JoinColumn24, Unique as Unique8 } from "typeorm";
|
|
10631
11514
|
var Tax = class {
|
|
10632
11515
|
id;
|
|
10633
11516
|
vendorId;
|
|
@@ -10648,64 +11531,64 @@ var Tax = class {
|
|
|
10648
11531
|
vendor;
|
|
10649
11532
|
};
|
|
10650
11533
|
__decorateClass([
|
|
10651
|
-
|
|
11534
|
+
PrimaryGeneratedColumn35()
|
|
10652
11535
|
], Tax.prototype, "id", 2);
|
|
10653
11536
|
__decorateClass([
|
|
10654
|
-
|
|
11537
|
+
Column35("int")
|
|
10655
11538
|
], Tax.prototype, "vendorId", 2);
|
|
10656
11539
|
__decorateClass([
|
|
10657
|
-
|
|
11540
|
+
Column35("varchar")
|
|
10658
11541
|
], Tax.prototype, "name", 2);
|
|
10659
11542
|
__decorateClass([
|
|
10660
|
-
|
|
11543
|
+
Column35("varchar")
|
|
10661
11544
|
], Tax.prototype, "slug", 2);
|
|
10662
11545
|
__decorateClass([
|
|
10663
|
-
|
|
11546
|
+
Column35("decimal", { precision: 5, scale: 2 })
|
|
10664
11547
|
], Tax.prototype, "rate", 2);
|
|
10665
11548
|
__decorateClass([
|
|
10666
|
-
|
|
11549
|
+
Column35("boolean", { default: false })
|
|
10667
11550
|
], Tax.prototype, "isDefault", 2);
|
|
10668
11551
|
__decorateClass([
|
|
10669
|
-
|
|
11552
|
+
Column35("text", { nullable: true })
|
|
10670
11553
|
], Tax.prototype, "description", 2);
|
|
10671
11554
|
__decorateClass([
|
|
10672
|
-
|
|
11555
|
+
Column35("boolean", { default: true })
|
|
10673
11556
|
], Tax.prototype, "active", 2);
|
|
10674
11557
|
__decorateClass([
|
|
10675
|
-
|
|
11558
|
+
Column35("jsonb", { nullable: true })
|
|
10676
11559
|
], Tax.prototype, "metadata", 2);
|
|
10677
11560
|
__decorateClass([
|
|
10678
|
-
|
|
11561
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10679
11562
|
], Tax.prototype, "createdAt", 2);
|
|
10680
11563
|
__decorateClass([
|
|
10681
|
-
|
|
11564
|
+
Column35({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10682
11565
|
], Tax.prototype, "updatedAt", 2);
|
|
10683
11566
|
__decorateClass([
|
|
10684
|
-
|
|
11567
|
+
Column35({ type: "timestamp", nullable: true })
|
|
10685
11568
|
], Tax.prototype, "deletedAt", 2);
|
|
10686
11569
|
__decorateClass([
|
|
10687
|
-
|
|
11570
|
+
Column35("boolean", { default: false })
|
|
10688
11571
|
], Tax.prototype, "deleted", 2);
|
|
10689
11572
|
__decorateClass([
|
|
10690
|
-
|
|
11573
|
+
Column35("int", { nullable: true })
|
|
10691
11574
|
], Tax.prototype, "createdBy", 2);
|
|
10692
11575
|
__decorateClass([
|
|
10693
|
-
|
|
11576
|
+
Column35("int", { nullable: true })
|
|
10694
11577
|
], Tax.prototype, "updatedBy", 2);
|
|
10695
11578
|
__decorateClass([
|
|
10696
|
-
|
|
11579
|
+
Column35("int", { nullable: true })
|
|
10697
11580
|
], Tax.prototype, "deletedBy", 2);
|
|
10698
11581
|
__decorateClass([
|
|
10699
|
-
|
|
10700
|
-
|
|
11582
|
+
ManyToOne24(() => Vendor, { onDelete: "RESTRICT" }),
|
|
11583
|
+
JoinColumn24({ name: "vendorId" })
|
|
10701
11584
|
], Tax.prototype, "vendor", 2);
|
|
10702
11585
|
Tax = __decorateClass([
|
|
10703
|
-
|
|
11586
|
+
Entity35("taxes"),
|
|
10704
11587
|
Unique8("UQ_taxes_vendor_slug", ["vendorId", "slug"])
|
|
10705
11588
|
], Tax);
|
|
10706
11589
|
|
|
10707
11590
|
// src/entities/product-tax.entity.ts
|
|
10708
|
-
import { Entity as
|
|
11591
|
+
import { Entity as Entity36, PrimaryGeneratedColumn as PrimaryGeneratedColumn36, Column as Column36, ManyToOne as ManyToOne25, JoinColumn as JoinColumn25 } from "typeorm";
|
|
10709
11592
|
var ProductTax = class {
|
|
10710
11593
|
id;
|
|
10711
11594
|
productId;
|
|
@@ -10717,37 +11600,37 @@ var ProductTax = class {
|
|
|
10717
11600
|
tax;
|
|
10718
11601
|
};
|
|
10719
11602
|
__decorateClass([
|
|
10720
|
-
|
|
11603
|
+
PrimaryGeneratedColumn36()
|
|
10721
11604
|
], ProductTax.prototype, "id", 2);
|
|
10722
11605
|
__decorateClass([
|
|
10723
|
-
|
|
11606
|
+
Column36("int")
|
|
10724
11607
|
], ProductTax.prototype, "productId", 2);
|
|
10725
11608
|
__decorateClass([
|
|
10726
|
-
|
|
11609
|
+
Column36("int")
|
|
10727
11610
|
], ProductTax.prototype, "taxId", 2);
|
|
10728
11611
|
__decorateClass([
|
|
10729
|
-
|
|
11612
|
+
Column36("decimal", { precision: 5, scale: 2, nullable: true })
|
|
10730
11613
|
], ProductTax.prototype, "rate", 2);
|
|
10731
11614
|
__decorateClass([
|
|
10732
|
-
|
|
11615
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10733
11616
|
], ProductTax.prototype, "createdAt", 2);
|
|
10734
11617
|
__decorateClass([
|
|
10735
|
-
|
|
11618
|
+
Column36({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10736
11619
|
], ProductTax.prototype, "updatedAt", 2);
|
|
10737
11620
|
__decorateClass([
|
|
10738
|
-
|
|
10739
|
-
|
|
11621
|
+
ManyToOne25(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
|
|
11622
|
+
JoinColumn25({ name: "productId" })
|
|
10740
11623
|
], ProductTax.prototype, "product", 2);
|
|
10741
11624
|
__decorateClass([
|
|
10742
|
-
|
|
10743
|
-
|
|
11625
|
+
ManyToOne25(() => Tax, { onDelete: "CASCADE" }),
|
|
11626
|
+
JoinColumn25({ name: "taxId" })
|
|
10744
11627
|
], ProductTax.prototype, "tax", 2);
|
|
10745
11628
|
ProductTax = __decorateClass([
|
|
10746
|
-
|
|
11629
|
+
Entity36("product_taxes")
|
|
10747
11630
|
], ProductTax);
|
|
10748
11631
|
|
|
10749
11632
|
// src/entities/order-item.entity.ts
|
|
10750
|
-
import { Entity as
|
|
11633
|
+
import { Entity as Entity37, PrimaryGeneratedColumn as PrimaryGeneratedColumn37, Column as Column37, ManyToOne as ManyToOne26, JoinColumn as JoinColumn26 } from "typeorm";
|
|
10751
11634
|
var OrderItem = class {
|
|
10752
11635
|
id;
|
|
10753
11636
|
orderId;
|
|
@@ -10772,79 +11655,79 @@ var OrderItem = class {
|
|
|
10772
11655
|
product;
|
|
10773
11656
|
};
|
|
10774
11657
|
__decorateClass([
|
|
10775
|
-
|
|
11658
|
+
PrimaryGeneratedColumn37()
|
|
10776
11659
|
], OrderItem.prototype, "id", 2);
|
|
10777
11660
|
__decorateClass([
|
|
10778
|
-
|
|
11661
|
+
Column37("int")
|
|
10779
11662
|
], OrderItem.prototype, "orderId", 2);
|
|
10780
11663
|
__decorateClass([
|
|
10781
|
-
|
|
11664
|
+
Column37("int")
|
|
10782
11665
|
], OrderItem.prototype, "productId", 2);
|
|
10783
11666
|
__decorateClass([
|
|
10784
|
-
|
|
11667
|
+
Column37({ type: "int", array: true, nullable: true, default: () => "ARRAY[]::INTEGER[]" })
|
|
10785
11668
|
], OrderItem.prototype, "discountIds", 2);
|
|
10786
11669
|
__decorateClass([
|
|
10787
|
-
|
|
11670
|
+
Column37("int", { default: 1 })
|
|
10788
11671
|
], OrderItem.prototype, "quantity", 2);
|
|
10789
11672
|
__decorateClass([
|
|
10790
|
-
|
|
11673
|
+
Column37({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
10791
11674
|
], OrderItem.prototype, "unitPrice", 2);
|
|
10792
11675
|
__decorateClass([
|
|
10793
|
-
|
|
11676
|
+
Column37({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
10794
11677
|
], OrderItem.prototype, "subTotal", 2);
|
|
10795
11678
|
__decorateClass([
|
|
10796
|
-
|
|
11679
|
+
Column37({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
10797
11680
|
], OrderItem.prototype, "discount", 2);
|
|
10798
11681
|
__decorateClass([
|
|
10799
|
-
|
|
11682
|
+
Column37({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
10800
11683
|
], OrderItem.prototype, "discountedAmount", 2);
|
|
10801
11684
|
__decorateClass([
|
|
10802
|
-
|
|
11685
|
+
Column37("decimal", { precision: 12, scale: 2, default: 0 })
|
|
10803
11686
|
], OrderItem.prototype, "tax", 2);
|
|
10804
11687
|
__decorateClass([
|
|
10805
|
-
|
|
11688
|
+
Column37("decimal", { precision: 12, scale: 2 })
|
|
10806
11689
|
], OrderItem.prototype, "total", 2);
|
|
10807
11690
|
__decorateClass([
|
|
10808
|
-
|
|
11691
|
+
Column37("varchar", { nullable: true })
|
|
10809
11692
|
], OrderItem.prototype, "hsn", 2);
|
|
10810
11693
|
__decorateClass([
|
|
10811
|
-
|
|
11694
|
+
Column37("varchar", { nullable: true })
|
|
10812
11695
|
], OrderItem.prototype, "uom", 2);
|
|
10813
11696
|
__decorateClass([
|
|
10814
|
-
|
|
11697
|
+
Column37("varchar", { nullable: true })
|
|
10815
11698
|
], OrderItem.prototype, "productType", 2);
|
|
10816
11699
|
__decorateClass([
|
|
10817
|
-
|
|
11700
|
+
Column37("decimal", { precision: 5, scale: 2, nullable: true })
|
|
10818
11701
|
], OrderItem.prototype, "taxRate", 2);
|
|
10819
11702
|
__decorateClass([
|
|
10820
|
-
|
|
11703
|
+
Column37("varchar", { nullable: true })
|
|
10821
11704
|
], OrderItem.prototype, "taxCode", 2);
|
|
10822
11705
|
__decorateClass([
|
|
10823
|
-
|
|
11706
|
+
Column37("jsonb", { nullable: true })
|
|
10824
11707
|
], OrderItem.prototype, "metadata", 2);
|
|
10825
11708
|
__decorateClass([
|
|
10826
|
-
|
|
11709
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10827
11710
|
], OrderItem.prototype, "createdAt", 2);
|
|
10828
11711
|
__decorateClass([
|
|
10829
|
-
|
|
11712
|
+
Column37({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10830
11713
|
], OrderItem.prototype, "updatedAt", 2);
|
|
10831
11714
|
__decorateClass([
|
|
10832
|
-
|
|
10833
|
-
|
|
11715
|
+
ManyToOne26(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
|
|
11716
|
+
JoinColumn26({ name: "orderId" })
|
|
10834
11717
|
], OrderItem.prototype, "order", 2);
|
|
10835
11718
|
__decorateClass([
|
|
10836
|
-
|
|
10837
|
-
|
|
11719
|
+
ManyToOne26(() => Product, { onDelete: "CASCADE" }),
|
|
11720
|
+
JoinColumn26({ name: "productId" })
|
|
10838
11721
|
], OrderItem.prototype, "product", 2);
|
|
10839
11722
|
OrderItem = __decorateClass([
|
|
10840
|
-
|
|
11723
|
+
Entity37("order_items")
|
|
10841
11724
|
], OrderItem);
|
|
10842
11725
|
|
|
10843
11726
|
// src/entities/knowledge-base-document.entity.ts
|
|
10844
|
-
import { Entity as
|
|
11727
|
+
import { Entity as Entity39, PrimaryGeneratedColumn as PrimaryGeneratedColumn39, Column as Column39, OneToMany as OneToMany16 } from "typeorm";
|
|
10845
11728
|
|
|
10846
11729
|
// src/entities/knowledge-base-chunk.entity.ts
|
|
10847
|
-
import { Entity as
|
|
11730
|
+
import { Entity as Entity38, PrimaryGeneratedColumn as PrimaryGeneratedColumn38, Column as Column38, ManyToOne as ManyToOne27, JoinColumn as JoinColumn27 } from "typeorm";
|
|
10848
11731
|
var KnowledgeBaseChunk = class {
|
|
10849
11732
|
id;
|
|
10850
11733
|
documentId;
|
|
@@ -10854,26 +11737,26 @@ var KnowledgeBaseChunk = class {
|
|
|
10854
11737
|
document;
|
|
10855
11738
|
};
|
|
10856
11739
|
__decorateClass([
|
|
10857
|
-
|
|
11740
|
+
PrimaryGeneratedColumn38()
|
|
10858
11741
|
], KnowledgeBaseChunk.prototype, "id", 2);
|
|
10859
11742
|
__decorateClass([
|
|
10860
|
-
|
|
11743
|
+
Column38("int")
|
|
10861
11744
|
], KnowledgeBaseChunk.prototype, "documentId", 2);
|
|
10862
11745
|
__decorateClass([
|
|
10863
|
-
|
|
11746
|
+
Column38("text")
|
|
10864
11747
|
], KnowledgeBaseChunk.prototype, "content", 2);
|
|
10865
11748
|
__decorateClass([
|
|
10866
|
-
|
|
11749
|
+
Column38("int", { default: 0 })
|
|
10867
11750
|
], KnowledgeBaseChunk.prototype, "chunkIndex", 2);
|
|
10868
11751
|
__decorateClass([
|
|
10869
|
-
|
|
11752
|
+
Column38({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10870
11753
|
], KnowledgeBaseChunk.prototype, "createdAt", 2);
|
|
10871
11754
|
__decorateClass([
|
|
10872
|
-
|
|
10873
|
-
|
|
11755
|
+
ManyToOne27(() => KnowledgeBaseDocument, (d) => d.chunks, { onDelete: "CASCADE" }),
|
|
11756
|
+
JoinColumn27({ name: "documentId" })
|
|
10874
11757
|
], KnowledgeBaseChunk.prototype, "document", 2);
|
|
10875
11758
|
KnowledgeBaseChunk = __decorateClass([
|
|
10876
|
-
|
|
11759
|
+
Entity38("knowledge_base_chunks")
|
|
10877
11760
|
], KnowledgeBaseChunk);
|
|
10878
11761
|
|
|
10879
11762
|
// src/entities/knowledge-base-document.entity.ts
|
|
@@ -10887,32 +11770,32 @@ var KnowledgeBaseDocument = class {
|
|
|
10887
11770
|
chunks;
|
|
10888
11771
|
};
|
|
10889
11772
|
__decorateClass([
|
|
10890
|
-
|
|
11773
|
+
PrimaryGeneratedColumn39()
|
|
10891
11774
|
], KnowledgeBaseDocument.prototype, "id", 2);
|
|
10892
11775
|
__decorateClass([
|
|
10893
|
-
|
|
11776
|
+
Column39("varchar")
|
|
10894
11777
|
], KnowledgeBaseDocument.prototype, "name", 2);
|
|
10895
11778
|
__decorateClass([
|
|
10896
|
-
|
|
11779
|
+
Column39("varchar", { nullable: true })
|
|
10897
11780
|
], KnowledgeBaseDocument.prototype, "sourceUrl", 2);
|
|
10898
11781
|
__decorateClass([
|
|
10899
|
-
|
|
11782
|
+
Column39("text")
|
|
10900
11783
|
], KnowledgeBaseDocument.prototype, "content", 2);
|
|
10901
11784
|
__decorateClass([
|
|
10902
|
-
|
|
11785
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10903
11786
|
], KnowledgeBaseDocument.prototype, "createdAt", 2);
|
|
10904
11787
|
__decorateClass([
|
|
10905
|
-
|
|
11788
|
+
Column39({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10906
11789
|
], KnowledgeBaseDocument.prototype, "updatedAt", 2);
|
|
10907
11790
|
__decorateClass([
|
|
10908
11791
|
OneToMany16(() => KnowledgeBaseChunk, (c) => c.document)
|
|
10909
11792
|
], KnowledgeBaseDocument.prototype, "chunks", 2);
|
|
10910
11793
|
KnowledgeBaseDocument = __decorateClass([
|
|
10911
|
-
|
|
11794
|
+
Entity39("knowledge_base_documents")
|
|
10912
11795
|
], KnowledgeBaseDocument);
|
|
10913
11796
|
|
|
10914
11797
|
// src/entities/cart.entity.ts
|
|
10915
|
-
import { Entity as
|
|
11798
|
+
import { Entity as Entity40, PrimaryGeneratedColumn as PrimaryGeneratedColumn40, Column as Column40, ManyToOne as ManyToOne28, OneToMany as OneToMany17, JoinColumn as JoinColumn28 } from "typeorm";
|
|
10916
11799
|
var Cart = class {
|
|
10917
11800
|
id;
|
|
10918
11801
|
guestToken;
|
|
@@ -10925,39 +11808,39 @@ var Cart = class {
|
|
|
10925
11808
|
items;
|
|
10926
11809
|
};
|
|
10927
11810
|
__decorateClass([
|
|
10928
|
-
|
|
11811
|
+
PrimaryGeneratedColumn40()
|
|
10929
11812
|
], Cart.prototype, "id", 2);
|
|
10930
11813
|
__decorateClass([
|
|
10931
|
-
|
|
11814
|
+
Column40("varchar", { nullable: true })
|
|
10932
11815
|
], Cart.prototype, "guestToken", 2);
|
|
10933
11816
|
__decorateClass([
|
|
10934
|
-
|
|
11817
|
+
Column40("int", { nullable: true })
|
|
10935
11818
|
], Cart.prototype, "contactId", 2);
|
|
10936
11819
|
__decorateClass([
|
|
10937
|
-
|
|
11820
|
+
Column40("varchar", { default: "INR" })
|
|
10938
11821
|
], Cart.prototype, "currency", 2);
|
|
10939
11822
|
__decorateClass([
|
|
10940
|
-
|
|
11823
|
+
Column40({ type: "timestamp", nullable: true })
|
|
10941
11824
|
], Cart.prototype, "expiresAt", 2);
|
|
10942
11825
|
__decorateClass([
|
|
10943
|
-
|
|
11826
|
+
Column40({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10944
11827
|
], Cart.prototype, "createdAt", 2);
|
|
10945
11828
|
__decorateClass([
|
|
10946
|
-
|
|
11829
|
+
Column40({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10947
11830
|
], Cart.prototype, "updatedAt", 2);
|
|
10948
11831
|
__decorateClass([
|
|
10949
|
-
|
|
10950
|
-
|
|
11832
|
+
ManyToOne28(() => Contact, { onDelete: "CASCADE" }),
|
|
11833
|
+
JoinColumn28({ name: "contactId" })
|
|
10951
11834
|
], Cart.prototype, "contact", 2);
|
|
10952
11835
|
__decorateClass([
|
|
10953
11836
|
OneToMany17("CartItem", "cart")
|
|
10954
11837
|
], Cart.prototype, "items", 2);
|
|
10955
11838
|
Cart = __decorateClass([
|
|
10956
|
-
|
|
11839
|
+
Entity40("carts")
|
|
10957
11840
|
], Cart);
|
|
10958
11841
|
|
|
10959
11842
|
// src/entities/cart-item.entity.ts
|
|
10960
|
-
import { Entity as
|
|
11843
|
+
import { Entity as Entity41, PrimaryGeneratedColumn as PrimaryGeneratedColumn41, Column as Column41, ManyToOne as ManyToOne29, JoinColumn as JoinColumn29 } from "typeorm";
|
|
10961
11844
|
var CartItem = class {
|
|
10962
11845
|
id;
|
|
10963
11846
|
cartId;
|
|
@@ -10970,40 +11853,40 @@ var CartItem = class {
|
|
|
10970
11853
|
product;
|
|
10971
11854
|
};
|
|
10972
11855
|
__decorateClass([
|
|
10973
|
-
|
|
11856
|
+
PrimaryGeneratedColumn41()
|
|
10974
11857
|
], CartItem.prototype, "id", 2);
|
|
10975
11858
|
__decorateClass([
|
|
10976
|
-
|
|
11859
|
+
Column41("int")
|
|
10977
11860
|
], CartItem.prototype, "cartId", 2);
|
|
10978
11861
|
__decorateClass([
|
|
10979
|
-
|
|
11862
|
+
Column41("int")
|
|
10980
11863
|
], CartItem.prototype, "productId", 2);
|
|
10981
11864
|
__decorateClass([
|
|
10982
|
-
|
|
11865
|
+
Column41("int", { default: 1 })
|
|
10983
11866
|
], CartItem.prototype, "quantity", 2);
|
|
10984
11867
|
__decorateClass([
|
|
10985
|
-
|
|
11868
|
+
Column41("jsonb", { nullable: true })
|
|
10986
11869
|
], CartItem.prototype, "metadata", 2);
|
|
10987
11870
|
__decorateClass([
|
|
10988
|
-
|
|
11871
|
+
Column41({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10989
11872
|
], CartItem.prototype, "createdAt", 2);
|
|
10990
11873
|
__decorateClass([
|
|
10991
|
-
|
|
11874
|
+
Column41({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
10992
11875
|
], CartItem.prototype, "updatedAt", 2);
|
|
10993
11876
|
__decorateClass([
|
|
10994
|
-
|
|
10995
|
-
|
|
11877
|
+
ManyToOne29(() => Cart, (c) => c.items, { onDelete: "CASCADE" }),
|
|
11878
|
+
JoinColumn29({ name: "cartId" })
|
|
10996
11879
|
], CartItem.prototype, "cart", 2);
|
|
10997
11880
|
__decorateClass([
|
|
10998
|
-
|
|
10999
|
-
|
|
11881
|
+
ManyToOne29(() => Product, { onDelete: "CASCADE" }),
|
|
11882
|
+
JoinColumn29({ name: "productId" })
|
|
11000
11883
|
], CartItem.prototype, "product", 2);
|
|
11001
11884
|
CartItem = __decorateClass([
|
|
11002
|
-
|
|
11885
|
+
Entity41("cart_items")
|
|
11003
11886
|
], CartItem);
|
|
11004
11887
|
|
|
11005
11888
|
// src/entities/wishlist.entity.ts
|
|
11006
|
-
import { Entity as
|
|
11889
|
+
import { Entity as Entity42, PrimaryGeneratedColumn as PrimaryGeneratedColumn42, Column as Column42, ManyToOne as ManyToOne30, OneToMany as OneToMany18, JoinColumn as JoinColumn30 } from "typeorm";
|
|
11007
11890
|
var Wishlist = class {
|
|
11008
11891
|
id;
|
|
11009
11892
|
guestId;
|
|
@@ -11015,36 +11898,36 @@ var Wishlist = class {
|
|
|
11015
11898
|
items;
|
|
11016
11899
|
};
|
|
11017
11900
|
__decorateClass([
|
|
11018
|
-
|
|
11901
|
+
PrimaryGeneratedColumn42()
|
|
11019
11902
|
], Wishlist.prototype, "id", 2);
|
|
11020
11903
|
__decorateClass([
|
|
11021
|
-
|
|
11904
|
+
Column42("varchar", { nullable: true })
|
|
11022
11905
|
], Wishlist.prototype, "guestId", 2);
|
|
11023
11906
|
__decorateClass([
|
|
11024
|
-
|
|
11907
|
+
Column42("int", { nullable: true })
|
|
11025
11908
|
], Wishlist.prototype, "contactId", 2);
|
|
11026
11909
|
__decorateClass([
|
|
11027
|
-
|
|
11910
|
+
Column42("varchar", { default: "default" })
|
|
11028
11911
|
], Wishlist.prototype, "name", 2);
|
|
11029
11912
|
__decorateClass([
|
|
11030
|
-
|
|
11913
|
+
Column42({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11031
11914
|
], Wishlist.prototype, "createdAt", 2);
|
|
11032
11915
|
__decorateClass([
|
|
11033
|
-
|
|
11916
|
+
Column42({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11034
11917
|
], Wishlist.prototype, "updatedAt", 2);
|
|
11035
11918
|
__decorateClass([
|
|
11036
|
-
|
|
11037
|
-
|
|
11919
|
+
ManyToOne30(() => Contact, { onDelete: "CASCADE" }),
|
|
11920
|
+
JoinColumn30({ name: "contactId" })
|
|
11038
11921
|
], Wishlist.prototype, "contact", 2);
|
|
11039
11922
|
__decorateClass([
|
|
11040
11923
|
OneToMany18("WishlistItem", "wishlist")
|
|
11041
11924
|
], Wishlist.prototype, "items", 2);
|
|
11042
11925
|
Wishlist = __decorateClass([
|
|
11043
|
-
|
|
11926
|
+
Entity42("wishlists")
|
|
11044
11927
|
], Wishlist);
|
|
11045
11928
|
|
|
11046
11929
|
// src/entities/wishlist-item.entity.ts
|
|
11047
|
-
import { Entity as
|
|
11930
|
+
import { Entity as Entity43, PrimaryGeneratedColumn as PrimaryGeneratedColumn43, Column as Column43, ManyToOne as ManyToOne31, JoinColumn as JoinColumn31 } from "typeorm";
|
|
11048
11931
|
var WishlistItem = class {
|
|
11049
11932
|
id;
|
|
11050
11933
|
wishlistId;
|
|
@@ -11056,37 +11939,37 @@ var WishlistItem = class {
|
|
|
11056
11939
|
product;
|
|
11057
11940
|
};
|
|
11058
11941
|
__decorateClass([
|
|
11059
|
-
|
|
11942
|
+
PrimaryGeneratedColumn43()
|
|
11060
11943
|
], WishlistItem.prototype, "id", 2);
|
|
11061
11944
|
__decorateClass([
|
|
11062
|
-
|
|
11945
|
+
Column43("int")
|
|
11063
11946
|
], WishlistItem.prototype, "wishlistId", 2);
|
|
11064
11947
|
__decorateClass([
|
|
11065
|
-
|
|
11948
|
+
Column43("int")
|
|
11066
11949
|
], WishlistItem.prototype, "productId", 2);
|
|
11067
11950
|
__decorateClass([
|
|
11068
|
-
|
|
11951
|
+
Column43("jsonb", { nullable: true })
|
|
11069
11952
|
], WishlistItem.prototype, "metadata", 2);
|
|
11070
11953
|
__decorateClass([
|
|
11071
|
-
|
|
11954
|
+
Column43({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11072
11955
|
], WishlistItem.prototype, "createdAt", 2);
|
|
11073
11956
|
__decorateClass([
|
|
11074
|
-
|
|
11957
|
+
Column43({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11075
11958
|
], WishlistItem.prototype, "updatedAt", 2);
|
|
11076
11959
|
__decorateClass([
|
|
11077
|
-
|
|
11078
|
-
|
|
11960
|
+
ManyToOne31(() => Wishlist, (w) => w.items, { onDelete: "CASCADE" }),
|
|
11961
|
+
JoinColumn31({ name: "wishlistId" })
|
|
11079
11962
|
], WishlistItem.prototype, "wishlist", 2);
|
|
11080
11963
|
__decorateClass([
|
|
11081
|
-
|
|
11082
|
-
|
|
11964
|
+
ManyToOne31(() => Product, { onDelete: "CASCADE" }),
|
|
11965
|
+
JoinColumn31({ name: "productId" })
|
|
11083
11966
|
], WishlistItem.prototype, "product", 2);
|
|
11084
11967
|
WishlistItem = __decorateClass([
|
|
11085
|
-
|
|
11968
|
+
Entity43("wishlist_items")
|
|
11086
11969
|
], WishlistItem);
|
|
11087
11970
|
|
|
11088
11971
|
// src/entities/llm-agent-knowledge-document.entity.ts
|
|
11089
|
-
import { Entity as
|
|
11972
|
+
import { Entity as Entity44, PrimaryGeneratedColumn as PrimaryGeneratedColumn44, Column as Column44, ManyToOne as ManyToOne32, JoinColumn as JoinColumn32, Index as Index2, Unique as Unique9 } from "typeorm";
|
|
11090
11973
|
var LlmAgentKnowledgeDocument = class {
|
|
11091
11974
|
id;
|
|
11092
11975
|
agentId;
|
|
@@ -11096,33 +11979,33 @@ var LlmAgentKnowledgeDocument = class {
|
|
|
11096
11979
|
document;
|
|
11097
11980
|
};
|
|
11098
11981
|
__decorateClass([
|
|
11099
|
-
|
|
11982
|
+
PrimaryGeneratedColumn44()
|
|
11100
11983
|
], LlmAgentKnowledgeDocument.prototype, "id", 2);
|
|
11101
11984
|
__decorateClass([
|
|
11102
|
-
|
|
11985
|
+
Column44("int")
|
|
11103
11986
|
], LlmAgentKnowledgeDocument.prototype, "agentId", 2);
|
|
11104
11987
|
__decorateClass([
|
|
11105
|
-
|
|
11988
|
+
Column44("int")
|
|
11106
11989
|
], LlmAgentKnowledgeDocument.prototype, "documentId", 2);
|
|
11107
11990
|
__decorateClass([
|
|
11108
|
-
|
|
11991
|
+
Column44({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11109
11992
|
], LlmAgentKnowledgeDocument.prototype, "createdAt", 2);
|
|
11110
11993
|
__decorateClass([
|
|
11111
|
-
|
|
11112
|
-
|
|
11994
|
+
ManyToOne32(() => LlmAgent, { onDelete: "CASCADE" }),
|
|
11995
|
+
JoinColumn32({ name: "agentId" })
|
|
11113
11996
|
], LlmAgentKnowledgeDocument.prototype, "agent", 2);
|
|
11114
11997
|
__decorateClass([
|
|
11115
|
-
|
|
11116
|
-
|
|
11998
|
+
ManyToOne32(() => KnowledgeBaseDocument, { onDelete: "CASCADE" }),
|
|
11999
|
+
JoinColumn32({ name: "documentId" })
|
|
11117
12000
|
], LlmAgentKnowledgeDocument.prototype, "document", 2);
|
|
11118
12001
|
LlmAgentKnowledgeDocument = __decorateClass([
|
|
11119
|
-
|
|
12002
|
+
Entity44("llm_agent_knowledge_documents"),
|
|
11120
12003
|
Unique9("UQ_llm_agent_knowledge_agent_document", ["agentId", "documentId"]),
|
|
11121
12004
|
Index2("IDX_llm_agent_knowledge_agent", ["agentId"])
|
|
11122
12005
|
], LlmAgentKnowledgeDocument);
|
|
11123
12006
|
|
|
11124
12007
|
// src/entities/currency.entity.ts
|
|
11125
|
-
import { Entity as
|
|
12008
|
+
import { Entity as Entity45, Column as Column45, PrimaryGeneratedColumn as PrimaryGeneratedColumn45 } from "typeorm";
|
|
11126
12009
|
var Currency = class {
|
|
11127
12010
|
id;
|
|
11128
12011
|
code;
|
|
@@ -11132,29 +12015,29 @@ var Currency = class {
|
|
|
11132
12015
|
isBaseCurrency;
|
|
11133
12016
|
};
|
|
11134
12017
|
__decorateClass([
|
|
11135
|
-
|
|
12018
|
+
PrimaryGeneratedColumn45()
|
|
11136
12019
|
], Currency.prototype, "id", 2);
|
|
11137
12020
|
__decorateClass([
|
|
11138
|
-
|
|
12021
|
+
Column45({ type: "varchar", unique: true })
|
|
11139
12022
|
], Currency.prototype, "code", 2);
|
|
11140
12023
|
__decorateClass([
|
|
11141
|
-
|
|
12024
|
+
Column45({ type: "varchar" })
|
|
11142
12025
|
], Currency.prototype, "name", 2);
|
|
11143
12026
|
__decorateClass([
|
|
11144
|
-
|
|
12027
|
+
Column45({ type: "varchar" })
|
|
11145
12028
|
], Currency.prototype, "symbol", 2);
|
|
11146
12029
|
__decorateClass([
|
|
11147
|
-
|
|
12030
|
+
Column45({ type: "boolean", default: true })
|
|
11148
12031
|
], Currency.prototype, "isActive", 2);
|
|
11149
12032
|
__decorateClass([
|
|
11150
|
-
|
|
12033
|
+
Column45({ type: "boolean", default: false })
|
|
11151
12034
|
], Currency.prototype, "isBaseCurrency", 2);
|
|
11152
12035
|
Currency = __decorateClass([
|
|
11153
|
-
|
|
12036
|
+
Entity45("currency")
|
|
11154
12037
|
], Currency);
|
|
11155
12038
|
|
|
11156
12039
|
// src/entities/currency_exchange.entity.ts
|
|
11157
|
-
import { Entity as
|
|
12040
|
+
import { Entity as Entity46, Column as Column46, PrimaryGeneratedColumn as PrimaryGeneratedColumn46 } from "typeorm";
|
|
11158
12041
|
var CurrencyExchange = class {
|
|
11159
12042
|
id;
|
|
11160
12043
|
fromCurrency;
|
|
@@ -11162,26 +12045,26 @@ var CurrencyExchange = class {
|
|
|
11162
12045
|
rate;
|
|
11163
12046
|
};
|
|
11164
12047
|
__decorateClass([
|
|
11165
|
-
|
|
12048
|
+
PrimaryGeneratedColumn46()
|
|
11166
12049
|
], CurrencyExchange.prototype, "id", 2);
|
|
11167
12050
|
__decorateClass([
|
|
11168
|
-
|
|
12051
|
+
Column46({ type: "varchar" })
|
|
11169
12052
|
], CurrencyExchange.prototype, "fromCurrency", 2);
|
|
11170
12053
|
__decorateClass([
|
|
11171
|
-
|
|
12054
|
+
Column46({ type: "varchar" })
|
|
11172
12055
|
], CurrencyExchange.prototype, "toCurrency", 2);
|
|
11173
12056
|
__decorateClass([
|
|
11174
|
-
|
|
12057
|
+
Column46("decimal", { precision: 12, scale: 6, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
11175
12058
|
], CurrencyExchange.prototype, "rate", 2);
|
|
11176
12059
|
CurrencyExchange = __decorateClass([
|
|
11177
|
-
|
|
12060
|
+
Entity46("currency_exchange")
|
|
11178
12061
|
], CurrencyExchange);
|
|
11179
12062
|
|
|
11180
12063
|
// src/entities/discount.entity.ts
|
|
11181
|
-
import { Entity as
|
|
12064
|
+
import { Entity as Entity48, PrimaryGeneratedColumn as PrimaryGeneratedColumn48, Column as Column48, OneToMany as OneToMany20, ManyToOne as ManyToOne34, JoinColumn as JoinColumn34 } from "typeorm";
|
|
11182
12065
|
|
|
11183
12066
|
// src/entities/discount_rules.entity.ts
|
|
11184
|
-
import { Entity as
|
|
12067
|
+
import { Entity as Entity47, PrimaryGeneratedColumn as PrimaryGeneratedColumn47, Column as Column47, ManyToOne as ManyToOne33, JoinColumn as JoinColumn33, OneToMany as OneToMany19 } from "typeorm";
|
|
11185
12068
|
var Type = /* @__PURE__ */ ((Type2) => {
|
|
11186
12069
|
Type2["MIN_AMOUNT"] = "minAmount";
|
|
11187
12070
|
Type2["USER"] = "user";
|
|
@@ -11248,45 +12131,45 @@ var DiscountRules = class {
|
|
|
11248
12131
|
value;
|
|
11249
12132
|
};
|
|
11250
12133
|
__decorateClass([
|
|
11251
|
-
|
|
12134
|
+
PrimaryGeneratedColumn47()
|
|
11252
12135
|
], DiscountRules.prototype, "id", 2);
|
|
11253
12136
|
__decorateClass([
|
|
11254
|
-
|
|
11255
|
-
|
|
12137
|
+
ManyToOne33(() => Discount, (discount) => discount.rules, { onDelete: "CASCADE" }),
|
|
12138
|
+
JoinColumn33({ name: "discountId" })
|
|
11256
12139
|
], DiscountRules.prototype, "discount", 2);
|
|
11257
12140
|
__decorateClass([
|
|
11258
|
-
|
|
12141
|
+
Column47({ type: "int" })
|
|
11259
12142
|
], DiscountRules.prototype, "discountId", 2);
|
|
11260
12143
|
__decorateClass([
|
|
11261
|
-
|
|
11262
|
-
|
|
12144
|
+
ManyToOne33(() => DiscountRules, (rule) => rule.children, { nullable: true, onDelete: "CASCADE" }),
|
|
12145
|
+
JoinColumn33({ name: "parentId" })
|
|
11263
12146
|
], DiscountRules.prototype, "parent", 2);
|
|
11264
12147
|
__decorateClass([
|
|
11265
12148
|
OneToMany19(() => DiscountRules, (rule) => rule.parent)
|
|
11266
12149
|
], DiscountRules.prototype, "children", 2);
|
|
11267
12150
|
__decorateClass([
|
|
11268
|
-
|
|
12151
|
+
Column47({ type: "int", nullable: true })
|
|
11269
12152
|
], DiscountRules.prototype, "parentId", 2);
|
|
11270
12153
|
__decorateClass([
|
|
11271
|
-
|
|
12154
|
+
Column47({ type: "enum", enum: ConditionType })
|
|
11272
12155
|
], DiscountRules.prototype, "conditionType", 2);
|
|
11273
12156
|
__decorateClass([
|
|
11274
|
-
|
|
12157
|
+
Column47({ type: "enum", enum: ConditionOperator, nullable: true })
|
|
11275
12158
|
], DiscountRules.prototype, "conditionOperator", 2);
|
|
11276
12159
|
__decorateClass([
|
|
11277
|
-
|
|
12160
|
+
Column47({ type: "enum", enum: Type, nullable: true })
|
|
11278
12161
|
], DiscountRules.prototype, "type", 2);
|
|
11279
12162
|
__decorateClass([
|
|
11280
|
-
|
|
12163
|
+
Column47({ type: "enum", enum: SubType, nullable: true })
|
|
11281
12164
|
], DiscountRules.prototype, "subType", 2);
|
|
11282
12165
|
__decorateClass([
|
|
11283
|
-
|
|
12166
|
+
Column47({ type: "enum", enum: ComparisonOperator, nullable: true })
|
|
11284
12167
|
], DiscountRules.prototype, "comparisonOperator", 2);
|
|
11285
12168
|
__decorateClass([
|
|
11286
|
-
|
|
12169
|
+
Column47({ type: "jsonb" })
|
|
11287
12170
|
], DiscountRules.prototype, "value", 2);
|
|
11288
12171
|
DiscountRules = __decorateClass([
|
|
11289
|
-
|
|
12172
|
+
Entity47("discount_rules")
|
|
11290
12173
|
], DiscountRules);
|
|
11291
12174
|
|
|
11292
12175
|
// src/entities/discount.entity.ts
|
|
@@ -11323,59 +12206,59 @@ var Discount = class {
|
|
|
11323
12206
|
rules;
|
|
11324
12207
|
};
|
|
11325
12208
|
__decorateClass([
|
|
11326
|
-
|
|
12209
|
+
PrimaryGeneratedColumn48()
|
|
11327
12210
|
], Discount.prototype, "id", 2);
|
|
11328
12211
|
__decorateClass([
|
|
11329
|
-
|
|
12212
|
+
Column48("int")
|
|
11330
12213
|
], Discount.prototype, "vendorId", 2);
|
|
11331
12214
|
__decorateClass([
|
|
11332
|
-
|
|
11333
|
-
|
|
12215
|
+
ManyToOne34(() => Vendor, { onDelete: "RESTRICT" }),
|
|
12216
|
+
JoinColumn34({ name: "vendorId" })
|
|
11334
12217
|
], Discount.prototype, "vendor", 2);
|
|
11335
12218
|
__decorateClass([
|
|
11336
|
-
|
|
12219
|
+
Column48({ type: "varchar" })
|
|
11337
12220
|
], Discount.prototype, "name", 2);
|
|
11338
12221
|
__decorateClass([
|
|
11339
|
-
|
|
12222
|
+
Column48({ type: "varchar", nullable: true })
|
|
11340
12223
|
], Discount.prototype, "couponCode", 2);
|
|
11341
12224
|
__decorateClass([
|
|
11342
|
-
|
|
12225
|
+
Column48({ type: "varchar", nullable: true })
|
|
11343
12226
|
], Discount.prototype, "description", 2);
|
|
11344
12227
|
__decorateClass([
|
|
11345
|
-
|
|
12228
|
+
Column48({ type: "enum", enum: DiscountType })
|
|
11346
12229
|
], Discount.prototype, "discountType", 2);
|
|
11347
12230
|
__decorateClass([
|
|
11348
|
-
|
|
12231
|
+
Column48({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
11349
12232
|
], Discount.prototype, "value", 2);
|
|
11350
12233
|
__decorateClass([
|
|
11351
|
-
|
|
12234
|
+
Column48({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
11352
12235
|
], Discount.prototype, "maxDiscountAmount", 2);
|
|
11353
12236
|
__decorateClass([
|
|
11354
|
-
|
|
12237
|
+
Column48({ type: "int", nullable: true })
|
|
11355
12238
|
], Discount.prototype, "maxTotalUsage", 2);
|
|
11356
12239
|
__decorateClass([
|
|
11357
|
-
|
|
12240
|
+
Column48({ type: "int", nullable: true })
|
|
11358
12241
|
], Discount.prototype, "maxUsagePerUser", 2);
|
|
11359
12242
|
__decorateClass([
|
|
11360
|
-
|
|
12243
|
+
Column48({ type: "int", default: 0 })
|
|
11361
12244
|
], Discount.prototype, "usedCount", 2);
|
|
11362
12245
|
__decorateClass([
|
|
11363
|
-
|
|
12246
|
+
Column48({ type: "timestamp" })
|
|
11364
12247
|
], Discount.prototype, "validFrom", 2);
|
|
11365
12248
|
__decorateClass([
|
|
11366
|
-
|
|
12249
|
+
Column48({ type: "timestamp" })
|
|
11367
12250
|
], Discount.prototype, "validUntil", 2);
|
|
11368
12251
|
__decorateClass([
|
|
11369
|
-
|
|
12252
|
+
Column48({ type: "enum", enum: DiscountStatus, default: "ACTIVE" /* ACTIVE */ })
|
|
11370
12253
|
], Discount.prototype, "status", 2);
|
|
11371
12254
|
__decorateClass([
|
|
11372
|
-
|
|
12255
|
+
Column48({ type: "boolean" })
|
|
11373
12256
|
], Discount.prototype, "canCombineWithOtherDiscounts", 2);
|
|
11374
12257
|
__decorateClass([
|
|
11375
|
-
|
|
12258
|
+
Column48({ type: "boolean", default: false })
|
|
11376
12259
|
], Discount.prototype, "isAutomatic", 2);
|
|
11377
12260
|
__decorateClass([
|
|
11378
|
-
|
|
12261
|
+
Column48({ type: "varchar", default: "INR" })
|
|
11379
12262
|
], Discount.prototype, "currency", 2);
|
|
11380
12263
|
__decorateClass([
|
|
11381
12264
|
OneToMany20(() => DiscountRules, (rule) => rule.discount, {
|
|
@@ -11383,11 +12266,11 @@ __decorateClass([
|
|
|
11383
12266
|
})
|
|
11384
12267
|
], Discount.prototype, "rules", 2);
|
|
11385
12268
|
Discount = __decorateClass([
|
|
11386
|
-
|
|
12269
|
+
Entity48("discounts")
|
|
11387
12270
|
], Discount);
|
|
11388
12271
|
|
|
11389
12272
|
// src/entities/order_discounts.entity.ts
|
|
11390
|
-
import { Column as
|
|
12273
|
+
import { Column as Column49, Entity as Entity49, PrimaryGeneratedColumn as PrimaryGeneratedColumn49, ManyToOne as ManyToOne35, JoinColumn as JoinColumn35 } from "typeorm";
|
|
11391
12274
|
var OrderDiscounts = class {
|
|
11392
12275
|
id;
|
|
11393
12276
|
order;
|
|
@@ -11402,50 +12285,50 @@ var OrderDiscounts = class {
|
|
|
11402
12285
|
metaData;
|
|
11403
12286
|
};
|
|
11404
12287
|
__decorateClass([
|
|
11405
|
-
|
|
12288
|
+
PrimaryGeneratedColumn49()
|
|
11406
12289
|
], OrderDiscounts.prototype, "id", 2);
|
|
11407
12290
|
__decorateClass([
|
|
11408
|
-
|
|
11409
|
-
|
|
12291
|
+
ManyToOne35(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
|
|
12292
|
+
JoinColumn35({ name: "orderId" })
|
|
11410
12293
|
], OrderDiscounts.prototype, "order", 2);
|
|
11411
12294
|
__decorateClass([
|
|
11412
|
-
|
|
12295
|
+
Column49({ type: "int" })
|
|
11413
12296
|
], OrderDiscounts.prototype, "orderId", 2);
|
|
11414
12297
|
__decorateClass([
|
|
11415
|
-
|
|
11416
|
-
|
|
12298
|
+
ManyToOne35(() => OrderItem, { onDelete: "CASCADE" }),
|
|
12299
|
+
JoinColumn35({ name: "orderItemId" })
|
|
11417
12300
|
], OrderDiscounts.prototype, "orderItem", 2);
|
|
11418
12301
|
__decorateClass([
|
|
11419
|
-
|
|
12302
|
+
Column49({ type: "int" })
|
|
11420
12303
|
], OrderDiscounts.prototype, "orderItemId", 2);
|
|
11421
12304
|
__decorateClass([
|
|
11422
|
-
|
|
12305
|
+
Column49({ type: "int" })
|
|
11423
12306
|
], OrderDiscounts.prototype, "userId", 2);
|
|
11424
12307
|
__decorateClass([
|
|
11425
|
-
|
|
11426
|
-
|
|
12308
|
+
ManyToOne35(() => Discount, { onDelete: "CASCADE" }),
|
|
12309
|
+
JoinColumn35({ name: "discountId" })
|
|
11427
12310
|
], OrderDiscounts.prototype, "discount", 2);
|
|
11428
12311
|
__decorateClass([
|
|
11429
|
-
|
|
12312
|
+
Column49({ type: "int" })
|
|
11430
12313
|
], OrderDiscounts.prototype, "discountId", 2);
|
|
11431
12314
|
__decorateClass([
|
|
11432
|
-
|
|
12315
|
+
Column49({ type: "varchar" })
|
|
11433
12316
|
], OrderDiscounts.prototype, "discountCode", 2);
|
|
11434
12317
|
__decorateClass([
|
|
11435
|
-
|
|
12318
|
+
Column49({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
|
|
11436
12319
|
], OrderDiscounts.prototype, "discountAmount", 2);
|
|
11437
12320
|
__decorateClass([
|
|
11438
|
-
|
|
12321
|
+
Column49({ type: "jsonb", nullable: true })
|
|
11439
12322
|
], OrderDiscounts.prototype, "metaData", 2);
|
|
11440
12323
|
OrderDiscounts = __decorateClass([
|
|
11441
|
-
|
|
12324
|
+
Entity49("order_discounts")
|
|
11442
12325
|
], OrderDiscounts);
|
|
11443
12326
|
|
|
11444
12327
|
// src/entities/rss-feed.entity.ts
|
|
11445
12328
|
import {
|
|
11446
|
-
Entity as
|
|
11447
|
-
PrimaryGeneratedColumn as
|
|
11448
|
-
Column as
|
|
12329
|
+
Entity as Entity51,
|
|
12330
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn51,
|
|
12331
|
+
Column as Column51,
|
|
11449
12332
|
CreateDateColumn as CreateDateColumn2,
|
|
11450
12333
|
UpdateDateColumn,
|
|
11451
12334
|
OneToMany as OneToMany21
|
|
@@ -11453,11 +12336,11 @@ import {
|
|
|
11453
12336
|
|
|
11454
12337
|
// src/entities/rss-article.entity.ts
|
|
11455
12338
|
import {
|
|
11456
|
-
Entity as
|
|
11457
|
-
PrimaryGeneratedColumn as
|
|
11458
|
-
Column as
|
|
11459
|
-
ManyToOne as
|
|
11460
|
-
JoinColumn as
|
|
12339
|
+
Entity as Entity50,
|
|
12340
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn50,
|
|
12341
|
+
Column as Column50,
|
|
12342
|
+
ManyToOne as ManyToOne36,
|
|
12343
|
+
JoinColumn as JoinColumn36,
|
|
11461
12344
|
CreateDateColumn,
|
|
11462
12345
|
Unique as Unique10
|
|
11463
12346
|
} from "typeorm";
|
|
@@ -11479,53 +12362,53 @@ var RssArticle = class {
|
|
|
11479
12362
|
createdAt;
|
|
11480
12363
|
};
|
|
11481
12364
|
__decorateClass([
|
|
11482
|
-
|
|
12365
|
+
PrimaryGeneratedColumn50("uuid")
|
|
11483
12366
|
], RssArticle.prototype, "id", 2);
|
|
11484
12367
|
__decorateClass([
|
|
11485
|
-
|
|
12368
|
+
Column50("uuid")
|
|
11486
12369
|
], RssArticle.prototype, "rssFeedId", 2);
|
|
11487
12370
|
__decorateClass([
|
|
11488
|
-
|
|
11489
|
-
|
|
12371
|
+
ManyToOne36(() => RssFeed, (f) => f.articles, { onDelete: "CASCADE" }),
|
|
12372
|
+
JoinColumn36({ name: "rssFeedId" })
|
|
11490
12373
|
], RssArticle.prototype, "rssFeed", 2);
|
|
11491
12374
|
__decorateClass([
|
|
11492
|
-
|
|
12375
|
+
Column50({ type: "text", nullable: true })
|
|
11493
12376
|
], RssArticle.prototype, "externalId", 2);
|
|
11494
12377
|
__decorateClass([
|
|
11495
|
-
|
|
12378
|
+
Column50({ type: "text" })
|
|
11496
12379
|
], RssArticle.prototype, "title", 2);
|
|
11497
12380
|
__decorateClass([
|
|
11498
|
-
|
|
12381
|
+
Column50({ type: "text" })
|
|
11499
12382
|
], RssArticle.prototype, "articleUrl", 2);
|
|
11500
12383
|
__decorateClass([
|
|
11501
|
-
|
|
12384
|
+
Column50({ type: "text", nullable: true })
|
|
11502
12385
|
], RssArticle.prototype, "summary", 2);
|
|
11503
12386
|
__decorateClass([
|
|
11504
|
-
|
|
12387
|
+
Column50({ type: "text", nullable: true })
|
|
11505
12388
|
], RssArticle.prototype, "content", 2);
|
|
11506
12389
|
__decorateClass([
|
|
11507
|
-
|
|
12390
|
+
Column50({ type: "text", nullable: true })
|
|
11508
12391
|
], RssArticle.prototype, "author", 2);
|
|
11509
12392
|
__decorateClass([
|
|
11510
|
-
|
|
12393
|
+
Column50({ type: "timestamp", nullable: true })
|
|
11511
12394
|
], RssArticle.prototype, "publishedAt", 2);
|
|
11512
12395
|
__decorateClass([
|
|
11513
|
-
|
|
12396
|
+
Column50({ type: "text", nullable: true })
|
|
11514
12397
|
], RssArticle.prototype, "imageUrl", 2);
|
|
11515
12398
|
__decorateClass([
|
|
11516
|
-
|
|
12399
|
+
Column50({ type: "jsonb", nullable: true })
|
|
11517
12400
|
], RssArticle.prototype, "rawData", 2);
|
|
11518
12401
|
__decorateClass([
|
|
11519
|
-
|
|
12402
|
+
Column50({ type: "text", nullable: true })
|
|
11520
12403
|
], RssArticle.prototype, "contentHash", 2);
|
|
11521
12404
|
__decorateClass([
|
|
11522
|
-
|
|
12405
|
+
Column50({ type: "boolean", default: false })
|
|
11523
12406
|
], RssArticle.prototype, "isProcessed", 2);
|
|
11524
12407
|
__decorateClass([
|
|
11525
12408
|
CreateDateColumn()
|
|
11526
12409
|
], RssArticle.prototype, "createdAt", 2);
|
|
11527
12410
|
RssArticle = __decorateClass([
|
|
11528
|
-
|
|
12411
|
+
Entity50("rss_articles"),
|
|
11529
12412
|
Unique10("UQ_rss_articles_feed_article_url", ["rssFeedId", "articleUrl"])
|
|
11530
12413
|
], RssArticle);
|
|
11531
12414
|
|
|
@@ -11544,28 +12427,28 @@ var RssFeed = class {
|
|
|
11544
12427
|
updatedAt;
|
|
11545
12428
|
};
|
|
11546
12429
|
__decorateClass([
|
|
11547
|
-
|
|
12430
|
+
PrimaryGeneratedColumn51("uuid")
|
|
11548
12431
|
], RssFeed.prototype, "id", 2);
|
|
11549
12432
|
__decorateClass([
|
|
11550
|
-
|
|
12433
|
+
Column51({ type: "text" })
|
|
11551
12434
|
], RssFeed.prototype, "name", 2);
|
|
11552
12435
|
__decorateClass([
|
|
11553
|
-
|
|
12436
|
+
Column51({ type: "text", unique: true })
|
|
11554
12437
|
], RssFeed.prototype, "rssUrl", 2);
|
|
11555
12438
|
__decorateClass([
|
|
11556
|
-
|
|
12439
|
+
Column51({ type: "text", nullable: true })
|
|
11557
12440
|
], RssFeed.prototype, "websiteUrl", 2);
|
|
11558
12441
|
__decorateClass([
|
|
11559
|
-
|
|
12442
|
+
Column51({ type: "boolean", default: true })
|
|
11560
12443
|
], RssFeed.prototype, "isActive", 2);
|
|
11561
12444
|
__decorateClass([
|
|
11562
|
-
|
|
12445
|
+
Column51({ type: "int", default: 60 })
|
|
11563
12446
|
], RssFeed.prototype, "fetchFrequencyMinutes", 2);
|
|
11564
12447
|
__decorateClass([
|
|
11565
|
-
|
|
12448
|
+
Column51({ type: "timestamp", nullable: true })
|
|
11566
12449
|
], RssFeed.prototype, "lastFetchedAt", 2);
|
|
11567
12450
|
__decorateClass([
|
|
11568
|
-
|
|
12451
|
+
Column51({ type: "timestamp", nullable: true })
|
|
11569
12452
|
], RssFeed.prototype, "lastArticleDate", 2);
|
|
11570
12453
|
__decorateClass([
|
|
11571
12454
|
OneToMany21(() => RssArticle, (article) => article.rssFeed)
|
|
@@ -11577,14 +12460,14 @@ __decorateClass([
|
|
|
11577
12460
|
UpdateDateColumn()
|
|
11578
12461
|
], RssFeed.prototype, "updatedAt", 2);
|
|
11579
12462
|
RssFeed = __decorateClass([
|
|
11580
|
-
|
|
12463
|
+
Entity51("rss_feeds")
|
|
11581
12464
|
], RssFeed);
|
|
11582
12465
|
|
|
11583
12466
|
// src/entities/job-schedule.entity.ts
|
|
11584
12467
|
import {
|
|
11585
|
-
Entity as
|
|
11586
|
-
PrimaryGeneratedColumn as
|
|
11587
|
-
Column as
|
|
12468
|
+
Entity as Entity53,
|
|
12469
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn53,
|
|
12470
|
+
Column as Column53,
|
|
11588
12471
|
CreateDateColumn as CreateDateColumn4,
|
|
11589
12472
|
UpdateDateColumn as UpdateDateColumn2,
|
|
11590
12473
|
OneToMany as OneToMany22
|
|
@@ -11592,12 +12475,12 @@ import {
|
|
|
11592
12475
|
|
|
11593
12476
|
// src/entities/job-schedule-run.entity.ts
|
|
11594
12477
|
import {
|
|
11595
|
-
Entity as
|
|
11596
|
-
PrimaryGeneratedColumn as
|
|
11597
|
-
Column as
|
|
12478
|
+
Entity as Entity52,
|
|
12479
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn52,
|
|
12480
|
+
Column as Column52,
|
|
11598
12481
|
CreateDateColumn as CreateDateColumn3,
|
|
11599
|
-
ManyToOne as
|
|
11600
|
-
JoinColumn as
|
|
12482
|
+
ManyToOne as ManyToOne37,
|
|
12483
|
+
JoinColumn as JoinColumn37
|
|
11601
12484
|
} from "typeorm";
|
|
11602
12485
|
var JobScheduleRun = class {
|
|
11603
12486
|
id;
|
|
@@ -11612,38 +12495,38 @@ var JobScheduleRun = class {
|
|
|
11612
12495
|
createdAt;
|
|
11613
12496
|
};
|
|
11614
12497
|
__decorateClass([
|
|
11615
|
-
|
|
12498
|
+
PrimaryGeneratedColumn52("uuid")
|
|
11616
12499
|
], JobScheduleRun.prototype, "id", 2);
|
|
11617
12500
|
__decorateClass([
|
|
11618
|
-
|
|
12501
|
+
Column52({ type: "uuid" })
|
|
11619
12502
|
], JobScheduleRun.prototype, "scheduleId", 2);
|
|
11620
12503
|
__decorateClass([
|
|
11621
|
-
|
|
11622
|
-
|
|
12504
|
+
ManyToOne37(() => JobSchedule, (s) => s.runs, { onDelete: "CASCADE" }),
|
|
12505
|
+
JoinColumn37({ name: "scheduleId" })
|
|
11623
12506
|
], JobScheduleRun.prototype, "schedule", 2);
|
|
11624
12507
|
__decorateClass([
|
|
11625
|
-
|
|
12508
|
+
Column52({ type: "timestamp" })
|
|
11626
12509
|
], JobScheduleRun.prototype, "startedAt", 2);
|
|
11627
12510
|
__decorateClass([
|
|
11628
|
-
|
|
12511
|
+
Column52({ type: "timestamp", nullable: true })
|
|
11629
12512
|
], JobScheduleRun.prototype, "finishedAt", 2);
|
|
11630
12513
|
__decorateClass([
|
|
11631
|
-
|
|
12514
|
+
Column52({ type: "varchar", length: 32 })
|
|
11632
12515
|
], JobScheduleRun.prototype, "status", 2);
|
|
11633
12516
|
__decorateClass([
|
|
11634
|
-
|
|
12517
|
+
Column52({ type: "text", nullable: true })
|
|
11635
12518
|
], JobScheduleRun.prototype, "error", 2);
|
|
11636
12519
|
__decorateClass([
|
|
11637
|
-
|
|
12520
|
+
Column52({ type: "jsonb", nullable: true })
|
|
11638
12521
|
], JobScheduleRun.prototype, "result", 2);
|
|
11639
12522
|
__decorateClass([
|
|
11640
|
-
|
|
12523
|
+
Column52({ type: "varchar", length: 16, default: "schedule" })
|
|
11641
12524
|
], JobScheduleRun.prototype, "triggeredBy", 2);
|
|
11642
12525
|
__decorateClass([
|
|
11643
12526
|
CreateDateColumn3()
|
|
11644
12527
|
], JobScheduleRun.prototype, "createdAt", 2);
|
|
11645
12528
|
JobScheduleRun = __decorateClass([
|
|
11646
|
-
|
|
12529
|
+
Entity52("job_schedule_runs")
|
|
11647
12530
|
], JobScheduleRun);
|
|
11648
12531
|
|
|
11649
12532
|
// src/entities/job-schedule.entity.ts
|
|
@@ -11670,55 +12553,55 @@ var JobSchedule = class {
|
|
|
11670
12553
|
updatedAt;
|
|
11671
12554
|
};
|
|
11672
12555
|
__decorateClass([
|
|
11673
|
-
|
|
12556
|
+
PrimaryGeneratedColumn53("uuid")
|
|
11674
12557
|
], JobSchedule.prototype, "id", 2);
|
|
11675
12558
|
__decorateClass([
|
|
11676
|
-
|
|
12559
|
+
Column53({ type: "text" })
|
|
11677
12560
|
], JobSchedule.prototype, "name", 2);
|
|
11678
12561
|
__decorateClass([
|
|
11679
|
-
|
|
12562
|
+
Column53({ type: "varchar", length: 64, default: "blog_generate" })
|
|
11680
12563
|
], JobSchedule.prototype, "jobType", 2);
|
|
11681
12564
|
__decorateClass([
|
|
11682
|
-
|
|
12565
|
+
Column53({ type: "boolean", default: false })
|
|
11683
12566
|
], JobSchedule.prototype, "enabled", 2);
|
|
11684
12567
|
__decorateClass([
|
|
11685
|
-
|
|
12568
|
+
Column53({ type: "varchar", length: 32, default: "daily" })
|
|
11686
12569
|
], JobSchedule.prototype, "scheduleMode", 2);
|
|
11687
12570
|
__decorateClass([
|
|
11688
|
-
|
|
12571
|
+
Column53({ type: "int", nullable: true })
|
|
11689
12572
|
], JobSchedule.prototype, "intervalMinutes", 2);
|
|
11690
12573
|
__decorateClass([
|
|
11691
|
-
|
|
12574
|
+
Column53({ type: "varchar", length: 8, nullable: true })
|
|
11692
12575
|
], JobSchedule.prototype, "runAtTime", 2);
|
|
11693
12576
|
__decorateClass([
|
|
11694
|
-
|
|
12577
|
+
Column53({ type: "jsonb", nullable: true })
|
|
11695
12578
|
], JobSchedule.prototype, "runOnDays", 2);
|
|
11696
12579
|
__decorateClass([
|
|
11697
|
-
|
|
12580
|
+
Column53({ type: "varchar", length: 64, default: "UTC" })
|
|
11698
12581
|
], JobSchedule.prototype, "timezone", 2);
|
|
11699
12582
|
__decorateClass([
|
|
11700
|
-
|
|
12583
|
+
Column53({ type: "text", nullable: true })
|
|
11701
12584
|
], JobSchedule.prototype, "cronExpression", 2);
|
|
11702
12585
|
__decorateClass([
|
|
11703
|
-
|
|
12586
|
+
Column53({ type: "jsonb", default: {} })
|
|
11704
12587
|
], JobSchedule.prototype, "payload", 2);
|
|
11705
12588
|
__decorateClass([
|
|
11706
|
-
|
|
12589
|
+
Column53({ type: "int", nullable: true })
|
|
11707
12590
|
], JobSchedule.prototype, "authorId", 2);
|
|
11708
12591
|
__decorateClass([
|
|
11709
|
-
|
|
12592
|
+
Column53({ type: "varchar", length: 128, unique: true })
|
|
11710
12593
|
], JobSchedule.prototype, "pgBossScheduleName", 2);
|
|
11711
12594
|
__decorateClass([
|
|
11712
|
-
|
|
12595
|
+
Column53({ type: "timestamp", nullable: true })
|
|
11713
12596
|
], JobSchedule.prototype, "lastRunAt", 2);
|
|
11714
12597
|
__decorateClass([
|
|
11715
|
-
|
|
12598
|
+
Column53({ type: "varchar", length: 32, nullable: true })
|
|
11716
12599
|
], JobSchedule.prototype, "lastRunStatus", 2);
|
|
11717
12600
|
__decorateClass([
|
|
11718
|
-
|
|
12601
|
+
Column53({ type: "text", nullable: true })
|
|
11719
12602
|
], JobSchedule.prototype, "lastRunError", 2);
|
|
11720
12603
|
__decorateClass([
|
|
11721
|
-
|
|
12604
|
+
Column53({ type: "timestamp", nullable: true })
|
|
11722
12605
|
], JobSchedule.prototype, "nextRunAt", 2);
|
|
11723
12606
|
__decorateClass([
|
|
11724
12607
|
OneToMany22(() => JobScheduleRun, (r) => r.schedule)
|
|
@@ -11730,11 +12613,11 @@ __decorateClass([
|
|
|
11730
12613
|
UpdateDateColumn2()
|
|
11731
12614
|
], JobSchedule.prototype, "updatedAt", 2);
|
|
11732
12615
|
JobSchedule = __decorateClass([
|
|
11733
|
-
|
|
12616
|
+
Entity53("job_schedules")
|
|
11734
12617
|
], JobSchedule);
|
|
11735
12618
|
|
|
11736
12619
|
// src/entities/vendor-user.entity.ts
|
|
11737
|
-
import { Entity as
|
|
12620
|
+
import { Entity as Entity54, PrimaryGeneratedColumn as PrimaryGeneratedColumn54, Column as Column54, ManyToOne as ManyToOne38, JoinColumn as JoinColumn38, Unique as Unique11, Index as Index3 } from "typeorm";
|
|
11738
12621
|
var VendorUser = class {
|
|
11739
12622
|
id;
|
|
11740
12623
|
vendorId;
|
|
@@ -11746,33 +12629,33 @@ var VendorUser = class {
|
|
|
11746
12629
|
user;
|
|
11747
12630
|
};
|
|
11748
12631
|
__decorateClass([
|
|
11749
|
-
|
|
12632
|
+
PrimaryGeneratedColumn54()
|
|
11750
12633
|
], VendorUser.prototype, "id", 2);
|
|
11751
12634
|
__decorateClass([
|
|
11752
|
-
|
|
12635
|
+
Column54("int")
|
|
11753
12636
|
], VendorUser.prototype, "vendorId", 2);
|
|
11754
12637
|
__decorateClass([
|
|
11755
|
-
|
|
12638
|
+
Column54("int")
|
|
11756
12639
|
], VendorUser.prototype, "userId", 2);
|
|
11757
12640
|
__decorateClass([
|
|
11758
|
-
|
|
12641
|
+
Column54("varchar", { default: "staff" })
|
|
11759
12642
|
], VendorUser.prototype, "role", 2);
|
|
11760
12643
|
__decorateClass([
|
|
11761
|
-
|
|
12644
|
+
Column54({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11762
12645
|
], VendorUser.prototype, "createdAt", 2);
|
|
11763
12646
|
__decorateClass([
|
|
11764
|
-
|
|
12647
|
+
Column54({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11765
12648
|
], VendorUser.prototype, "updatedAt", 2);
|
|
11766
12649
|
__decorateClass([
|
|
11767
|
-
|
|
11768
|
-
|
|
12650
|
+
ManyToOne38(() => Vendor, (v) => v.vendorUsers, { onDelete: "CASCADE" }),
|
|
12651
|
+
JoinColumn38({ name: "vendorId" })
|
|
11769
12652
|
], VendorUser.prototype, "vendor", 2);
|
|
11770
12653
|
__decorateClass([
|
|
11771
|
-
|
|
11772
|
-
|
|
12654
|
+
ManyToOne38(() => User, { onDelete: "CASCADE" }),
|
|
12655
|
+
JoinColumn38({ name: "userId" })
|
|
11773
12656
|
], VendorUser.prototype, "user", 2);
|
|
11774
12657
|
VendorUser = __decorateClass([
|
|
11775
|
-
|
|
12658
|
+
Entity54("vendor_users"),
|
|
11776
12659
|
Unique11("UQ_vendor_users_vendor_user", ["vendorId", "userId"]),
|
|
11777
12660
|
Index3("IDX_vendor_users_vendor", ["vendorId"]),
|
|
11778
12661
|
Index3("IDX_vendor_users_user", ["userId"])
|
|
@@ -11780,57 +12663,64 @@ VendorUser = __decorateClass([
|
|
|
11780
12663
|
|
|
11781
12664
|
// src/entities/vendor-customer.entity.ts
|
|
11782
12665
|
import {
|
|
11783
|
-
Entity as
|
|
11784
|
-
PrimaryGeneratedColumn as
|
|
11785
|
-
Column as
|
|
11786
|
-
ManyToOne as
|
|
11787
|
-
JoinColumn as
|
|
11788
|
-
Unique as Unique12,
|
|
12666
|
+
Entity as Entity55,
|
|
12667
|
+
PrimaryGeneratedColumn as PrimaryGeneratedColumn55,
|
|
12668
|
+
Column as Column55,
|
|
12669
|
+
ManyToOne as ManyToOne39,
|
|
12670
|
+
JoinColumn as JoinColumn39,
|
|
11789
12671
|
Index as Index4
|
|
11790
12672
|
} from "typeorm";
|
|
11791
12673
|
var VendorCustomer = class {
|
|
11792
12674
|
id;
|
|
11793
12675
|
vendorId;
|
|
11794
12676
|
contactId;
|
|
12677
|
+
customerId;
|
|
11795
12678
|
notes;
|
|
11796
12679
|
tags;
|
|
11797
12680
|
createdAt;
|
|
11798
12681
|
updatedAt;
|
|
11799
12682
|
vendor;
|
|
11800
12683
|
contact;
|
|
12684
|
+
customer;
|
|
11801
12685
|
};
|
|
11802
12686
|
__decorateClass([
|
|
11803
|
-
|
|
12687
|
+
PrimaryGeneratedColumn55()
|
|
11804
12688
|
], VendorCustomer.prototype, "id", 2);
|
|
11805
12689
|
__decorateClass([
|
|
11806
|
-
|
|
12690
|
+
Column55("int")
|
|
11807
12691
|
], VendorCustomer.prototype, "vendorId", 2);
|
|
11808
12692
|
__decorateClass([
|
|
11809
|
-
|
|
12693
|
+
Column55("int", { nullable: true })
|
|
11810
12694
|
], VendorCustomer.prototype, "contactId", 2);
|
|
11811
12695
|
__decorateClass([
|
|
11812
|
-
|
|
12696
|
+
Column55("int")
|
|
12697
|
+
], VendorCustomer.prototype, "customerId", 2);
|
|
12698
|
+
__decorateClass([
|
|
12699
|
+
Column55("text", { nullable: true })
|
|
11813
12700
|
], VendorCustomer.prototype, "notes", 2);
|
|
11814
12701
|
__decorateClass([
|
|
11815
|
-
|
|
12702
|
+
Column55("simple-array", { nullable: true })
|
|
11816
12703
|
], VendorCustomer.prototype, "tags", 2);
|
|
11817
12704
|
__decorateClass([
|
|
11818
|
-
|
|
12705
|
+
Column55({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11819
12706
|
], VendorCustomer.prototype, "createdAt", 2);
|
|
11820
12707
|
__decorateClass([
|
|
11821
|
-
|
|
12708
|
+
Column55({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
|
|
11822
12709
|
], VendorCustomer.prototype, "updatedAt", 2);
|
|
11823
12710
|
__decorateClass([
|
|
11824
|
-
|
|
11825
|
-
|
|
12711
|
+
ManyToOne39(() => Vendor, { onDelete: "CASCADE" }),
|
|
12712
|
+
JoinColumn39({ name: "vendorId" })
|
|
11826
12713
|
], VendorCustomer.prototype, "vendor", 2);
|
|
11827
12714
|
__decorateClass([
|
|
11828
|
-
|
|
11829
|
-
|
|
12715
|
+
ManyToOne39(() => Contact, { onDelete: "CASCADE" }),
|
|
12716
|
+
JoinColumn39({ name: "contactId" })
|
|
11830
12717
|
], VendorCustomer.prototype, "contact", 2);
|
|
12718
|
+
__decorateClass([
|
|
12719
|
+
ManyToOne39(() => Customer, { onDelete: "CASCADE" }),
|
|
12720
|
+
JoinColumn39({ name: "customerId" })
|
|
12721
|
+
], VendorCustomer.prototype, "customer", 2);
|
|
11831
12722
|
VendorCustomer = __decorateClass([
|
|
11832
|
-
|
|
11833
|
-
Unique12("UQ_vendor_customers_vendor_contact", ["vendorId", "contactId"]),
|
|
12723
|
+
Entity55("vendor_customers"),
|
|
11834
12724
|
Index4("IDX_vendor_customers_vendor", ["vendorId"]),
|
|
11835
12725
|
Index4("IDX_vendor_customers_contact", ["contactId"])
|
|
11836
12726
|
], VendorCustomer);
|
|
@@ -11889,7 +12779,9 @@ var CMS_ENTITY_MAP = {
|
|
|
11889
12779
|
job_schedule_runs: JobScheduleRun,
|
|
11890
12780
|
vendors: Vendor,
|
|
11891
12781
|
vendor_users: VendorUser,
|
|
11892
|
-
vendor_customers: VendorCustomer
|
|
12782
|
+
vendor_customers: VendorCustomer,
|
|
12783
|
+
customer: Customer,
|
|
12784
|
+
customer_contacts: Customer_Contacts
|
|
11893
12785
|
};
|
|
11894
12786
|
|
|
11895
12787
|
// src/plugins/blog-generator/blog-generator-service.ts
|
|
@@ -13723,6 +14615,10 @@ function createCmsApiHandler(config) {
|
|
|
13723
14615
|
getVendorScope: async () => {
|
|
13724
14616
|
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
13725
14617
|
return resolveVendorScopeFromSessionUser(u ?? null);
|
|
14618
|
+
},
|
|
14619
|
+
getHydratedSessionUser: async () => {
|
|
14620
|
+
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
14621
|
+
return u ?? null;
|
|
13726
14622
|
}
|
|
13727
14623
|
} : {}
|
|
13728
14624
|
};
|
|
@@ -13743,7 +14639,6 @@ function createCmsApiHandler(config) {
|
|
|
13743
14639
|
getSessionUser,
|
|
13744
14640
|
baseUrl: vendorOnboardBaseUrl,
|
|
13745
14641
|
getCms,
|
|
13746
|
-
getCompanyDetails: config.getCompanyDetails,
|
|
13747
14642
|
hashPassword: userAuth?.hashPassword,
|
|
13748
14643
|
minPasswordLength: 6
|
|
13749
14644
|
});
|
|
@@ -14669,14 +15564,72 @@ function createCmsApiHandler(config) {
|
|
|
14669
15564
|
const orderRepo = dataSource.getRepository(entityMap.orders);
|
|
14670
15565
|
const order = await orderRepo.findOne({
|
|
14671
15566
|
where: { qrToken: token, deleted: false },
|
|
14672
|
-
relations: ["contact", "items", "items.product"]
|
|
15567
|
+
relations: ["contact", "items", "items.product", "items.product.collection"]
|
|
15568
|
+
});
|
|
15569
|
+
if (!order) return new Response(
|
|
15570
|
+
`<html><body style="font-family:sans-serif;text-align:center;padding:60px"><h2>Order not found</h2><p style="color:#6b7280">This QR code is invalid or the order has been removed.</p></body></html>`,
|
|
15571
|
+
{ status: 404, headers: { "Content-Type": "text/html; charset=utf-8" } }
|
|
15572
|
+
);
|
|
15573
|
+
const { renderOrderTrackingPage: renderOrderTrackingPage2 } = await Promise.resolve().then(() => (init_OrderTrackPage(), OrderTrackPage_exports));
|
|
15574
|
+
const html = renderOrderTrackingPage2(order);
|
|
15575
|
+
return new Response(html, {
|
|
15576
|
+
status: 200,
|
|
15577
|
+
headers: { "Content-Type": "text/html; charset=utf-8" }
|
|
14673
15578
|
});
|
|
14674
|
-
if (!order) return config.json({ error: "Order not found" }, { status: 404 });
|
|
14675
|
-
return config.json(order);
|
|
14676
15579
|
} catch (err) {
|
|
14677
15580
|
const message = err instanceof Error ? err.message : String(err);
|
|
14678
|
-
return
|
|
15581
|
+
return new Response(
|
|
15582
|
+
`<html><body style="font-family:sans-serif;text-align:center;padding:60px"><h2>Something went wrong</h2><p style="color:#6b7280">${message}</p></body></html>`,
|
|
15583
|
+
{ status: 500, headers: { "Content-Type": "text/html; charset=utf-8" } }
|
|
15584
|
+
);
|
|
15585
|
+
}
|
|
15586
|
+
}
|
|
15587
|
+
if (path2[0] === "customer_contacts" && entityMap["customer_contacts"]) {
|
|
15588
|
+
const a = await config.requireAuth(req);
|
|
15589
|
+
if (a) return a;
|
|
15590
|
+
const pe = await requireEntityPermissionEffective(req, "vendor_customers", "read");
|
|
15591
|
+
if (pe) return pe;
|
|
15592
|
+
if (path2.length === 1 && m === "GET") {
|
|
15593
|
+
const { searchParams } = new URL(req.url);
|
|
15594
|
+
const customerId = searchParams.get("customerId");
|
|
15595
|
+
const limit = Math.min(Number(searchParams.get("limit") || "200"), 500);
|
|
15596
|
+
if (!customerId || !Number.isFinite(Number(customerId))) {
|
|
15597
|
+
return config.json({ error: "customerId is required" }, { status: 400 });
|
|
15598
|
+
}
|
|
15599
|
+
const repo = dataSource.getRepository(entityMap["customer_contacts"]);
|
|
15600
|
+
const rows = await repo.find({
|
|
15601
|
+
where: { customerId: Number(customerId) },
|
|
15602
|
+
relations: ["contact"],
|
|
15603
|
+
take: limit,
|
|
15604
|
+
order: { id: "ASC" }
|
|
15605
|
+
});
|
|
15606
|
+
return config.json({ data: rows, total: rows.length });
|
|
15607
|
+
}
|
|
15608
|
+
if (path2.length === 1 && m === "POST") {
|
|
15609
|
+
const pe2 = await requireEntityPermissionEffective(req, "vendor_customers", "create");
|
|
15610
|
+
if (pe2) return pe2;
|
|
15611
|
+
const body = await req.json();
|
|
15612
|
+
const customerId = Number(body.customerId);
|
|
15613
|
+
const contactId = Number(body.contactId);
|
|
15614
|
+
if (!Number.isFinite(customerId) || customerId <= 0) {
|
|
15615
|
+
return config.json({ error: "customerId is required" }, { status: 400 });
|
|
15616
|
+
}
|
|
15617
|
+
if (!Number.isFinite(contactId) || contactId <= 0) {
|
|
15618
|
+
return config.json({ error: "contactId is required" }, { status: 400 });
|
|
15619
|
+
}
|
|
15620
|
+
const repo = dataSource.getRepository(entityMap["customer_contacts"]);
|
|
15621
|
+
const existing = await repo.findOne({
|
|
15622
|
+
where: { customerId, contactId }
|
|
15623
|
+
});
|
|
15624
|
+
if (existing) {
|
|
15625
|
+
return config.json(existing, { status: 200 });
|
|
15626
|
+
}
|
|
15627
|
+
const created = await repo.save(
|
|
15628
|
+
repo.create({ customerId, contactId })
|
|
15629
|
+
);
|
|
15630
|
+
return config.json(created, { status: 201 });
|
|
14679
15631
|
}
|
|
15632
|
+
return config.json({ error: "Method not allowed" }, { status: 405 });
|
|
14680
15633
|
}
|
|
14681
15634
|
if (path2.length === 0) return config.json({ error: "Not found" }, { status: 404 });
|
|
14682
15635
|
const resource = resolveResource(path2[0]);
|
|
@@ -15119,6 +16072,8 @@ function createStorefrontApiHandler(config) {
|
|
|
15119
16072
|
const collectionRepo = () => dataSource.getRepository(entityMap.collections);
|
|
15120
16073
|
const groupRepo = () => dataSource.getRepository(entityMap.user_groups);
|
|
15121
16074
|
const configRepo = () => dataSource.getRepository(entityMap.configs);
|
|
16075
|
+
const customerRepo = () => dataSource.getRepository(entityMap.customer);
|
|
16076
|
+
const customerContactsRepo = () => dataSource.getRepository(entityMap.customer_contacts);
|
|
15122
16077
|
const CART_CHECKOUT_RELATIONS = ["items", "items.product", "items.product.taxes", "items.product.taxes.tax"];
|
|
15123
16078
|
function resolveSingleVendorIdFromCart(cart) {
|
|
15124
16079
|
const vendorIds = /* @__PURE__ */ new Set();
|
|
@@ -15320,6 +16275,142 @@ function createStorefrontApiHandler(config) {
|
|
|
15320
16275
|
await syncContactToErp(created);
|
|
15321
16276
|
return { id: created.id };
|
|
15322
16277
|
}
|
|
16278
|
+
function parseCheckoutContactDetails(b) {
|
|
16279
|
+
const src = b.contact && typeof b.contact === "object" && !Array.isArray(b.contact) ? b.contact : b;
|
|
16280
|
+
const name = String(src.name ?? "").trim();
|
|
16281
|
+
const email = String(src.email ?? "").trim().toLowerCase();
|
|
16282
|
+
const phone = src.phone != null && src.phone !== "" ? String(src.phone).trim() : null;
|
|
16283
|
+
if (!name || !email) return null;
|
|
16284
|
+
return { name, email, phone };
|
|
16285
|
+
}
|
|
16286
|
+
async function ensureCustomerContactLink(customerId, contactId) {
|
|
16287
|
+
if (!entityMap.customer_contacts) return;
|
|
16288
|
+
const existing = await customerContactsRepo().findOne({
|
|
16289
|
+
where: { customerId, contactId }
|
|
16290
|
+
});
|
|
16291
|
+
if (!existing) {
|
|
16292
|
+
await customerContactsRepo().save(
|
|
16293
|
+
customerContactsRepo().create({ customerId, contactId })
|
|
16294
|
+
);
|
|
16295
|
+
}
|
|
16296
|
+
}
|
|
16297
|
+
async function resolveCustomerCheckoutContact(b, sessionUserId) {
|
|
16298
|
+
if (!entityMap.customer) {
|
|
16299
|
+
return { ok: false, status: 503, message: "Customer not configured" };
|
|
16300
|
+
}
|
|
16301
|
+
const payloadUserId = intFromBody(b.userId) ?? sessionUserId;
|
|
16302
|
+
if (payloadUserId !== sessionUserId) {
|
|
16303
|
+
return { ok: false, status: 401, message: "Unauthorized" };
|
|
16304
|
+
}
|
|
16305
|
+
const details = parseCheckoutContactDetails(b);
|
|
16306
|
+
if (!details) {
|
|
16307
|
+
return { ok: false, status: 400, message: "contact name and email required" };
|
|
16308
|
+
}
|
|
16309
|
+
const customer = await customerRepo().findOne({
|
|
16310
|
+
where: { userId: payloadUserId, deleted: false }
|
|
16311
|
+
});
|
|
16312
|
+
if (!customer) {
|
|
16313
|
+
return { ok: false, status: 404, message: "Customer not found" };
|
|
16314
|
+
}
|
|
16315
|
+
const customerId = customer.id;
|
|
16316
|
+
let contact = await contactRepo().findOne({
|
|
16317
|
+
where: { email: details.email, deleted: false }
|
|
16318
|
+
});
|
|
16319
|
+
if (!contact) {
|
|
16320
|
+
contact = await contactRepo().save(
|
|
16321
|
+
contactRepo().create({
|
|
16322
|
+
name: details.name,
|
|
16323
|
+
email: details.email,
|
|
16324
|
+
phone: details.phone,
|
|
16325
|
+
type: "customer",
|
|
16326
|
+
userId: null,
|
|
16327
|
+
deleted: false
|
|
16328
|
+
})
|
|
16329
|
+
);
|
|
16330
|
+
await syncContactToErp(contact);
|
|
16331
|
+
} else {
|
|
16332
|
+
await contactRepo().update(contact.id, {
|
|
16333
|
+
name: details.name,
|
|
16334
|
+
phone: details.phone ?? contact.phone
|
|
16335
|
+
});
|
|
16336
|
+
}
|
|
16337
|
+
const contactId = contact.id;
|
|
16338
|
+
await ensureCustomerContactLink(customerId, contactId);
|
|
16339
|
+
return { ok: true, contactId, customerId };
|
|
16340
|
+
}
|
|
16341
|
+
async function loadBuyerCart(sessionUserId) {
|
|
16342
|
+
const buyerContact = await ensureContactForUser(sessionUserId);
|
|
16343
|
+
if (!buyerContact) return null;
|
|
16344
|
+
return cartRepo().findOne({
|
|
16345
|
+
where: { contactId: buyerContact.id },
|
|
16346
|
+
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16347
|
+
});
|
|
16348
|
+
}
|
|
16349
|
+
async function resolveCheckoutContactAndCart(b, req, sessionUid) {
|
|
16350
|
+
if (Number.isFinite(sessionUid)) {
|
|
16351
|
+
const useCustomerFlow = Boolean(entityMap.customer && entityMap.customer_contacts) && parseCheckoutContactDetails(b) != null;
|
|
16352
|
+
if (useCustomerFlow) {
|
|
16353
|
+
const resolved = await resolveCustomerCheckoutContact(b, sessionUid);
|
|
16354
|
+
if (!resolved.ok) {
|
|
16355
|
+
return { ok: false, response: json({ error: resolved.message }, { status: resolved.status }) };
|
|
16356
|
+
}
|
|
16357
|
+
const cart3 = await loadBuyerCart(sessionUid);
|
|
16358
|
+
return { ok: true, contactId: resolved.contactId, cart: cart3 };
|
|
16359
|
+
}
|
|
16360
|
+
const contact2 = await ensureContactForUser(sessionUid);
|
|
16361
|
+
if (!contact2) {
|
|
16362
|
+
return { ok: false, response: json({ error: "Contact required" }, { status: 400 }) };
|
|
16363
|
+
}
|
|
16364
|
+
const cart2 = await cartRepo().findOne({
|
|
16365
|
+
where: { contactId: contact2.id },
|
|
16366
|
+
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16367
|
+
});
|
|
16368
|
+
return { ok: true, contactId: contact2.id, cart: cart2 };
|
|
16369
|
+
}
|
|
16370
|
+
const details = parseCheckoutContactDetails(b);
|
|
16371
|
+
const email = details?.email ?? String(b.email ?? "").trim().toLowerCase();
|
|
16372
|
+
const name = details?.name ?? String(b.name ?? "").trim();
|
|
16373
|
+
const phone = details?.phone ?? (b.phone != null && b.phone !== "" ? String(b.phone).trim() : null);
|
|
16374
|
+
if (!email || !name) {
|
|
16375
|
+
return {
|
|
16376
|
+
ok: false,
|
|
16377
|
+
response: json({ error: "name and email required for guest checkout" }, { status: 400 })
|
|
16378
|
+
};
|
|
16379
|
+
}
|
|
16380
|
+
let contact = await contactRepo().findOne({ where: { email, deleted: false } });
|
|
16381
|
+
if (contact && contact.userId != null) {
|
|
16382
|
+
return { ok: false, response: json({ error: "Please sign in to complete checkout" }, { status: 400 }) };
|
|
16383
|
+
}
|
|
16384
|
+
if (!contact) {
|
|
16385
|
+
contact = await contactRepo().save(
|
|
16386
|
+
contactRepo().create({
|
|
16387
|
+
name,
|
|
16388
|
+
email,
|
|
16389
|
+
phone,
|
|
16390
|
+
userId: null,
|
|
16391
|
+
deleted: false
|
|
16392
|
+
})
|
|
16393
|
+
);
|
|
16394
|
+
} else {
|
|
16395
|
+
await contactRepo().update(contact.id, {
|
|
16396
|
+
name,
|
|
16397
|
+
phone: phone ?? contact.phone
|
|
16398
|
+
});
|
|
16399
|
+
}
|
|
16400
|
+
const contactId = contact.id;
|
|
16401
|
+
const guestForErp = await contactRepo().findOne({ where: { id: contactId } });
|
|
16402
|
+
if (guestForErp) await syncContactToErp(guestForErp);
|
|
16403
|
+
const cookies = parseCookies(req.headers.get("cookie"));
|
|
16404
|
+
const guestToken = cookies[cookieName];
|
|
16405
|
+
if (!guestToken) {
|
|
16406
|
+
return { ok: false, response: json({ error: "Cart not found" }, { status: 400 }) };
|
|
16407
|
+
}
|
|
16408
|
+
const cart = await cartRepo().findOne({
|
|
16409
|
+
where: { guestToken },
|
|
16410
|
+
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16411
|
+
});
|
|
16412
|
+
return { ok: true, contactId, cart };
|
|
16413
|
+
}
|
|
15323
16414
|
async function getOrCreateCart(req) {
|
|
15324
16415
|
const u = await getSessionUser();
|
|
15325
16416
|
const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
|
|
@@ -16139,50 +17230,9 @@ function createStorefrontApiHandler(config) {
|
|
|
16139
17230
|
if (capOrd) return capOrd;
|
|
16140
17231
|
const u = await getSessionUser();
|
|
16141
17232
|
const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
const contact = await ensureContactForUser(uid);
|
|
16146
|
-
if (!contact) return json({ error: "Contact required" }, { status: 400 });
|
|
16147
|
-
contactId = contact.id;
|
|
16148
|
-
cart = await cartRepo().findOne({
|
|
16149
|
-
where: { contactId },
|
|
16150
|
-
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16151
|
-
});
|
|
16152
|
-
} else {
|
|
16153
|
-
const email = String(b.email ?? "").trim();
|
|
16154
|
-
const name = String(b.name ?? "").trim();
|
|
16155
|
-
if (!email || !name) return json({ error: "name and email required for guest checkout" }, { status: 400 });
|
|
16156
|
-
let contact = await contactRepo().findOne({ where: { email, deleted: false } });
|
|
16157
|
-
if (contact && contact.userId != null) {
|
|
16158
|
-
return json({ error: "Please sign in to complete checkout" }, { status: 400 });
|
|
16159
|
-
}
|
|
16160
|
-
if (!contact) {
|
|
16161
|
-
contact = await contactRepo().save(
|
|
16162
|
-
contactRepo().create({
|
|
16163
|
-
name,
|
|
16164
|
-
email,
|
|
16165
|
-
phone: b.phone != null && b.phone !== "" ? String(b.phone) : null,
|
|
16166
|
-
userId: null,
|
|
16167
|
-
deleted: false
|
|
16168
|
-
})
|
|
16169
|
-
);
|
|
16170
|
-
} else if (name)
|
|
16171
|
-
await contactRepo().update(contact.id, {
|
|
16172
|
-
name,
|
|
16173
|
-
phone: b.phone != null && b.phone !== "" ? String(b.phone) : contact.phone
|
|
16174
|
-
});
|
|
16175
|
-
contactId = contact.id;
|
|
16176
|
-
const guestForErp = await contactRepo().findOne({ where: { id: contactId } });
|
|
16177
|
-
if (guestForErp) await syncContactToErp(guestForErp);
|
|
16178
|
-
const cookies = parseCookies(req.headers.get("cookie"));
|
|
16179
|
-
const guestToken = cookies[cookieName];
|
|
16180
|
-
if (!guestToken) return json({ error: "Cart not found" }, { status: 400 });
|
|
16181
|
-
cart = await cartRepo().findOne({
|
|
16182
|
-
where: { guestToken },
|
|
16183
|
-
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16184
|
-
});
|
|
16185
|
-
}
|
|
17233
|
+
const checkoutIdentity = await resolveCheckoutContactAndCart(b, req, uid);
|
|
17234
|
+
if (!checkoutIdentity.ok) return checkoutIdentity.response;
|
|
17235
|
+
const { contactId, cart } = checkoutIdentity;
|
|
16186
17236
|
if (!cart || !(cart.items || []).length) {
|
|
16187
17237
|
return json({ error: "Cart is empty" }, { status: 400 });
|
|
16188
17238
|
}
|
|
@@ -16245,50 +17295,9 @@ function createStorefrontApiHandler(config) {
|
|
|
16245
17295
|
if (capChk) return capChk;
|
|
16246
17296
|
const u = await getSessionUser();
|
|
16247
17297
|
const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
|
|
16248
|
-
|
|
16249
|
-
|
|
16250
|
-
|
|
16251
|
-
const contact = await ensureContactForUser(uid);
|
|
16252
|
-
if (!contact) return json({ error: "Contact required" }, { status: 400 });
|
|
16253
|
-
contactId = contact.id;
|
|
16254
|
-
cart = await cartRepo().findOne({
|
|
16255
|
-
where: { contactId },
|
|
16256
|
-
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16257
|
-
});
|
|
16258
|
-
} else {
|
|
16259
|
-
const email = String(b.email ?? "").trim();
|
|
16260
|
-
const name = String(b.name ?? "").trim();
|
|
16261
|
-
if (!email || !name) return json({ error: "name and email required for guest checkout" }, { status: 400 });
|
|
16262
|
-
let contact = await contactRepo().findOne({ where: { email, deleted: false } });
|
|
16263
|
-
if (contact && contact.userId != null) {
|
|
16264
|
-
return json({ error: "Please sign in to complete checkout" }, { status: 400 });
|
|
16265
|
-
}
|
|
16266
|
-
if (!contact) {
|
|
16267
|
-
contact = await contactRepo().save(
|
|
16268
|
-
contactRepo().create({
|
|
16269
|
-
name,
|
|
16270
|
-
email,
|
|
16271
|
-
phone: b.phone != null && b.phone !== "" ? String(b.phone) : null,
|
|
16272
|
-
userId: null,
|
|
16273
|
-
deleted: false
|
|
16274
|
-
})
|
|
16275
|
-
);
|
|
16276
|
-
} else if (name)
|
|
16277
|
-
await contactRepo().update(contact.id, {
|
|
16278
|
-
name,
|
|
16279
|
-
phone: b.phone != null && b.phone !== "" ? String(b.phone) : contact.phone
|
|
16280
|
-
});
|
|
16281
|
-
contactId = contact.id;
|
|
16282
|
-
const guestForErp2 = await contactRepo().findOne({ where: { id: contactId } });
|
|
16283
|
-
if (guestForErp2) await syncContactToErp(guestForErp2);
|
|
16284
|
-
const cookies = parseCookies(req.headers.get("cookie"));
|
|
16285
|
-
const guestToken = cookies[cookieName];
|
|
16286
|
-
if (!guestToken) return json({ error: "Cart not found" }, { status: 400 });
|
|
16287
|
-
cart = await cartRepo().findOne({
|
|
16288
|
-
where: { guestToken },
|
|
16289
|
-
relations: [...CART_CHECKOUT_RELATIONS]
|
|
16290
|
-
});
|
|
16291
|
-
}
|
|
17298
|
+
const checkoutIdentity = await resolveCheckoutContactAndCart(b, req, uid);
|
|
17299
|
+
if (!checkoutIdentity.ok) return checkoutIdentity.response;
|
|
17300
|
+
const { contactId, cart } = checkoutIdentity;
|
|
16292
17301
|
if (!cart || !(cart.items || []).length) {
|
|
16293
17302
|
return json({ error: "Cart is empty" }, { status: 400 });
|
|
16294
17303
|
}
|