@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.
Files changed (38) hide show
  1. package/README.md +9 -6
  2. package/dist/admin.cjs +980 -801
  3. package/dist/admin.cjs.map +1 -1
  4. package/dist/admin.d.cts +7 -2
  5. package/dist/admin.d.ts +7 -2
  6. package/dist/admin.js +1021 -842
  7. package/dist/admin.js.map +1 -1
  8. package/dist/api.cjs +1858 -848
  9. package/dist/api.cjs.map +1 -1
  10. package/dist/api.d.cts +1 -1
  11. package/dist/api.d.ts +1 -1
  12. package/dist/api.js +1824 -815
  13. package/dist/api.js.map +1 -1
  14. package/dist/auth.cjs +94 -11
  15. package/dist/auth.cjs.map +1 -1
  16. package/dist/auth.d.cts +17 -1
  17. package/dist/auth.d.ts +17 -1
  18. package/dist/auth.js +89 -11
  19. package/dist/auth.js.map +1 -1
  20. package/dist/cli.cjs +39 -0
  21. package/dist/cli.cjs.map +1 -1
  22. package/dist/cli.js +39 -0
  23. package/dist/cli.js.map +1 -1
  24. package/dist/{index-rZTnpK7y.d.cts → index-Bf5GO8fu.d.cts} +3 -2
  25. package/dist/{index-DWd5Gjc4.d.ts → index-DOiJuMQA.d.ts} +3 -2
  26. package/dist/index.cjs +2078 -841
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +83 -8
  29. package/dist/index.d.ts +83 -8
  30. package/dist/index.js +2013 -786
  31. package/dist/index.js.map +1 -1
  32. package/dist/migrations/1778660000004-CreateCustomerAndCustomerContacts.ts +99 -0
  33. package/dist/migrations/1778660000005-AddCustomerIdToVendorCustomers.ts +39 -0
  34. package/dist/migrations/1778660000006-UpdateVendorCustomersContactNullable.ts +36 -0
  35. package/dist/migrations/1778660000007-VendorOwnerCustomerContactsPermission.ts +39 -0
  36. package/dist/migrations/1779300000000-VendorOwnerContactsPermission.ts +39 -0
  37. package/dist/migrations/1779400000000-AddCustomerContactIdToOrders.ts +33 -0
  38. package/package.json +4 -3
package/dist/api.cjs CHANGED
@@ -102,6 +102,30 @@ var init_permission_entities = __esm({
102
102
  }
103
103
  });
104
104
 
105
+ // src/auth/role-helpers.ts
106
+ function isSuperAdmin(user) {
107
+ if (!user) return false;
108
+ if (user.groupId === SUPER_ADMIN_GROUP_ID) return true;
109
+ if (user.isRBACAdmin === true) return true;
110
+ return isSuperAdminGroupName(user.groupName);
111
+ }
112
+ function isVendorAdmin(user) {
113
+ if (!user?.email || isSuperAdmin(user)) return false;
114
+ if (user.groupId === VENDOR_ADMIN_GROUP_ID) return true;
115
+ if ((user.vendorIds?.length ?? 0) > 0) return true;
116
+ return isVendorGroupName(user.groupName);
117
+ }
118
+ var SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID;
119
+ var init_role_helpers = __esm({
120
+ "src/auth/role-helpers.ts"() {
121
+ "use strict";
122
+ init_permission_entities();
123
+ init_vendor_scope();
124
+ SUPER_ADMIN_GROUP_ID = 1;
125
+ VENDOR_ADMIN_GROUP_ID = 5;
126
+ }
127
+ });
128
+
105
129
  // src/auth/vendor-scope.ts
106
130
  function isVendorGroupName(name) {
107
131
  if (!name?.trim()) return false;
@@ -110,12 +134,12 @@ function isVendorGroupName(name) {
110
134
  }
111
135
  function isPlatformAdministrator(user) {
112
136
  if (!user?.email) return false;
113
- return !!(user.isRBACAdmin || isSuperAdminGroupName(user.groupName));
137
+ return isSuperAdmin(user);
114
138
  }
115
139
  function isVendorPortalUser(user) {
116
140
  if (user?.isVendorPortal === true) return true;
117
141
  if (!user?.email || isPlatformAdministrator(user)) return false;
118
- if ((user.vendorIds?.length ?? 0) > 0) return true;
142
+ if (isVendorAdmin(user)) return true;
119
143
  return isVendorGroupName(user.groupName);
120
144
  }
121
145
  function isVendorOwner(user) {
@@ -151,7 +175,7 @@ var VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_OWNER_GROUP
151
175
  var init_vendor_scope = __esm({
152
176
  "src/auth/vendor-scope.ts"() {
153
177
  "use strict";
154
- init_permission_entities();
178
+ init_role_helpers();
155
179
  VENDOR_SCOPED_STORE_ENTITIES = /* @__PURE__ */ new Set([
156
180
  "products",
157
181
  "collections",
@@ -248,6 +272,7 @@ var email_queue_exports = {};
248
272
  __export(email_queue_exports, {
249
273
  queueEmail: () => queueEmail,
250
274
  queueOrderPlacedEmails: () => queueOrderPlacedEmails,
275
+ queueVendorOnboardEmails: () => queueVendorOnboardEmails,
251
276
  registerEmailQueueProcessor: () => registerEmailQueueProcessor
252
277
  });
253
278
  function registerEmailQueueProcessor(cms) {
@@ -340,6 +365,60 @@ async function queueOrderPlacedEmails(cms, payload) {
340
365
  }
341
366
  await Promise.all(jobs);
342
367
  }
368
+ async function queueVendorOnboardEmails(cms, payload) {
369
+ const {
370
+ vendorName,
371
+ vendorSlug,
372
+ ownerName,
373
+ ownerEmail,
374
+ activation,
375
+ inviteLink,
376
+ signInLink,
377
+ kind = "vendor_onboard",
378
+ notifyEmails,
379
+ companyDetails,
380
+ sendToOwner = true
381
+ } = payload;
382
+ const base = {
383
+ vendorName,
384
+ vendorSlug,
385
+ ownerName,
386
+ ownerEmail,
387
+ activation,
388
+ inviteLink,
389
+ signInLink,
390
+ kind,
391
+ companyDetails: companyDetails ?? {}
392
+ };
393
+ const ownerLower = ownerEmail?.trim().toLowerCase() ?? "";
394
+ const jobs = [];
395
+ if (sendToOwner && ownerEmail?.trim()) {
396
+ jobs.push(
397
+ queueEmail(cms, {
398
+ to: ownerEmail.trim(),
399
+ templateName: "vendorOnboarded",
400
+ ctx: { ...base, audience: "owner" }
401
+ })
402
+ );
403
+ }
404
+ const seen = /* @__PURE__ */ new Set();
405
+ for (const raw of notifyEmails) {
406
+ const to = raw.trim();
407
+ if (!to) continue;
408
+ const key = to.toLowerCase();
409
+ if (seen.has(key)) continue;
410
+ seen.add(key);
411
+ if (ownerLower && key === ownerLower) continue;
412
+ jobs.push(
413
+ queueEmail(cms, {
414
+ to,
415
+ templateName: "vendorOnboarded",
416
+ ctx: { ...base, audience: "internal" }
417
+ })
418
+ );
419
+ }
420
+ await Promise.all(jobs);
421
+ }
343
422
  var EMAIL_QUEUE_NAME;
344
423
  var init_email_queue = __esm({
345
424
  "src/plugins/email/email-queue.ts"() {
@@ -918,6 +997,399 @@ var init_paid_order_erp = __esm({
918
997
  }
919
998
  });
920
999
 
1000
+ // src/admin/pages/OrderTrackPage.ts
1001
+ var OrderTrackPage_exports = {};
1002
+ __export(OrderTrackPage_exports, {
1003
+ renderOrderTrackingPage: () => renderOrderTrackingPage
1004
+ });
1005
+ function renderOrderTrackingPage(order) {
1006
+ const contact = order.contact;
1007
+ const items = order.items ?? [];
1008
+ const currency = String(order.currency ?? "INR");
1009
+ function formatMoney(amount) {
1010
+ return new Intl.NumberFormat("en-IN", {
1011
+ style: "currency",
1012
+ currency,
1013
+ minimumFractionDigits: 2
1014
+ }).format(Number(amount));
1015
+ }
1016
+ function formatDate(dateStr) {
1017
+ return new Date(dateStr).toLocaleDateString("en-IN", {
1018
+ year: "numeric",
1019
+ month: "long",
1020
+ day: "numeric"
1021
+ });
1022
+ }
1023
+ const statusConfig = {
1024
+ pending: { label: "Order Placed", color: "#f59e0b", step: 1 },
1025
+ confirmed: { label: "Confirmed", color: "#3b82f6", step: 2 },
1026
+ processing: { label: "Processing", color: "#8b5cf6", step: 3 },
1027
+ completed: { label: "Completed", color: "#10b981", step: 4 },
1028
+ cancelled: { label: "Cancelled", color: "#ef4444", step: 0 }
1029
+ };
1030
+ const status = String(order.status ?? "pending");
1031
+ const sc = statusConfig[status] ?? { label: status, color: "#6b7280", step: 1 };
1032
+ const isCancelled = status === "cancelled";
1033
+ const steps = [
1034
+ { label: "Order Placed", icon: "\u{1F4CB}" },
1035
+ { label: "Confirmed", icon: "\u2705" },
1036
+ { label: "Processing", icon: "\u2699\uFE0F" },
1037
+ { label: "Completed", icon: "\u{1F389}" }
1038
+ ];
1039
+ const stepsHtml = isCancelled ? `<div class="cancelled-banner">Order Cancelled</div>` : steps.map((s, i) => {
1040
+ const stepNum = i + 1;
1041
+ const isActive = sc.step === stepNum;
1042
+ const isDone = sc.step > stepNum;
1043
+ return `
1044
+ <div class="step ${isDone ? "done" : ""} ${isActive ? "active" : ""}">
1045
+ <div class="step-circle">${isDone ? "\u2713" : s.icon}</div>
1046
+ <div class="step-label">${s.label}</div>
1047
+ </div>
1048
+ ${stepNum < 4 ? `<div class="step-line ${sc.step > stepNum ? "done" : ""}"></div>` : ""}
1049
+ `;
1050
+ }).join("");
1051
+ const itemsHtml = items.map((item) => {
1052
+ const name = item.product?.collection?.name ?? item.product?.name ?? `Product #${item.id}`;
1053
+ const sku = item.product?.sku ?? "\u2014";
1054
+ return `
1055
+ <div class="item-row">
1056
+ <div class="item-avatar">${name.charAt(0).toUpperCase()}</div>
1057
+ <div class="item-info">
1058
+ <div class="item-name">${name}</div>
1059
+ <div class="item-sku">SKU: ${sku}</div>
1060
+ </div>
1061
+ <div class="item-qty">\xD7${item.quantity}</div>
1062
+ <div class="item-price">${formatMoney(Number(item.unitPrice))}</div>
1063
+ </div>
1064
+ `;
1065
+ }).join("");
1066
+ const discountRow = Number(order.discount) > 0 ? `<div class="summary-row discount"><span>Discount</span><span>\u2212${formatMoney(Number(order.discount))}</span></div>` : "";
1067
+ const taxRow = Number(order.tax) > 0 ? `<div class="summary-row"><span>Tax</span><span>${formatMoney(Number(order.tax))}</span></div>` : "";
1068
+ return `<!DOCTYPE html>
1069
+ <html lang="en">
1070
+ <head>
1071
+ <meta charset="UTF-8">
1072
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
1073
+ <title>Order ${order.orderNumber} \u2014 Tracking</title>
1074
+ <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=DM+Sans:wght@400;500;600&display=swap" rel="stylesheet">
1075
+ <style>
1076
+ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
1077
+
1078
+ :root {
1079
+ --accent: ${sc.color};
1080
+ --bg: #f8f7f4;
1081
+ --card: #ffffff;
1082
+ --text: #1a1a2e;
1083
+ --muted: #6b7280;
1084
+ --border: #e5e7eb;
1085
+ --radius: 16px;
1086
+ }
1087
+
1088
+ body {
1089
+ font-family: 'DM Sans', sans-serif;
1090
+ background: var(--bg);
1091
+ color: var(--text);
1092
+ min-height: 100vh;
1093
+ padding: 24px 16px 48px;
1094
+ }
1095
+
1096
+ .container { max-width: 640px; margin: 0 auto; }
1097
+
1098
+ /* Header */
1099
+ .header {
1100
+ text-align: center;
1101
+ margin-bottom: 32px;
1102
+ animation: fadeDown 0.5s ease both;
1103
+ }
1104
+ .header-eyebrow {
1105
+ font-size: 12px;
1106
+ font-weight: 600;
1107
+ letter-spacing: 0.15em;
1108
+ text-transform: uppercase;
1109
+ color: var(--accent);
1110
+ margin-bottom: 8px;
1111
+ }
1112
+ .header h1 {
1113
+ font-family: 'Playfair Display', serif;
1114
+ font-size: clamp(26px, 6vw, 36px);
1115
+ color: var(--text);
1116
+ line-height: 1.2;
1117
+ }
1118
+ .header-meta {
1119
+ font-size: 13px;
1120
+ color: var(--muted);
1121
+ margin-top: 6px;
1122
+ }
1123
+
1124
+ /* Status badge */
1125
+ .status-badge {
1126
+ display: inline-flex;
1127
+ align-items: center;
1128
+ gap: 6px;
1129
+ background: color-mix(in srgb, var(--accent) 12%, transparent);
1130
+ color: var(--accent);
1131
+ border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
1132
+ border-radius: 100px;
1133
+ padding: 5px 14px;
1134
+ font-size: 13px;
1135
+ font-weight: 600;
1136
+ margin-top: 14px;
1137
+ }
1138
+ .status-dot {
1139
+ width: 7px; height: 7px;
1140
+ border-radius: 50%;
1141
+ background: var(--accent);
1142
+ animation: pulse 2s ease infinite;
1143
+ }
1144
+
1145
+ /* Card */
1146
+ .card {
1147
+ background: var(--card);
1148
+ border-radius: var(--radius);
1149
+ border: 1px solid var(--border);
1150
+ overflow: hidden;
1151
+ margin-bottom: 16px;
1152
+ animation: fadeUp 0.5s ease both;
1153
+ }
1154
+ .card:nth-child(2) { animation-delay: 0.08s; }
1155
+ .card:nth-child(3) { animation-delay: 0.16s; }
1156
+ .card:nth-child(4) { animation-delay: 0.24s; }
1157
+
1158
+ .card-header {
1159
+ display: flex; align-items: center; gap: 10px;
1160
+ padding: 16px 20px;
1161
+ border-bottom: 1px solid var(--border);
1162
+ background: #fafafa;
1163
+ }
1164
+ .card-header-icon {
1165
+ width: 32px; height: 32px;
1166
+ border-radius: 8px;
1167
+ background: color-mix(in srgb, var(--accent) 12%, transparent);
1168
+ display: flex; align-items: center; justify-content: center;
1169
+ font-size: 15px;
1170
+ }
1171
+ .card-title {
1172
+ font-size: 13px;
1173
+ font-weight: 600;
1174
+ letter-spacing: 0.05em;
1175
+ text-transform: uppercase;
1176
+ color: var(--muted);
1177
+ }
1178
+ .card-body { padding: 20px; }
1179
+
1180
+ /* Progress tracker */
1181
+ .progress-track {
1182
+ display: flex;
1183
+ align-items: flex-start;
1184
+ justify-content: space-between;
1185
+ padding: 8px 0;
1186
+ overflow-x: auto;
1187
+ }
1188
+ .step {
1189
+ display: flex; flex-direction: column; align-items: center;
1190
+ gap: 8px; min-width: 60px;
1191
+ }
1192
+ .step-circle {
1193
+ width: 44px; height: 44px;
1194
+ border-radius: 50%;
1195
+ border: 2px solid var(--border);
1196
+ background: white;
1197
+ display: flex; align-items: center; justify-content: center;
1198
+ font-size: 18px;
1199
+ color: var(--muted);
1200
+ transition: all 0.3s;
1201
+ }
1202
+ .step.done .step-circle {
1203
+ background: color-mix(in srgb, var(--accent) 15%, white);
1204
+ border-color: var(--accent);
1205
+ color: var(--accent);
1206
+ font-size: 16px;
1207
+ font-weight: 700;
1208
+ }
1209
+ .step.active .step-circle {
1210
+ background: var(--accent);
1211
+ border-color: var(--accent);
1212
+ color: white;
1213
+ box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
1214
+ }
1215
+ .step-label {
1216
+ font-size: 11px; font-weight: 500; color: var(--muted);
1217
+ text-align: center; line-height: 1.3;
1218
+ }
1219
+ .step.active .step-label, .step.done .step-label { color: var(--accent); font-weight: 600; }
1220
+ .step-line {
1221
+ flex: 1; height: 2px;
1222
+ background: var(--border);
1223
+ margin-top: 22px; min-width: 20px;
1224
+ transition: background 0.3s;
1225
+ }
1226
+ .step-line.done { background: var(--accent); }
1227
+ .cancelled-banner {
1228
+ text-align: center; padding: 16px;
1229
+ background: #fef2f2; color: #ef4444;
1230
+ border-radius: 10px;
1231
+ font-weight: 600; font-size: 15px;
1232
+ }
1233
+
1234
+ /* Info grid */
1235
+ .info-grid {
1236
+ display: grid;
1237
+ grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
1238
+ gap: 16px;
1239
+ }
1240
+ .info-item dt {
1241
+ font-size: 11px; font-weight: 600;
1242
+ text-transform: uppercase; letter-spacing: 0.08em;
1243
+ color: var(--muted); margin-bottom: 4px;
1244
+ }
1245
+ .info-item dd { font-size: 14px; font-weight: 500; color: var(--text); }
1246
+
1247
+ /* Customer */
1248
+ .customer-row {
1249
+ display: flex; align-items: center; gap: 14px;
1250
+ }
1251
+ .customer-avatar {
1252
+ width: 46px; height: 46px; border-radius: 50%;
1253
+ background: color-mix(in srgb, var(--accent) 15%, #f3f4f6);
1254
+ color: var(--accent);
1255
+ display: flex; align-items: center; justify-content: center;
1256
+ font-family: 'Playfair Display', serif;
1257
+ font-size: 18px; font-weight: 700; flex-shrink: 0;
1258
+ }
1259
+ .customer-name { font-size: 15px; font-weight: 600; }
1260
+ .customer-email { font-size: 13px; color: var(--muted); margin-top: 2px; }
1261
+
1262
+ /* Items */
1263
+ .item-row {
1264
+ display: flex; align-items: center; gap: 12px;
1265
+ padding: 12px 0;
1266
+ border-bottom: 1px solid var(--border);
1267
+ }
1268
+ .item-row:last-child { border-bottom: none; padding-bottom: 0; }
1269
+ .item-row:first-child { padding-top: 0; }
1270
+ .item-avatar {
1271
+ width: 40px; height: 40px; border-radius: 10px;
1272
+ background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 20%, #e5e7eb), color-mix(in srgb, var(--accent) 5%, #f9fafb));
1273
+ color: var(--accent);
1274
+ display: flex; align-items: center; justify-content: center;
1275
+ font-size: 16px; font-weight: 700; flex-shrink: 0;
1276
+ }
1277
+ .item-info { flex: 1; min-width: 0; }
1278
+ .item-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
1279
+ .item-sku { font-size: 12px; color: var(--muted); margin-top: 2px; }
1280
+ .item-qty { font-size: 13px; color: var(--muted); min-width: 28px; text-align: center; }
1281
+ .item-price { font-size: 14px; font-weight: 600; min-width: 80px; text-align: right; }
1282
+
1283
+ /* Summary */
1284
+ .summary-row {
1285
+ display: flex; justify-content: space-between;
1286
+ font-size: 14px; padding: 7px 0; color: var(--muted);
1287
+ }
1288
+ .summary-row.discount { color: #10b981; }
1289
+ .summary-row.total {
1290
+ font-size: 17px; font-weight: 700; color: var(--text);
1291
+ border-top: 2px solid var(--border); margin-top: 6px; padding-top: 14px;
1292
+ }
1293
+
1294
+ /* Footer */
1295
+ .footer {
1296
+ text-align: center; margin-top: 32px;
1297
+ font-size: 12px; color: #9ca3af;
1298
+ animation: fadeUp 0.5s ease 0.4s both;
1299
+ }
1300
+
1301
+ /* Animations */
1302
+ @keyframes fadeDown {
1303
+ from { opacity: 0; transform: translateY(-16px); }
1304
+ to { opacity: 1; transform: translateY(0); }
1305
+ }
1306
+ @keyframes fadeUp {
1307
+ from { opacity: 0; transform: translateY(16px); }
1308
+ to { opacity: 1; transform: translateY(0); }
1309
+ }
1310
+ @keyframes pulse {
1311
+ 0%, 100% { opacity: 1; }
1312
+ 50% { opacity: 0.4; }
1313
+ }
1314
+ </style>
1315
+ </head>
1316
+ <body>
1317
+ <div class="container">
1318
+
1319
+ <!-- Header -->
1320
+ <div class="header">
1321
+ <div class="header-eyebrow">Order Tracking</div>
1322
+ <h1>${String(order.orderNumber)}</h1>
1323
+ <div class="header-meta">Placed on ${formatDate(String(order.createdAt))}</div>
1324
+ <div><span class="status-badge"><span class="status-dot"></span>${sc.label}</span></div>
1325
+ </div>
1326
+
1327
+ <!-- Progress -->
1328
+ <div class="card">
1329
+ <div class="card-header">
1330
+ <div class="card-header-icon">\u{1F69A}</div>
1331
+ <div class="card-title">Order Progress</div>
1332
+ </div>
1333
+ <div class="card-body">
1334
+ <div class="progress-track">${stepsHtml}</div>
1335
+ </div>
1336
+ </div>
1337
+
1338
+ ${contact ? `
1339
+ <!-- Customer -->
1340
+ <div class="card">
1341
+ <div class="card-header">
1342
+ <div class="card-header-icon">\u{1F464}</div>
1343
+ <div class="card-title">Customer</div>
1344
+ </div>
1345
+ <div class="card-body">
1346
+ <div class="customer-row">
1347
+ <div class="customer-avatar">${String(contact.name ?? "?").charAt(0).toUpperCase()}</div>
1348
+ <div>
1349
+ <div class="customer-name">${String(contact.name ?? "\u2014")}</div>
1350
+ <div class="customer-email">${String(contact.email ?? "\u2014")}</div>
1351
+ ${contact.phone ? `<div class="customer-email">${String(contact.phone)}</div>` : ""}
1352
+ </div>
1353
+ </div>
1354
+ </div>
1355
+ </div>` : ""}
1356
+
1357
+ <!-- Items -->
1358
+ <div class="card">
1359
+ <div class="card-header">
1360
+ <div class="card-header-icon">\u{1F4E6}</div>
1361
+ <div class="card-title">Items (${items.length})</div>
1362
+ </div>
1363
+ <div class="card-body">
1364
+ ${items.length === 0 ? '<p style="color:var(--muted);font-size:14px;">No items</p>' : itemsHtml}
1365
+ </div>
1366
+ </div>
1367
+
1368
+ <!-- Summary -->
1369
+ <div class="card">
1370
+ <div class="card-header">
1371
+ <div class="card-header-icon">\u{1F9FE}</div>
1372
+ <div class="card-title">Order Summary</div>
1373
+ </div>
1374
+ <div class="card-body">
1375
+ <div class="summary-row"><span>Subtotal</span><span>${formatMoney(Number(order.subtotal))}</span></div>
1376
+ ${discountRow}
1377
+ ${taxRow}
1378
+ <div class="summary-row total"><span>Total</span><span>${formatMoney(Number(order.total))}</span></div>
1379
+ </div>
1380
+ </div>
1381
+
1382
+ <div class="footer">Scan the QR code on your receipt to return to this page.</div>
1383
+ </div>
1384
+ </body>
1385
+ </html>`;
1386
+ }
1387
+ var init_OrderTrackPage = __esm({
1388
+ "src/admin/pages/OrderTrackPage.ts"() {
1389
+ "use strict";
1390
+ }
1391
+ });
1392
+
921
1393
  // src/api/index.ts
922
1394
  var api_exports = {};
923
1395
  __export(api_exports, {
@@ -961,6 +1433,18 @@ var import_typeorm2 = require("typeorm");
961
1433
  // src/api/vendor-scope-crud.ts
962
1434
  var import_typeorm = require("typeorm");
963
1435
  init_vendor_scope();
1436
+
1437
+ // src/lib/default-vendor-id.ts
1438
+ function getDefaultVendorId() {
1439
+ const raw = process.env.DEFAULT_VENDOR_ID;
1440
+ if (raw != null && String(raw).trim() !== "") {
1441
+ const n = Number(raw);
1442
+ if (Number.isFinite(n) && n > 0) return Math.floor(n);
1443
+ }
1444
+ return 1;
1445
+ }
1446
+
1447
+ // src/api/vendor-scope-crud.ts
964
1448
  function repoHasVendorIdColumn(repo) {
965
1449
  return repo.metadata.columns.some((c) => c.propertyName === "vendorId");
966
1450
  }
@@ -1007,26 +1491,39 @@ function rowMatchesVendorScope(row, scope, resource) {
1007
1491
  }
1008
1492
  return Number(row.vendorId) === scope.vendorId;
1009
1493
  }
1494
+ function vendorScopeRowAccess(row, scope, resource) {
1495
+ if (!row) return "not_found";
1496
+ if (rowMatchesVendorScope(row, scope, resource)) return "ok";
1497
+ return scope.type === "vendor" ? "forbidden" : "not_found";
1498
+ }
1010
1499
  function enforceVendorIdOnCreateBody(body, scope, repo) {
1011
1500
  if (!repoHasVendorIdColumn(repo)) return;
1012
1501
  if (scope.type === "vendor") {
1502
+ delete body.vendorId;
1013
1503
  body.vendorId = scope.vendorId;
1014
1504
  }
1015
1505
  }
1016
- function requireVendorIdForScopedCreate(resource, persistBody, scope, repo, rawBody) {
1506
+ function resolveVendorIdForWrite(scope, session, rawBody) {
1507
+ if (scope.type === "vendor") return scope.vendorId;
1508
+ if (scope.type === "deny") return null;
1509
+ if (rawBody) {
1510
+ const fromBody = Number(rawBody.vendorId);
1511
+ if (Number.isFinite(fromBody) && fromBody > 0) return fromBody;
1512
+ }
1513
+ const active = session?.activeVendorId;
1514
+ if (active != null && Number.isFinite(Number(active)) && Number(active) > 0) {
1515
+ return Number(active);
1516
+ }
1517
+ return getDefaultVendorId();
1518
+ }
1519
+ function requireVendorIdForScopedCreate(resource, persistBody, scope, repo, context) {
1017
1520
  if (!resourceUsesVendorScope(resource) || !repoHasVendorIdColumn(repo)) {
1018
1521
  return { ok: true };
1019
1522
  }
1523
+ const ctx = context && ("session" in context || "rawBody" in context) ? context : { rawBody: context };
1020
1524
  enforceVendorIdOnCreateBody(persistBody, scope, repo);
1021
- const vid = Number(persistBody.vendorId);
1022
- if (Number.isFinite(vid) && vid > 0) return { ok: true };
1023
- if (scope.type === "all" && rawBody) {
1024
- const n = Number(rawBody.vendorId);
1025
- if (Number.isFinite(n) && n > 0) {
1026
- persistBody.vendorId = n;
1027
- return { ok: true };
1028
- }
1029
- return { ok: false, error: "vendorId is required", status: 400 };
1525
+ if (scope.type === "vendor") {
1526
+ return { ok: true };
1030
1527
  }
1031
1528
  if (scope.type === "deny") {
1032
1529
  return {
@@ -1035,6 +1532,13 @@ function requireVendorIdForScopedCreate(resource, persistBody, scope, repo, rawB
1035
1532
  status: 403
1036
1533
  };
1037
1534
  }
1535
+ const vid = Number(persistBody.vendorId);
1536
+ if (Number.isFinite(vid) && vid > 0) return { ok: true };
1537
+ const resolved = resolveVendorIdForWrite(scope, ctx.session ?? null, ctx.rawBody ?? persistBody);
1538
+ if (resolved != null && resolved > 0) {
1539
+ persistBody.vendorId = resolved;
1540
+ return { ok: true };
1541
+ }
1038
1542
  return { ok: false, error: "vendorId is required", status: 400 };
1039
1543
  }
1040
1544
 
@@ -1184,17 +1688,37 @@ async function contactIsVendorCustomer(dataSource, entityMap, vendorId, contactI
1184
1688
  const contactEntity = entityMap.contacts;
1185
1689
  if (!vcEntity || !contactEntity) return false;
1186
1690
  const vcRepo = dataSource.getRepository(vcEntity);
1187
- const link = await vcRepo.findOne({
1188
- where: { vendorId, contactId }
1189
- });
1190
- if (!link) return false;
1191
1691
  const contactRepo = dataSource.getRepository(contactEntity);
1192
1692
  const contact = await contactRepo.findOne({
1193
1693
  where: { id: contactId, deleted: false }
1194
1694
  });
1195
1695
  if (!contact) return false;
1196
- const t = contact.type;
1197
- return t == null || t === "" || isCustomerTypeContact(t);
1696
+ const email = contact.email;
1697
+ if (entityMap.customer && email) {
1698
+ const customerRepo = dataSource.getRepository(entityMap.customer);
1699
+ const customer = await customerRepo.findOne({
1700
+ where: { email, deleted: false }
1701
+ });
1702
+ if (customer) {
1703
+ const customerId = Number(customer.id);
1704
+ const customerLink = await vcRepo.findOne({
1705
+ where: { vendorId, customerId }
1706
+ });
1707
+ if (customerLink != null) return true;
1708
+ }
1709
+ }
1710
+ const vcMeta = dataSource.getRepository(vcEntity).metadata;
1711
+ const hasContactIdCol = vcMeta.columns.some((c) => c.propertyName === "contactId");
1712
+ if (hasContactIdCol) {
1713
+ const directLink = await vcRepo.findOne({
1714
+ where: { vendorId, contactId }
1715
+ });
1716
+ if (directLink) {
1717
+ const t = contact.type;
1718
+ return t == null || t == "" || isCustomerTypeContact(t);
1719
+ }
1720
+ }
1721
+ return false;
1198
1722
  }
1199
1723
  async function assertContactAllowedForVendorOrder(dataSource, entityMap, vendorId, contactId) {
1200
1724
  if (!Number.isFinite(contactId)) {
@@ -2505,9 +3029,13 @@ async function calculateOrderTotals(dataSource, entityMap, itemsSummary, discoun
2505
3029
  };
2506
3030
  }
2507
3031
  function createCrudHandler(dataSource, entityMap, options) {
2508
- const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getVendorScope } = options;
3032
+ const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getVendorScope, getHydratedSessionUser } = options;
2509
3033
  const syncContactRowToErp = makeContactErpSync(dataSource, entityMap, getCms);
2510
3034
  const resolveScope = getVendorScope ?? (async () => ({ type: "all" }));
3035
+ async function vendorCreateContext(rawBody) {
3036
+ const session = await getHydratedSessionUser?.() ?? null;
3037
+ return { rawBody, session };
3038
+ }
2511
3039
  async function authz(req, resource, action) {
2512
3040
  const authError = await requireAuth(req);
2513
3041
  if (authError) return authError;
@@ -2771,34 +3299,27 @@ function createCrudHandler(dataSource, entityMap, options) {
2771
3299
  });
2772
3300
  return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
2773
3301
  }
2774
- if (resource === "vendor_customers" && entityMap.contacts) {
3302
+ if (resource === "vendor_customers" && entityMap["customer"]) {
2775
3303
  const scope = await resolveScope();
2776
3304
  const repo2 = dataSource.getRepository(entity);
2777
- const qb = repo2.createQueryBuilder("vc").leftJoinAndSelect("vc.contact", "contact").andWhere("contact.deleted = :contactDel", { contactDel: false }).orderBy("vc.createdAt", sortOrder === "DESC" ? "DESC" : "ASC").skip(skip).take(limit);
3305
+ const qb = repo2.createQueryBuilder("vc").leftJoinAndSelect("vc.customer", "customer").leftJoinAndSelect("customer.user", "user").orderBy("vc.createdAt", sortOrder === "DESC" ? "DESC" : "ASC").skip(skip).take(limit);
2778
3306
  applyVendorScopeToQueryBuilder(qb, "vc", scope);
2779
3307
  if (search && typeof search === "string" && search.trim()) {
2780
3308
  const term = `%${search.trim()}%`;
2781
3309
  qb.andWhere(
2782
- "(contact.name ILIKE :term OR contact.email ILIKE :term OR contact.phone ILIKE :term OR contact.company ILIKE :term)",
3310
+ "(customer.name ILIKE :term OR customer.email ILIKE :term OR customer.phone ILIKE :term)",
2783
3311
  { term }
2784
3312
  );
2785
3313
  }
2786
3314
  const [rows, total2] = await qb.getManyAndCount();
2787
3315
  const data2 = rows.map((row) => {
2788
- const contact = row.contact;
3316
+ const customer = row.customer;
2789
3317
  return {
2790
3318
  ...row,
2791
- name: contact?.name ?? null,
2792
- email: contact?.email ?? null,
2793
- phone: contact?.phone ?? null,
2794
- company: contact?.company ?? null,
2795
- contact: contact ? {
2796
- id: contact.id,
2797
- name: contact.name,
2798
- email: contact.email,
2799
- phone: contact.phone,
2800
- company: contact.company
2801
- } : null
3319
+ name: customer?.name ?? null,
3320
+ email: customer?.email ?? null,
3321
+ phone: customer?.phone ?? null,
3322
+ company: customer?.company ?? null
2802
3323
  };
2803
3324
  });
2804
3325
  return json({ total: total2, page, limit, totalPages: Math.ceil(total2 / limit), data: data2 });
@@ -3058,7 +3579,7 @@ function createCrudHandler(dataSource, entityMap, options) {
3058
3579
  persistBody2,
3059
3580
  scopeDiscount,
3060
3581
  repo2,
3061
- body
3582
+ await vendorCreateContext(body)
3062
3583
  );
3063
3584
  if (!vendorIdCheck2.ok) {
3064
3585
  return json({ error: vendorIdCheck2.error }, { status: vendorIdCheck2.status });
@@ -3086,6 +3607,135 @@ function createCrudHandler(dataSource, entityMap, options) {
3086
3607
  });
3087
3608
  return json(reloaded ?? created2, { status: 201 });
3088
3609
  }
3610
+ if (resource === "vendor_customers") {
3611
+ if (!entityMap["customer"]) {
3612
+ return json({ error: "Customer entity not configured" }, { status: 503 });
3613
+ }
3614
+ if (!entityMap["users"]) {
3615
+ return json({ error: "Users entity not configured" }, { status: 503 });
3616
+ }
3617
+ let customerGroupId = null;
3618
+ if (entityMap["user_groups"]) {
3619
+ const userGroupRepo = dataSource.getRepository(entityMap["user_groups"]);
3620
+ const customerGroup = await userGroupRepo.findOne({
3621
+ where: { name: "Customer", deleted: false }
3622
+ });
3623
+ if (!customerGroup) {
3624
+ return json({ error: "User group 'customer' not found" }, { status: 500 });
3625
+ }
3626
+ customerGroupId = Number(customerGroup.id);
3627
+ } else {
3628
+ return json({ error: "user_groups entity not configured" }, { status: 503 });
3629
+ }
3630
+ const name = String(body.name ?? "").trim();
3631
+ const email = String(body.email ?? "").trim();
3632
+ const phone = String(body.phone ?? "").trim();
3633
+ const rawPw = String(body._password ?? "").trim();
3634
+ if (!name) return json({ error: "name is required" }, { status: 400 });
3635
+ if (!email) return json({ error: "email is required" }, { status: 400 });
3636
+ if (!phone) return json({ error: "phone is required" }, { status: 400 });
3637
+ if (!rawPw) return json({ error: "password is required" }, { status: 400 });
3638
+ if (rawPw.length < 6) {
3639
+ return json({ error: "Password must be at least 6 characters" }, { status: 400 });
3640
+ }
3641
+ const customerRepo = dataSource.getRepository(entityMap["customer"]);
3642
+ const userRepo = dataSource.getRepository(entityMap["users"]);
3643
+ const dupCustEmail = await customerRepo.findOne({
3644
+ where: { email, deleted: false }
3645
+ });
3646
+ if (dupCustEmail) {
3647
+ return json({ error: "A customer with this email already exists" }, { status: 409 });
3648
+ }
3649
+ const dupCustPhone = await customerRepo.findOne({
3650
+ where: { phone, deleted: false }
3651
+ });
3652
+ if (dupCustPhone) {
3653
+ return json({ error: "A customer with this phone number already exists" }, { status: 409 });
3654
+ }
3655
+ let userId;
3656
+ const dupUser = await userRepo.findOne({
3657
+ where: { email, deleted: false }
3658
+ });
3659
+ if (dupUser) {
3660
+ userId = Number(dupUser.id);
3661
+ } else {
3662
+ const bcrypt = await import("bcryptjs");
3663
+ const hashedPassword = await bcrypt.hash(rawPw, 10);
3664
+ const savedUser = await userRepo.save(
3665
+ userRepo.create({
3666
+ name,
3667
+ email,
3668
+ phone,
3669
+ password: hashedPassword,
3670
+ groupId: customerGroupId,
3671
+ adminAccess: false,
3672
+ blocked: false
3673
+ })
3674
+ );
3675
+ userId = Number(savedUser.id);
3676
+ }
3677
+ const { _password, ...customerFields } = body;
3678
+ const customerRepo2 = dataSource.getRepository(entityMap["customer"]);
3679
+ const persistCustomer = pickColumnUpdates(customerRepo2, {
3680
+ ...customerFields,
3681
+ name,
3682
+ email,
3683
+ phone,
3684
+ userId
3685
+ });
3686
+ sanitizeBodyForEntity(customerRepo2, persistCustomer);
3687
+ const savedCustomer = await customerRepo2.save(
3688
+ customerRepo2.create(persistCustomer)
3689
+ );
3690
+ if (entityMap["contacts"]) {
3691
+ const contactRepo = dataSource.getRepository(entityMap["contacts"]);
3692
+ const existingContact = await contactRepo.findOne({
3693
+ where: { email, deleted: false }
3694
+ });
3695
+ if (!existingContact) {
3696
+ await contactRepo.save(
3697
+ contactRepo.create({
3698
+ name,
3699
+ email,
3700
+ phone: phone || null,
3701
+ type: "customer"
3702
+ })
3703
+ );
3704
+ } else {
3705
+ const t = existingContact.type;
3706
+ if (t == null || t === "" || String(t).toLowerCase() !== "customer") {
3707
+ await contactRepo.update(
3708
+ existingContact.id,
3709
+ { type: "customer" }
3710
+ );
3711
+ }
3712
+ }
3713
+ }
3714
+ const scope = await resolveScope();
3715
+ let vendorId = null;
3716
+ if (scope.type === "vendor") {
3717
+ vendorId = scope.vendorId;
3718
+ } else if (scope.type === "all") {
3719
+ const n = Number(body.vendorId);
3720
+ if (Number.isFinite(n)) vendorId = n;
3721
+ }
3722
+ if (vendorId == null) {
3723
+ return json({ error: "Vendor scope required to link customer" }, { status: 400 });
3724
+ }
3725
+ const vcRepo = dataSource.getRepository(entity);
3726
+ const existingLink = await vcRepo.findOne({
3727
+ where: { customerId: savedCustomer.id }
3728
+ });
3729
+ if (!existingLink) {
3730
+ await vcRepo.save(
3731
+ vcRepo.create({
3732
+ customerId: savedCustomer.id,
3733
+ vendorId
3734
+ })
3735
+ );
3736
+ }
3737
+ return json(savedCustomer, { status: 201 });
3738
+ }
3089
3739
  if (resource === "media") {
3090
3740
  const b = body;
3091
3741
  const kind = b.kind === "folder" ? "folder" : "file";
@@ -3156,12 +3806,23 @@ function createCrudHandler(dataSource, entityMap, options) {
3156
3806
  if ((resource === "orders" || resource === "payments") && persistBody.contactId != null && entityMap.vendor_customers) {
3157
3807
  const scopeOrder = await resolveScope();
3158
3808
  const vendorId = resolveVendorIdForContactCheck(scopeOrder, persistBody);
3809
+ console.log("[ORDER CREATE] vendor check", {
3810
+ resource,
3811
+ contactId: persistBody.contactId,
3812
+ vendorId,
3813
+ scopeType: scopeOrder.type,
3814
+ persistBodyVendorId: persistBody.vendorId,
3815
+ hasVendorCustomers: !!entityMap.vendor_customers,
3816
+ hasCustomer: !!entityMap.customer,
3817
+ hasContacts: !!entityMap.contacts
3818
+ });
3159
3819
  const contactErr = await assertContactAllowedForVendorOrder(
3160
3820
  dataSource,
3161
3821
  entityMap,
3162
3822
  vendorId ?? NaN,
3163
3823
  Number(persistBody.contactId)
3164
3824
  );
3825
+ console.log("[ORDER CREATE] vendor check result:", contactErr);
3165
3826
  if (contactErr) {
3166
3827
  return json({ error: contactErr }, { status: 400 });
3167
3828
  }
@@ -3250,7 +3911,13 @@ function createCrudHandler(dataSource, entityMap, options) {
3250
3911
  }
3251
3912
  const scopeCreate = await resolveScope();
3252
3913
  await tryAssignSingleVendorOnAdminCreate(resource, scopeCreate, persistBody);
3253
- const vendorIdCheck = requireVendorIdForScopedCreate(resource, persistBody, scopeCreate, repo, body);
3914
+ const vendorIdCheck = requireVendorIdForScopedCreate(
3915
+ resource,
3916
+ persistBody,
3917
+ scopeCreate,
3918
+ repo,
3919
+ await vendorCreateContext(body)
3920
+ );
3254
3921
  if (!vendorIdCheck.ok) {
3255
3922
  return json({ error: vendorIdCheck.error }, { status: vendorIdCheck.status });
3256
3923
  }
@@ -3580,6 +4247,12 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3580
4247
  const { requireAuth, json, requireEntityPermission: reqPerm, getCms, getDeletedByUserId, getVendorScope } = options;
3581
4248
  const syncContactRowToErp = makeContactErpSync(dataSource, entityMap, getCms);
3582
4249
  const resolveScopeById = getVendorScope ?? (async () => ({ type: "all" }));
4250
+ function vendorScopeAccessJson(row, scope, resource) {
4251
+ const access = vendorScopeRowAccess(row, scope, resource);
4252
+ if (access === "ok") return null;
4253
+ if (access === "forbidden") return json({ error: "Forbidden" }, { status: 403 });
4254
+ return json({ message: "Not found" }, { status: 404 });
4255
+ }
3583
4256
  async function authz(req, resource, action) {
3584
4257
  const authError = await requireAuth(req);
3585
4258
  if (authError) return authError;
@@ -3623,9 +4296,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3623
4296
  where: { id: Number(id) },
3624
4297
  relations: ["rules"]
3625
4298
  });
3626
- if (!discount || !rowMatchesVendorScope(discount, scope2, resource)) {
3627
- return json({ message: "Not found" }, { status: 404 });
3628
- }
4299
+ const discountDenied = vendorScopeAccessJson(discount, scope2, resource);
4300
+ if (discountDenied) return discountDenied;
3629
4301
  const flatRules = discount.rules ?? [];
3630
4302
  const nestedRules = nestDiscountRules2(flatRules);
3631
4303
  let storeCurrency = "INR";
@@ -3663,9 +4335,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3663
4335
  where: { id: Number(id), deleted: false },
3664
4336
  relations: ["contact", "billingAddress", "shippingAddress", "items", "items.product", "items.product.collection", "payments"]
3665
4337
  });
3666
- if (!order || !rowMatchesVendorScope(order, scope2, resource)) {
3667
- return json({ message: "Not found" }, { status: 404 });
3668
- }
4338
+ const orderDenied = vendorScopeAccessJson(order, scope2, resource);
4339
+ if (orderDenied) return orderDenied;
3669
4340
  const relatedOrders = await repo.find({
3670
4341
  where: { parentOrderId: Number(id), deleted: false },
3671
4342
  order: { id: "ASC" }
@@ -3700,9 +4371,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3700
4371
  where: { id: Number(id), deleted: false },
3701
4372
  relations: ["order", "order.contact", "contact"]
3702
4373
  });
3703
- if (!payment || !rowMatchesVendorScope(payment, scope2, resource)) {
3704
- return json({ message: "Not found" }, { status: 404 });
3705
- }
4374
+ const paymentDenied = vendorScopeAccessJson(payment, scope2, resource);
4375
+ if (paymentDenied) return paymentDenied;
3706
4376
  const p = payment;
3707
4377
  const order = p.order;
3708
4378
  const orderContact = order?.contact;
@@ -3715,10 +4385,13 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3715
4385
  });
3716
4386
  }
3717
4387
  if (resource === "products") {
4388
+ const scope2 = await resolveScopeById();
3718
4389
  const product = await repo.findOne({
3719
4390
  where: { id: Number(id), deleted: false },
3720
4391
  relations: ["collection", "brand", "category", "attributes", "attributes.attribute"]
3721
4392
  });
4393
+ const productDenied = vendorScopeAccessJson(product, scope2, resource);
4394
+ if (productDenied) return productDenied;
3722
4395
  return product ? json(product) : json({ message: "Not found" }, { status: 404 });
3723
4396
  }
3724
4397
  if (resource === "vendor_customers" && entityMap.contacts) {
@@ -3727,9 +4400,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3727
4400
  where: { id: Number(id) },
3728
4401
  relations: ["contact"]
3729
4402
  });
3730
- if (!row || !rowMatchesVendorScope(row, scope2, resource)) {
3731
- return json({ message: "Not found" }, { status: 404 });
3732
- }
4403
+ const vcDenied = vendorScopeAccessJson(row, scope2, resource);
4404
+ if (vcDenied) return vcDenied;
3733
4405
  const contact = row.contact;
3734
4406
  return json({
3735
4407
  ...row,
@@ -3749,7 +4421,10 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
3749
4421
  const scope = await resolveScopeById();
3750
4422
  const idWhere = entityHasSoftDelete(repo) ? { id: Number(id), deleted: false } : { id: Number(id) };
3751
4423
  const item = await repo.findOne({ where: idWhere });
3752
- if (!item || resourceUsesVendorScope(resource) && !rowMatchesVendorScope(item, scope, resource)) {
4424
+ if (resourceUsesVendorScope(resource)) {
4425
+ const itemDenied = vendorScopeAccessJson(item, scope, resource);
4426
+ if (itemDenied) return itemDenied;
4427
+ } else if (!item) {
3753
4428
  return json({ message: "Not found" }, { status: 404 });
3754
4429
  }
3755
4430
  return json(item);
@@ -4013,9 +4688,8 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
4013
4688
  const existing = await repo.findOne({
4014
4689
  where: { id: numericId }
4015
4690
  });
4016
- if (!existing || !rowMatchesVendorScope(existing, scopePut2, resource)) {
4017
- return json({ message: "Not found" }, { status: 404 });
4018
- }
4691
+ const discountPutDenied = vendorScopeAccessJson(existing, scopePut2, resource);
4692
+ if (discountPutDenied) return discountPutDenied;
4019
4693
  const updatePayload2 = pickColumnUpdates(repo, rawBody);
4020
4694
  delete updatePayload2.vendorId;
4021
4695
  if (!rawBody.isAutomatic && rawBody.couponCode != null && String(rawBody.couponCode).trim() !== "") {
@@ -4049,9 +4723,12 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
4049
4723
  if (resourceUsesVendorScope(resource)) {
4050
4724
  const idWhereCheck = entityHasSoftDelete(repo) ? { id: numericId, deleted: false } : { id: numericId };
4051
4725
  const existingScope = await repo.findOne({ where: idWhereCheck });
4052
- if (!existingScope || !rowMatchesVendorScope(existingScope, scopePut, resource)) {
4053
- return json({ message: "Not found" }, { status: 404 });
4054
- }
4726
+ const scopePutDenied = vendorScopeAccessJson(
4727
+ existingScope,
4728
+ scopePut,
4729
+ resource
4730
+ );
4731
+ if (scopePutDenied) return scopePutDenied;
4055
4732
  }
4056
4733
  const updatePayload = rawBody && typeof rawBody === "object" ? pickColumnUpdates(repo, rawBody) : {};
4057
4734
  if (resourceUsesVendorScope(resource)) {
@@ -4211,11 +4888,17 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
4211
4888
  }
4212
4889
  const repo = dataSource.getRepository(entity);
4213
4890
  const numericId = Number(id);
4891
+ const scopeDelete = await resolveScopeById();
4214
4892
  if (entityHasSoftDelete(repo)) {
4215
4893
  const existing = await repo.findOne({
4216
4894
  where: { id: numericId, deleted: false }
4217
4895
  });
4218
- if (!existing) return json({ message: "Not found" }, { status: 404 });
4896
+ if (resourceUsesVendorScope(resource)) {
4897
+ const deleteDenied = vendorScopeAccessJson(existing, scopeDelete, resource);
4898
+ if (deleteDenied) return deleteDenied;
4899
+ } else if (!existing) {
4900
+ return json({ message: "Not found" }, { status: 404 });
4901
+ }
4219
4902
  if (resource === "contacts") {
4220
4903
  const result2 = await repo.delete(numericId);
4221
4904
  if (result2.affected === 0) return json({ message: "Not found" }, { status: 404 });
@@ -4250,6 +4933,17 @@ function createCrudByIdHandler(dataSource, entityMap, options) {
4250
4933
  await repo.update(numericId, buildSoftDeletePayload(repo.metadata, deletedBy));
4251
4934
  return json({ message: "Deleted successfully" }, { status: 200 });
4252
4935
  }
4936
+ if (resourceUsesVendorScope(resource)) {
4937
+ const existingHard = await repo.findOne({
4938
+ where: { id: numericId }
4939
+ });
4940
+ const hardDeleteDenied = vendorScopeAccessJson(
4941
+ existingHard,
4942
+ scopeDelete,
4943
+ resource
4944
+ );
4945
+ if (hardDeleteDenied) return hardDeleteDenied;
4946
+ }
4253
4947
  const result = await repo.delete(numericId);
4254
4948
  if (result.affected === 0) return json({ message: "Not found" }, { status: 404 });
4255
4949
  return json({ message: "Deleted successfully" }, { status: 200 });
@@ -7889,8 +8583,53 @@ function createAdminRolesHandlers(config) {
7889
8583
  // src/api/vendor-handlers.ts
7890
8584
  var import_typeorm8 = require("typeorm");
7891
8585
  init_vendor_scope();
7892
- init_email_queue();
7893
8586
  init_vendor_invite_status();
8587
+
8588
+ // src/lib/send-vendor-onboard-emails.ts
8589
+ init_email_queue();
8590
+ async function getSettingsGroup(deps, group) {
8591
+ const ds = await deps.getDataSource();
8592
+ const rows = await ds.getRepository(deps.entityMap.configs).find({
8593
+ where: { settings: group, deleted: false }
8594
+ });
8595
+ return Object.fromEntries(
8596
+ rows.map((r) => [r.key, r.value])
8597
+ );
8598
+ }
8599
+ async function sendVendorOnboardEmails(input, deps) {
8600
+ let ownerEmailSent = false;
8601
+ try {
8602
+ const [branding, emailSettings] = await Promise.all([
8603
+ getSettingsGroup(deps, "branding"),
8604
+ getSettingsGroup(deps, "email")
8605
+ ]);
8606
+ const companyDetails = mergeEmailLayoutCompanyDetails(branding, emailSettings);
8607
+ const notifyEmails = parseEmailRecipientsFromConfig(
8608
+ emailSettings.salesTeamEmails ?? emailSettings.salesTeamEmail
8609
+ );
8610
+ const sendToOwner = input.sendToOwner !== false;
8611
+ const ownerEmail = input.ownerEmail?.trim() || "";
8612
+ const cms = await deps.getCms();
8613
+ await queueVendorOnboardEmails(cms, {
8614
+ vendorName: input.vendorName,
8615
+ vendorSlug: input.vendorSlug,
8616
+ ownerName: input.ownerName,
8617
+ ownerEmail,
8618
+ activation: input.activation,
8619
+ inviteLink: input.inviteLink,
8620
+ signInLink: input.signInLink,
8621
+ kind: input.kind ?? "vendor_onboard",
8622
+ notifyEmails,
8623
+ companyDetails,
8624
+ sendToOwner: sendToOwner && Boolean(ownerEmail)
8625
+ });
8626
+ ownerEmailSent = sendToOwner && Boolean(ownerEmail);
8627
+ } catch {
8628
+ }
8629
+ return { ownerEmailSent };
8630
+ }
8631
+
8632
+ // src/api/vendor-handlers.ts
7894
8633
  function slugify(input) {
7895
8634
  return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
7896
8635
  }
@@ -7902,7 +8641,6 @@ function createVendorOnboardHandlers(config) {
7902
8641
  getSessionUser,
7903
8642
  baseUrl,
7904
8643
  getCms,
7905
- getCompanyDetails,
7906
8644
  hashPassword,
7907
8645
  minPasswordLength = 6
7908
8646
  } = config;
@@ -7931,22 +8669,30 @@ function createVendorOnboardHandlers(config) {
7931
8669
  }
7932
8670
  return { user: u, vendorId };
7933
8671
  }
7934
- async function trySendInviteEmail(toEmail, inviteLink, inviteeName) {
7935
- if (!getCms) return;
8672
+ async function trySendVendorOnboardEmails(input) {
8673
+ if (!getCms) return false;
7936
8674
  try {
7937
- const cms = await getCms();
7938
- const companyDetails = getCompanyDetails ? await getCompanyDetails() : {};
7939
- await queueEmail(cms, {
7940
- to: toEmail,
7941
- templateName: "invite",
7942
- ctx: {
7943
- inviteLink,
7944
- email: toEmail,
7945
- inviteeName: inviteeName.trim(),
7946
- companyDetails: companyDetails ?? {}
8675
+ const { ownerEmailSent } = await sendVendorOnboardEmails(
8676
+ {
8677
+ vendorName: input.vendorName,
8678
+ vendorSlug: input.vendorSlug,
8679
+ ownerName: input.ownerName,
8680
+ ownerEmail: input.ownerEmail,
8681
+ activation: input.activation,
8682
+ inviteLink: input.inviteLink,
8683
+ signInLink: `${baseUrl.replace(/\/$/, "")}/admin`,
8684
+ kind: input.kind ?? "vendor_onboard",
8685
+ sendToOwner: input.sendToOwner
8686
+ },
8687
+ {
8688
+ getDataSource: async () => dataSource,
8689
+ entityMap: { configs: entityMap.configs },
8690
+ getCms
7947
8691
  }
7948
- });
8692
+ );
8693
+ return ownerEmailSent;
7949
8694
  } catch {
8695
+ return false;
7950
8696
  }
7951
8697
  }
7952
8698
  return {
@@ -7966,7 +8712,7 @@ function createVendorOnboardHandlers(config) {
7966
8712
  return json({ error: "vendor.name, user.name, and user.email are required" }, { status: 400 });
7967
8713
  }
7968
8714
  const activation = body.activation === "password" ? "password" : "invite";
7969
- const sendInviteEmail = body.sendInviteEmail !== false;
8715
+ const sendOwnerEmail = body.sendOwnerEmail !== false && body.sendInviteEmail !== false;
7970
8716
  let ownerPasswordHash = null;
7971
8717
  if (activation === "password") {
7972
8718
  const plain = body.user?.password?.trim();
@@ -8054,12 +8800,29 @@ function createVendorOnboardHandlers(config) {
8054
8800
  if (activation === "invite") {
8055
8801
  const emailToken = Buffer.from(result.user.email).toString("base64");
8056
8802
  inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
8057
- if (sendInviteEmail) {
8058
- await trySendInviteEmail(result.user.email, inviteLink, result.user.name ?? "");
8059
- emailSent = true;
8060
- }
8061
8803
  }
8062
- const message = activation === "password" ? "Vendor onboarded successfully. Owner can sign in with the password you set." : emailSent ? "Vendor onboarded successfully. Invite email sent." : sendInviteEmail ? "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.";
8804
+ if (sendOwnerEmail) {
8805
+ emailSent = await trySendVendorOnboardEmails({
8806
+ vendorName,
8807
+ vendorSlug: slug,
8808
+ ownerName: userName,
8809
+ ownerEmail: userEmail,
8810
+ activation,
8811
+ inviteLink,
8812
+ sendToOwner: true
8813
+ });
8814
+ } else if (getCms) {
8815
+ await trySendVendorOnboardEmails({
8816
+ vendorName,
8817
+ vendorSlug: slug,
8818
+ ownerName: userName,
8819
+ ownerEmail: userEmail,
8820
+ activation,
8821
+ inviteLink,
8822
+ sendToOwner: false
8823
+ });
8824
+ }
8825
+ 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.";
8063
8826
  return json(
8064
8827
  {
8065
8828
  message,
@@ -8131,7 +8894,7 @@ function createVendorOnboardHandlers(config) {
8131
8894
  const gated = await gateVendorTeam();
8132
8895
  if (gated instanceof Response) return gated;
8133
8896
  const { vendorId, user: actor } = gated;
8134
- if (!entityMap.users || !entityMap.vendor_users || !entityMap.user_groups) {
8897
+ if (!entityMap.users || !entityMap.vendor_users || !entityMap.user_groups || !entityMap.vendors) {
8135
8898
  return json({ error: "Vendor entities not configured" }, { status: 500 });
8136
8899
  }
8137
8900
  try {
@@ -8142,7 +8905,7 @@ function createVendorOnboardHandlers(config) {
8142
8905
  return json({ error: "name and email are required" }, { status: 400 });
8143
8906
  }
8144
8907
  const activation = body.activation === "password" ? "password" : "invite";
8145
- const sendInviteEmail = body.sendInviteEmail !== false;
8908
+ const sendOwnerEmail = body.sendOwnerEmail !== false && body.sendInviteEmail !== false;
8146
8909
  let ownerPasswordHash = null;
8147
8910
  if (activation === "password") {
8148
8911
  const plain = body.user?.password?.trim();
@@ -8228,17 +8991,33 @@ function createVendorOnboardHandlers(config) {
8228
8991
  }
8229
8992
  return newUser;
8230
8993
  });
8994
+ const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
8995
+ where: { id: vendorId, deleted: false }
8996
+ });
8997
+ const vendorName = String(vendorRow?.name ?? "Vendor store");
8998
+ const vendorSlug = String(vendorRow?.slug ?? "");
8231
8999
  let inviteLink;
9000
+ let emailSent = false;
8232
9001
  if (activation === "invite") {
8233
9002
  const emailToken = Buffer.from(result.email).toString("base64");
8234
9003
  inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
8235
- if (sendInviteEmail) {
8236
- await trySendInviteEmail(result.email, inviteLink, result.name ?? "");
8237
- }
9004
+ }
9005
+ if (sendOwnerEmail || getCms) {
9006
+ emailSent = await trySendVendorOnboardEmails({
9007
+ vendorName,
9008
+ vendorSlug,
9009
+ ownerName: userName,
9010
+ ownerEmail: userEmail,
9011
+ activation,
9012
+ inviteLink,
9013
+ kind: "team_invite",
9014
+ sendToOwner: sendOwnerEmail
9015
+ });
8238
9016
  }
8239
9017
  return json(
8240
9018
  {
8241
- message: "Team member added",
9019
+ 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",
9020
+ emailSent,
8242
9021
  user: { id: result.id, name: result.name, email: result.email },
8243
9022
  inviteLink
8244
9023
  },
@@ -8280,7 +9059,7 @@ init_vendor_scope();
8280
9059
 
8281
9060
  // src/lib/hydrate-vendor-session-user.ts
8282
9061
  init_rbac_debug();
8283
- init_permission_entities();
9062
+ init_role_helpers();
8284
9063
  init_vendor_scope();
8285
9064
 
8286
9065
  // src/lib/load-user-vendor-context.ts
@@ -8306,7 +9085,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
8306
9085
  if (!Number.isFinite(id)) {
8307
9086
  const byEmailRows = await dataSource.query(
8308
9087
  `
8309
- SELECT u.id AS id, u."adminAccess" AS "adminAccess", g.name AS "groupName"
9088
+ SELECT u.id AS id, u."adminAccess" AS "adminAccess", u."groupId" AS "groupId", g.name AS "groupName"
8310
9089
  FROM users u
8311
9090
  LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
8312
9091
  WHERE LOWER(TRIM(u.email)) = LOWER(TRIM($1)) AND u.deleted = false
@@ -8326,7 +9105,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
8326
9105
  }
8327
9106
  const rows = await dataSource.query(
8328
9107
  `
8329
- SELECT u."adminAccess" AS "adminAccess", g.name AS "groupName"
9108
+ SELECT u."adminAccess" AS "adminAccess", u."groupId" AS "groupId", g.name AS "groupName"
8330
9109
  FROM users u
8331
9110
  LEFT JOIN user_groups g ON g.id = u."groupId" AND g.deleted = false
8332
9111
  WHERE u.id = $1
@@ -8335,8 +9114,9 @@ async function hydrateVendorSessionUser(dataSource, user) {
8335
9114
  [id]
8336
9115
  );
8337
9116
  const groupName = rows[0]?.groupName ?? user.groupName ?? null;
9117
+ const groupId = rows[0]?.groupId ?? user.groupId ?? void 0;
8338
9118
  const adminAccess = rows[0]?.adminAccess ?? user.adminAccess;
8339
- const isRBACAdmin = user.isRBACAdmin ?? isSuperAdminGroupName(groupName);
9119
+ const isRBACAdmin = user.isRBACAdmin ?? isSuperAdmin({ groupId, groupName, isRBACAdmin: user.isRBACAdmin });
8340
9120
  const ctx = await loadUserVendorContext(dataSource, id, user.activeVendorId);
8341
9121
  const flags = vendorPortalFlagsFromUser({
8342
9122
  email: user.email,
@@ -8347,6 +9127,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
8347
9127
  });
8348
9128
  const hydrated = {
8349
9129
  ...user,
9130
+ groupId,
8350
9131
  groupName: groupName ?? void 0,
8351
9132
  adminAccess,
8352
9133
  isRBACAdmin,
@@ -8985,7 +9766,7 @@ Blog = __decorateClass([
8985
9766
  ], Blog);
8986
9767
 
8987
9768
  // src/entities/contact.entity.ts
8988
- var import_typeorm29 = require("typeorm");
9769
+ var import_typeorm31 = require("typeorm");
8989
9770
 
8990
9771
  // src/entities/form-submission.entity.ts
8991
9772
  var import_typeorm21 = require("typeorm");
@@ -9252,7 +10033,7 @@ Address = __decorateClass([
9252
10033
  ], Address);
9253
10034
 
9254
10035
  // src/entities/order.entity.ts
9255
- var import_typeorm25 = require("typeorm");
10036
+ var import_typeorm27 = require("typeorm");
9256
10037
 
9257
10038
  // src/entities/vendor.entity.ts
9258
10039
  var import_typeorm23 = require("typeorm");
@@ -9412,20 +10193,114 @@ OrderAddresses = __decorateClass([
9412
10193
  (0, import_typeorm24.Entity)("order_addresses")
9413
10194
  ], OrderAddresses);
9414
10195
 
9415
- // src/entities/order.entity.ts
9416
- var Order = class {
10196
+ // src/entities/customer_contacts.entity.ts
10197
+ var import_typeorm26 = require("typeorm");
10198
+
10199
+ // src/entities/customer.entity.ts
10200
+ var import_typeorm25 = require("typeorm");
10201
+ var Customer = class {
9417
10202
  id;
9418
- vendorId;
9419
- orderNumber;
9420
- qrToken;
9421
- orderKind;
9422
- parentOrderId;
9423
- contactId;
9424
- billingAddressId;
9425
- shippingAddressId;
9426
- status;
9427
- subtotal;
9428
- tax;
10203
+ userId;
10204
+ user;
10205
+ name;
10206
+ email;
10207
+ phone;
10208
+ createdAt;
10209
+ updatedAt;
10210
+ deletedAt;
10211
+ deleted;
10212
+ createdBy;
10213
+ updatedBy;
10214
+ deletedBy;
10215
+ };
10216
+ __decorateClass([
10217
+ (0, import_typeorm25.PrimaryGeneratedColumn)()
10218
+ ], Customer.prototype, "id", 2);
10219
+ __decorateClass([
10220
+ (0, import_typeorm25.Column)("int")
10221
+ ], Customer.prototype, "userId", 2);
10222
+ __decorateClass([
10223
+ (0, import_typeorm25.ManyToOne)(() => User, { onDelete: "SET NULL" }),
10224
+ (0, import_typeorm25.JoinColumn)({ name: "userId" })
10225
+ ], Customer.prototype, "user", 2);
10226
+ __decorateClass([
10227
+ (0, import_typeorm25.Column)("varchar")
10228
+ ], Customer.prototype, "name", 2);
10229
+ __decorateClass([
10230
+ (0, import_typeorm25.Column)("varchar", { unique: true })
10231
+ ], Customer.prototype, "email", 2);
10232
+ __decorateClass([
10233
+ (0, import_typeorm25.Column)("varchar", { unique: true })
10234
+ ], Customer.prototype, "phone", 2);
10235
+ __decorateClass([
10236
+ (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10237
+ ], Customer.prototype, "createdAt", 2);
10238
+ __decorateClass([
10239
+ (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10240
+ ], Customer.prototype, "updatedAt", 2);
10241
+ __decorateClass([
10242
+ (0, import_typeorm25.Column)({ type: "timestamp", nullable: true })
10243
+ ], Customer.prototype, "deletedAt", 2);
10244
+ __decorateClass([
10245
+ (0, import_typeorm25.Column)("boolean", { default: false })
10246
+ ], Customer.prototype, "deleted", 2);
10247
+ __decorateClass([
10248
+ (0, import_typeorm25.Column)("int", { nullable: true })
10249
+ ], Customer.prototype, "createdBy", 2);
10250
+ __decorateClass([
10251
+ (0, import_typeorm25.Column)("int", { nullable: true })
10252
+ ], Customer.prototype, "updatedBy", 2);
10253
+ __decorateClass([
10254
+ (0, import_typeorm25.Column)("int", { nullable: true })
10255
+ ], Customer.prototype, "deletedBy", 2);
10256
+ Customer = __decorateClass([
10257
+ (0, import_typeorm25.Entity)("customer")
10258
+ ], Customer);
10259
+
10260
+ // src/entities/customer_contacts.entity.ts
10261
+ var Customer_Contacts = class {
10262
+ id;
10263
+ customerId;
10264
+ customer;
10265
+ contactId;
10266
+ contact;
10267
+ };
10268
+ __decorateClass([
10269
+ (0, import_typeorm26.PrimaryGeneratedColumn)()
10270
+ ], Customer_Contacts.prototype, "id", 2);
10271
+ __decorateClass([
10272
+ (0, import_typeorm26.Column)("int")
10273
+ ], Customer_Contacts.prototype, "customerId", 2);
10274
+ __decorateClass([
10275
+ (0, import_typeorm26.ManyToOne)(() => Customer, { onDelete: "CASCADE" }),
10276
+ (0, import_typeorm26.JoinColumn)({ name: "customerId" })
10277
+ ], Customer_Contacts.prototype, "customer", 2);
10278
+ __decorateClass([
10279
+ (0, import_typeorm26.Column)("int")
10280
+ ], Customer_Contacts.prototype, "contactId", 2);
10281
+ __decorateClass([
10282
+ (0, import_typeorm26.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
10283
+ (0, import_typeorm26.JoinColumn)({ name: "contactId" })
10284
+ ], Customer_Contacts.prototype, "contact", 2);
10285
+ Customer_Contacts = __decorateClass([
10286
+ (0, import_typeorm26.Entity)("customer_contacts")
10287
+ ], Customer_Contacts);
10288
+
10289
+ // src/entities/order.entity.ts
10290
+ var Order = class {
10291
+ id;
10292
+ vendorId;
10293
+ orderNumber;
10294
+ qrToken;
10295
+ orderKind;
10296
+ parentOrderId;
10297
+ contactId;
10298
+ customerContactId;
10299
+ billingAddressId;
10300
+ shippingAddressId;
10301
+ status;
10302
+ subtotal;
10303
+ tax;
9429
10304
  discount;
9430
10305
  total;
9431
10306
  currency;
@@ -9441,116 +10316,124 @@ var Order = class {
9441
10316
  parentOrder;
9442
10317
  children;
9443
10318
  contact;
10319
+ customerContact;
9444
10320
  billingAddress;
9445
10321
  shippingAddress;
9446
10322
  items;
9447
10323
  payments;
9448
10324
  };
9449
10325
  __decorateClass([
9450
- (0, import_typeorm25.PrimaryGeneratedColumn)()
10326
+ (0, import_typeorm27.PrimaryGeneratedColumn)()
9451
10327
  ], Order.prototype, "id", 2);
9452
10328
  __decorateClass([
9453
- (0, import_typeorm25.Column)("int")
10329
+ (0, import_typeorm27.Column)("int")
9454
10330
  ], Order.prototype, "vendorId", 2);
9455
10331
  __decorateClass([
9456
- (0, import_typeorm25.Column)("varchar")
10332
+ (0, import_typeorm27.Column)("varchar")
9457
10333
  ], Order.prototype, "orderNumber", 2);
9458
10334
  __decorateClass([
9459
- (0, import_typeorm25.Column)("varchar", { unique: true, nullable: true })
10335
+ (0, import_typeorm27.Column)("varchar", { unique: true, nullable: true })
9460
10336
  ], Order.prototype, "qrToken", 2);
9461
10337
  __decorateClass([
9462
- (0, import_typeorm25.Column)("varchar", { default: "sale" })
10338
+ (0, import_typeorm27.Column)("varchar", { default: "sale" })
9463
10339
  ], Order.prototype, "orderKind", 2);
9464
10340
  __decorateClass([
9465
- (0, import_typeorm25.Column)("int", { nullable: true })
10341
+ (0, import_typeorm27.Column)("int", { nullable: true })
9466
10342
  ], Order.prototype, "parentOrderId", 2);
9467
10343
  __decorateClass([
9468
- (0, import_typeorm25.Column)("int")
10344
+ (0, import_typeorm27.Column)("int")
9469
10345
  ], Order.prototype, "contactId", 2);
9470
10346
  __decorateClass([
9471
- (0, import_typeorm25.Column)("int", { nullable: true })
10347
+ (0, import_typeorm27.Column)("int", { nullable: true })
10348
+ ], Order.prototype, "customerContactId", 2);
10349
+ __decorateClass([
10350
+ (0, import_typeorm27.Column)("int", { nullable: true })
9472
10351
  ], Order.prototype, "billingAddressId", 2);
9473
10352
  __decorateClass([
9474
- (0, import_typeorm25.Column)("int", { nullable: true })
10353
+ (0, import_typeorm27.Column)("int", { nullable: true })
9475
10354
  ], Order.prototype, "shippingAddressId", 2);
9476
10355
  __decorateClass([
9477
- (0, import_typeorm25.Column)("varchar", { default: "pending" })
10356
+ (0, import_typeorm27.Column)("varchar", { default: "pending" })
9478
10357
  ], Order.prototype, "status", 2);
9479
10358
  __decorateClass([
9480
- (0, import_typeorm25.Column)("decimal", { precision: 12, scale: 2, default: 0 })
10359
+ (0, import_typeorm27.Column)("decimal", { precision: 12, scale: 2, default: 0 })
9481
10360
  ], Order.prototype, "subtotal", 2);
9482
10361
  __decorateClass([
9483
- (0, import_typeorm25.Column)("decimal", { precision: 12, scale: 2, default: 0 })
10362
+ (0, import_typeorm27.Column)("decimal", { precision: 12, scale: 2, default: 0 })
9484
10363
  ], Order.prototype, "tax", 2);
9485
10364
  __decorateClass([
9486
- (0, import_typeorm25.Column)("decimal", { precision: 12, scale: 2, default: 0 })
10365
+ (0, import_typeorm27.Column)("decimal", { precision: 12, scale: 2, default: 0 })
9487
10366
  ], Order.prototype, "discount", 2);
9488
10367
  __decorateClass([
9489
- (0, import_typeorm25.Column)("decimal", { precision: 12, scale: 2, default: 0 })
10368
+ (0, import_typeorm27.Column)("decimal", { precision: 12, scale: 2, default: 0 })
9490
10369
  ], Order.prototype, "total", 2);
9491
10370
  __decorateClass([
9492
- (0, import_typeorm25.Column)("varchar", { default: "INR" })
10371
+ (0, import_typeorm27.Column)("varchar", { default: "INR" })
9493
10372
  ], Order.prototype, "currency", 2);
9494
10373
  __decorateClass([
9495
- (0, import_typeorm25.Column)("jsonb", { nullable: true })
10374
+ (0, import_typeorm27.Column)("jsonb", { nullable: true })
9496
10375
  ], Order.prototype, "metadata", 2);
9497
10376
  __decorateClass([
9498
- (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10377
+ (0, import_typeorm27.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9499
10378
  ], Order.prototype, "createdAt", 2);
9500
10379
  __decorateClass([
9501
- (0, import_typeorm25.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10380
+ (0, import_typeorm27.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9502
10381
  ], Order.prototype, "updatedAt", 2);
9503
10382
  __decorateClass([
9504
- (0, import_typeorm25.Column)({ type: "timestamp", nullable: true })
10383
+ (0, import_typeorm27.Column)({ type: "timestamp", nullable: true })
9505
10384
  ], Order.prototype, "deletedAt", 2);
9506
10385
  __decorateClass([
9507
- (0, import_typeorm25.Column)("boolean", { default: false })
10386
+ (0, import_typeorm27.Column)("boolean", { default: false })
9508
10387
  ], Order.prototype, "deleted", 2);
9509
10388
  __decorateClass([
9510
- (0, import_typeorm25.Column)("int", { nullable: true })
10389
+ (0, import_typeorm27.Column)("int", { nullable: true })
9511
10390
  ], Order.prototype, "createdBy", 2);
9512
10391
  __decorateClass([
9513
- (0, import_typeorm25.Column)("int", { nullable: true })
10392
+ (0, import_typeorm27.Column)("int", { nullable: true })
9514
10393
  ], Order.prototype, "updatedBy", 2);
9515
10394
  __decorateClass([
9516
- (0, import_typeorm25.Column)("int", { nullable: true })
10395
+ (0, import_typeorm27.Column)("int", { nullable: true })
9517
10396
  ], Order.prototype, "deletedBy", 2);
9518
10397
  __decorateClass([
9519
- (0, import_typeorm25.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
9520
- (0, import_typeorm25.JoinColumn)({ name: "vendorId" })
10398
+ (0, import_typeorm27.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10399
+ (0, import_typeorm27.JoinColumn)({ name: "vendorId" })
9521
10400
  ], Order.prototype, "vendor", 2);
9522
10401
  __decorateClass([
9523
- (0, import_typeorm25.ManyToOne)(() => Order, (o) => o.children, { nullable: true, onDelete: "SET NULL" }),
9524
- (0, import_typeorm25.JoinColumn)({ name: "parentOrderId" })
10402
+ (0, import_typeorm27.ManyToOne)(() => Order, (o) => o.children, { nullable: true, onDelete: "SET NULL" }),
10403
+ (0, import_typeorm27.JoinColumn)({ name: "parentOrderId" })
9525
10404
  ], Order.prototype, "parentOrder", 2);
9526
10405
  __decorateClass([
9527
- (0, import_typeorm25.OneToMany)(() => Order, (o) => o.parentOrder)
10406
+ (0, import_typeorm27.OneToMany)(() => Order, (o) => o.parentOrder)
9528
10407
  ], Order.prototype, "children", 2);
9529
10408
  __decorateClass([
9530
- (0, import_typeorm25.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
9531
- (0, import_typeorm25.JoinColumn)({ name: "contactId" })
10409
+ (0, import_typeorm27.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
10410
+ (0, import_typeorm27.JoinColumn)({ name: "contactId" })
9532
10411
  ], Order.prototype, "contact", 2);
9533
10412
  __decorateClass([
9534
- (0, import_typeorm25.ManyToOne)(() => OrderAddresses, { onDelete: "SET NULL" }),
9535
- (0, import_typeorm25.JoinColumn)({ name: "billingAddressId" })
10413
+ (0, import_typeorm27.ManyToOne)(() => Customer_Contacts, { onDelete: "SET NULL" }),
10414
+ (0, import_typeorm27.JoinColumn)({ name: "customerContactId" })
10415
+ ], Order.prototype, "customerContact", 2);
10416
+ __decorateClass([
10417
+ (0, import_typeorm27.ManyToOne)(() => OrderAddresses, { onDelete: "SET NULL" }),
10418
+ (0, import_typeorm27.JoinColumn)({ name: "billingAddressId" })
9536
10419
  ], Order.prototype, "billingAddress", 2);
9537
10420
  __decorateClass([
9538
- (0, import_typeorm25.ManyToOne)(() => OrderAddresses, { onDelete: "SET NULL" }),
9539
- (0, import_typeorm25.JoinColumn)({ name: "shippingAddressId" })
10421
+ (0, import_typeorm27.ManyToOne)(() => OrderAddresses, { onDelete: "SET NULL" }),
10422
+ (0, import_typeorm27.JoinColumn)({ name: "shippingAddressId" })
9540
10423
  ], Order.prototype, "shippingAddress", 2);
9541
10424
  __decorateClass([
9542
- (0, import_typeorm25.OneToMany)("OrderItem", "order")
10425
+ (0, import_typeorm27.OneToMany)("OrderItem", "order")
9543
10426
  ], Order.prototype, "items", 2);
9544
10427
  __decorateClass([
9545
- (0, import_typeorm25.OneToMany)("Payment", "order")
10428
+ (0, import_typeorm27.OneToMany)("Payment", "order")
9546
10429
  ], Order.prototype, "payments", 2);
9547
10430
  Order = __decorateClass([
9548
- (0, import_typeorm25.Entity)("orders"),
9549
- (0, import_typeorm25.Unique)("UQ_orders_vendor_orderNumber", ["vendorId", "orderNumber"])
10431
+ (0, import_typeorm27.Entity)("orders"),
10432
+ (0, import_typeorm27.Unique)("UQ_orders_vendor_orderNumber", ["vendorId", "orderNumber"])
9550
10433
  ], Order);
9551
10434
 
9552
10435
  // src/entities/payment.entity.ts
9553
- var import_typeorm26 = require("typeorm");
10436
+ var import_typeorm28 = require("typeorm");
9554
10437
  var Payment = class {
9555
10438
  id;
9556
10439
  vendorId;
@@ -9575,80 +10458,80 @@ var Payment = class {
9575
10458
  contact;
9576
10459
  };
9577
10460
  __decorateClass([
9578
- (0, import_typeorm26.PrimaryGeneratedColumn)()
10461
+ (0, import_typeorm28.PrimaryGeneratedColumn)()
9579
10462
  ], Payment.prototype, "id", 2);
9580
10463
  __decorateClass([
9581
- (0, import_typeorm26.Column)("int")
10464
+ (0, import_typeorm28.Column)("int")
9582
10465
  ], Payment.prototype, "vendorId", 2);
9583
10466
  __decorateClass([
9584
- (0, import_typeorm26.Column)("int")
10467
+ (0, import_typeorm28.Column)("int")
9585
10468
  ], Payment.prototype, "orderId", 2);
9586
10469
  __decorateClass([
9587
- (0, import_typeorm26.Column)("int", { nullable: true })
10470
+ (0, import_typeorm28.Column)("int", { nullable: true })
9588
10471
  ], Payment.prototype, "contactId", 2);
9589
10472
  __decorateClass([
9590
- (0, import_typeorm26.Column)("decimal", { precision: 12, scale: 2 })
10473
+ (0, import_typeorm28.Column)("decimal", { precision: 12, scale: 2 })
9591
10474
  ], Payment.prototype, "amount", 2);
9592
10475
  __decorateClass([
9593
- (0, import_typeorm26.Column)("varchar", { default: "INR" })
10476
+ (0, import_typeorm28.Column)("varchar", { default: "INR" })
9594
10477
  ], Payment.prototype, "currency", 2);
9595
10478
  __decorateClass([
9596
- (0, import_typeorm26.Column)("varchar", { default: "pending" })
10479
+ (0, import_typeorm28.Column)("varchar", { default: "pending" })
9597
10480
  ], Payment.prototype, "status", 2);
9598
10481
  __decorateClass([
9599
- (0, import_typeorm26.Column)("varchar", { nullable: true })
10482
+ (0, import_typeorm28.Column)("varchar", { nullable: true })
9600
10483
  ], Payment.prototype, "method", 2);
9601
10484
  __decorateClass([
9602
- (0, import_typeorm26.Column)("varchar", { nullable: true })
10485
+ (0, import_typeorm28.Column)("varchar", { nullable: true })
9603
10486
  ], Payment.prototype, "externalReference", 2);
9604
10487
  __decorateClass([
9605
- (0, import_typeorm26.Column)("jsonb", { nullable: true })
10488
+ (0, import_typeorm28.Column)("jsonb", { nullable: true })
9606
10489
  ], Payment.prototype, "metadata", 2);
9607
10490
  __decorateClass([
9608
- (0, import_typeorm26.Column)({ type: "timestamp", nullable: true })
10491
+ (0, import_typeorm28.Column)({ type: "timestamp", nullable: true })
9609
10492
  ], Payment.prototype, "paidAt", 2);
9610
10493
  __decorateClass([
9611
- (0, import_typeorm26.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10494
+ (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9612
10495
  ], Payment.prototype, "createdAt", 2);
9613
10496
  __decorateClass([
9614
- (0, import_typeorm26.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10497
+ (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9615
10498
  ], Payment.prototype, "updatedAt", 2);
9616
10499
  __decorateClass([
9617
- (0, import_typeorm26.Column)({ type: "timestamp", nullable: true })
10500
+ (0, import_typeorm28.Column)({ type: "timestamp", nullable: true })
9618
10501
  ], Payment.prototype, "deletedAt", 2);
9619
10502
  __decorateClass([
9620
- (0, import_typeorm26.Column)("boolean", { default: false })
10503
+ (0, import_typeorm28.Column)("boolean", { default: false })
9621
10504
  ], Payment.prototype, "deleted", 2);
9622
10505
  __decorateClass([
9623
- (0, import_typeorm26.Column)("int", { nullable: true })
10506
+ (0, import_typeorm28.Column)("int", { nullable: true })
9624
10507
  ], Payment.prototype, "createdBy", 2);
9625
10508
  __decorateClass([
9626
- (0, import_typeorm26.Column)("int", { nullable: true })
10509
+ (0, import_typeorm28.Column)("int", { nullable: true })
9627
10510
  ], Payment.prototype, "updatedBy", 2);
9628
10511
  __decorateClass([
9629
- (0, import_typeorm26.Column)("int", { nullable: true })
10512
+ (0, import_typeorm28.Column)("int", { nullable: true })
9630
10513
  ], Payment.prototype, "deletedBy", 2);
9631
10514
  __decorateClass([
9632
- (0, import_typeorm26.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
9633
- (0, import_typeorm26.JoinColumn)({ name: "vendorId" })
10515
+ (0, import_typeorm28.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10516
+ (0, import_typeorm28.JoinColumn)({ name: "vendorId" })
9634
10517
  ], Payment.prototype, "vendor", 2);
9635
10518
  __decorateClass([
9636
- (0, import_typeorm26.ManyToOne)(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
9637
- (0, import_typeorm26.JoinColumn)({ name: "orderId" })
10519
+ (0, import_typeorm28.ManyToOne)(() => Order, (o) => o.payments, { onDelete: "CASCADE" }),
10520
+ (0, import_typeorm28.JoinColumn)({ name: "orderId" })
9638
10521
  ], Payment.prototype, "order", 2);
9639
10522
  __decorateClass([
9640
- (0, import_typeorm26.ManyToOne)(() => Contact, { onDelete: "SET NULL" }),
9641
- (0, import_typeorm26.JoinColumn)({ name: "contactId" })
10523
+ (0, import_typeorm28.ManyToOne)(() => Contact, { onDelete: "SET NULL" }),
10524
+ (0, import_typeorm28.JoinColumn)({ name: "contactId" })
9642
10525
  ], Payment.prototype, "contact", 2);
9643
10526
  Payment = __decorateClass([
9644
- (0, import_typeorm26.Entity)("payments")
10527
+ (0, import_typeorm28.Entity)("payments")
9645
10528
  ], Payment);
9646
10529
 
9647
10530
  // src/entities/chat-conversation.entity.ts
9648
- var import_typeorm28 = require("typeorm");
10531
+ var import_typeorm30 = require("typeorm");
9649
10532
 
9650
10533
  // src/entities/chat-message.entity.ts
9651
- var import_typeorm27 = require("typeorm");
10534
+ var import_typeorm29 = require("typeorm");
9652
10535
  var ChatMessage = class {
9653
10536
  id;
9654
10537
  conversationId;
@@ -9658,26 +10541,26 @@ var ChatMessage = class {
9658
10541
  conversation;
9659
10542
  };
9660
10543
  __decorateClass([
9661
- (0, import_typeorm27.PrimaryGeneratedColumn)()
10544
+ (0, import_typeorm29.PrimaryGeneratedColumn)()
9662
10545
  ], ChatMessage.prototype, "id", 2);
9663
10546
  __decorateClass([
9664
- (0, import_typeorm27.Column)("int")
10547
+ (0, import_typeorm29.Column)("int")
9665
10548
  ], ChatMessage.prototype, "conversationId", 2);
9666
10549
  __decorateClass([
9667
- (0, import_typeorm27.Column)("varchar")
10550
+ (0, import_typeorm29.Column)("varchar")
9668
10551
  ], ChatMessage.prototype, "role", 2);
9669
10552
  __decorateClass([
9670
- (0, import_typeorm27.Column)("text")
10553
+ (0, import_typeorm29.Column)("text")
9671
10554
  ], ChatMessage.prototype, "content", 2);
9672
10555
  __decorateClass([
9673
- (0, import_typeorm27.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10556
+ (0, import_typeorm29.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9674
10557
  ], ChatMessage.prototype, "createdAt", 2);
9675
10558
  __decorateClass([
9676
- (0, import_typeorm27.ManyToOne)(() => ChatConversation, (c) => c.messages, { onDelete: "CASCADE" }),
9677
- (0, import_typeorm27.JoinColumn)({ name: "conversationId" })
10559
+ (0, import_typeorm29.ManyToOne)(() => ChatConversation, (c) => c.messages, { onDelete: "CASCADE" }),
10560
+ (0, import_typeorm29.JoinColumn)({ name: "conversationId" })
9678
10561
  ], ChatMessage.prototype, "conversation", 2);
9679
10562
  ChatMessage = __decorateClass([
9680
- (0, import_typeorm27.Entity)("chat_messages")
10563
+ (0, import_typeorm29.Entity)("chat_messages")
9681
10564
  ], ChatMessage);
9682
10565
 
9683
10566
  // src/entities/chat-conversation.entity.ts
@@ -9691,29 +10574,29 @@ var ChatConversation = class {
9691
10574
  messages;
9692
10575
  };
9693
10576
  __decorateClass([
9694
- (0, import_typeorm28.PrimaryGeneratedColumn)()
10577
+ (0, import_typeorm30.PrimaryGeneratedColumn)()
9695
10578
  ], ChatConversation.prototype, "id", 2);
9696
10579
  __decorateClass([
9697
- (0, import_typeorm28.Column)("int")
10580
+ (0, import_typeorm30.Column)("int")
9698
10581
  ], ChatConversation.prototype, "contactId", 2);
9699
10582
  __decorateClass([
9700
- (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10583
+ (0, import_typeorm30.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9701
10584
  ], ChatConversation.prototype, "createdAt", 2);
9702
10585
  __decorateClass([
9703
- (0, import_typeorm28.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10586
+ (0, import_typeorm30.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9704
10587
  ], ChatConversation.prototype, "updatedAt", 2);
9705
10588
  __decorateClass([
9706
- (0, import_typeorm28.Column)({ type: "timestamp", nullable: true })
10589
+ (0, import_typeorm30.Column)({ type: "timestamp", nullable: true })
9707
10590
  ], ChatConversation.prototype, "leadEmailSentAt", 2);
9708
10591
  __decorateClass([
9709
- (0, import_typeorm28.ManyToOne)(() => Contact, (c) => c.chatConversations, { onDelete: "CASCADE" }),
9710
- (0, import_typeorm28.JoinColumn)({ name: "contactId" })
10592
+ (0, import_typeorm30.ManyToOne)(() => Contact, (c) => c.chatConversations, { onDelete: "CASCADE" }),
10593
+ (0, import_typeorm30.JoinColumn)({ name: "contactId" })
9711
10594
  ], ChatConversation.prototype, "contact", 2);
9712
10595
  __decorateClass([
9713
- (0, import_typeorm28.OneToMany)(() => ChatMessage, (m) => m.conversation)
10596
+ (0, import_typeorm30.OneToMany)(() => ChatMessage, (m) => m.conversation)
9714
10597
  ], ChatConversation.prototype, "messages", 2);
9715
10598
  ChatConversation = __decorateClass([
9716
- (0, import_typeorm28.Entity)("chat_conversations")
10599
+ (0, import_typeorm30.Entity)("chat_conversations")
9717
10600
  ], ChatConversation);
9718
10601
 
9719
10602
  // src/entities/contact.entity.ts
@@ -9743,81 +10626,81 @@ var Contact = class {
9743
10626
  orderAddresses;
9744
10627
  };
9745
10628
  __decorateClass([
9746
- (0, import_typeorm29.PrimaryGeneratedColumn)()
10629
+ (0, import_typeorm31.PrimaryGeneratedColumn)()
9747
10630
  ], Contact.prototype, "id", 2);
9748
10631
  __decorateClass([
9749
- (0, import_typeorm29.Column)("varchar")
10632
+ (0, import_typeorm31.Column)("varchar")
9750
10633
  ], Contact.prototype, "name", 2);
9751
10634
  __decorateClass([
9752
- (0, import_typeorm29.Column)("varchar", { unique: true })
10635
+ (0, import_typeorm31.Column)("varchar", { unique: true })
9753
10636
  ], Contact.prototype, "email", 2);
9754
10637
  __decorateClass([
9755
- (0, import_typeorm29.Column)("varchar", { nullable: true })
10638
+ (0, import_typeorm31.Column)("varchar", { nullable: true })
9756
10639
  ], Contact.prototype, "phone", 2);
9757
10640
  __decorateClass([
9758
- (0, import_typeorm29.Column)("varchar", { nullable: true })
10641
+ (0, import_typeorm31.Column)("varchar", { nullable: true })
9759
10642
  ], Contact.prototype, "type", 2);
9760
10643
  __decorateClass([
9761
- (0, import_typeorm29.Column)("varchar", { nullable: true })
10644
+ (0, import_typeorm31.Column)("varchar", { nullable: true })
9762
10645
  ], Contact.prototype, "company", 2);
9763
10646
  __decorateClass([
9764
- (0, import_typeorm29.Column)("varchar", { nullable: true })
10647
+ (0, import_typeorm31.Column)("varchar", { nullable: true })
9765
10648
  ], Contact.prototype, "taxId", 2);
9766
10649
  __decorateClass([
9767
- (0, import_typeorm29.Column)("text", { nullable: true })
10650
+ (0, import_typeorm31.Column)("text", { nullable: true })
9768
10651
  ], Contact.prototype, "notes", 2);
9769
10652
  __decorateClass([
9770
- (0, import_typeorm29.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10653
+ (0, import_typeorm31.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9771
10654
  ], Contact.prototype, "createdAt", 2);
9772
10655
  __decorateClass([
9773
- (0, import_typeorm29.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10656
+ (0, import_typeorm31.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9774
10657
  ], Contact.prototype, "updatedAt", 2);
9775
10658
  __decorateClass([
9776
- (0, import_typeorm29.Column)({ type: "timestamp", nullable: true })
10659
+ (0, import_typeorm31.Column)({ type: "timestamp", nullable: true })
9777
10660
  ], Contact.prototype, "deletedAt", 2);
9778
10661
  __decorateClass([
9779
- (0, import_typeorm29.Column)("boolean", { default: false })
10662
+ (0, import_typeorm31.Column)("boolean", { default: false })
9780
10663
  ], Contact.prototype, "deleted", 2);
9781
10664
  __decorateClass([
9782
- (0, import_typeorm29.Column)("int", { nullable: true })
10665
+ (0, import_typeorm31.Column)("int", { nullable: true })
9783
10666
  ], Contact.prototype, "createdBy", 2);
9784
10667
  __decorateClass([
9785
- (0, import_typeorm29.Column)("int", { nullable: true })
10668
+ (0, import_typeorm31.Column)("int", { nullable: true })
9786
10669
  ], Contact.prototype, "updatedBy", 2);
9787
10670
  __decorateClass([
9788
- (0, import_typeorm29.Column)("int", { nullable: true })
10671
+ (0, import_typeorm31.Column)("int", { nullable: true })
9789
10672
  ], Contact.prototype, "deletedBy", 2);
9790
10673
  __decorateClass([
9791
- (0, import_typeorm29.Column)("int", { nullable: true })
10674
+ (0, import_typeorm31.Column)("int", { nullable: true })
9792
10675
  ], Contact.prototype, "userId", 2);
9793
10676
  __decorateClass([
9794
- (0, import_typeorm29.ManyToOne)(() => User, { onDelete: "SET NULL" }),
9795
- (0, import_typeorm29.JoinColumn)({ name: "userId" })
10677
+ (0, import_typeorm31.ManyToOne)(() => User, { onDelete: "SET NULL" }),
10678
+ (0, import_typeorm31.JoinColumn)({ name: "userId" })
9796
10679
  ], Contact.prototype, "user", 2);
9797
10680
  __decorateClass([
9798
- (0, import_typeorm29.OneToMany)(() => FormSubmission, (fs2) => fs2.contact)
10681
+ (0, import_typeorm31.OneToMany)(() => FormSubmission, (fs2) => fs2.contact)
9799
10682
  ], Contact.prototype, "form_submissions", 2);
9800
10683
  __decorateClass([
9801
- (0, import_typeorm29.OneToMany)(() => Address, (a) => a.contact)
10684
+ (0, import_typeorm31.OneToMany)(() => Address, (a) => a.contact)
9802
10685
  ], Contact.prototype, "addresses", 2);
9803
10686
  __decorateClass([
9804
- (0, import_typeorm29.OneToMany)(() => Order, (o) => o.contact)
10687
+ (0, import_typeorm31.OneToMany)(() => Order, (o) => o.contact)
9805
10688
  ], Contact.prototype, "orders", 2);
9806
10689
  __decorateClass([
9807
- (0, import_typeorm29.OneToMany)(() => Payment, (p) => p.contact)
10690
+ (0, import_typeorm31.OneToMany)(() => Payment, (p) => p.contact)
9808
10691
  ], Contact.prototype, "payments", 2);
9809
10692
  __decorateClass([
9810
- (0, import_typeorm29.OneToMany)(() => ChatConversation, (c) => c.contact)
10693
+ (0, import_typeorm31.OneToMany)(() => ChatConversation, (c) => c.contact)
9811
10694
  ], Contact.prototype, "chatConversations", 2);
9812
10695
  __decorateClass([
9813
- (0, import_typeorm29.OneToMany)(() => OrderAddresses, (orderAddresses) => orderAddresses.contact)
10696
+ (0, import_typeorm31.OneToMany)(() => OrderAddresses, (orderAddresses) => orderAddresses.contact)
9814
10697
  ], Contact.prototype, "orderAddresses", 2);
9815
10698
  Contact = __decorateClass([
9816
- (0, import_typeorm29.Entity)("contacts")
10699
+ (0, import_typeorm31.Entity)("contacts")
9817
10700
  ], Contact);
9818
10701
 
9819
10702
  // src/entities/config.entity.ts
9820
- var import_typeorm30 = require("typeorm");
10703
+ var import_typeorm32 = require("typeorm");
9821
10704
  var Config = class {
9822
10705
  id;
9823
10706
  settings;
@@ -9834,51 +10717,51 @@ var Config = class {
9834
10717
  deletedBy;
9835
10718
  };
9836
10719
  __decorateClass([
9837
- (0, import_typeorm30.PrimaryGeneratedColumn)()
10720
+ (0, import_typeorm32.PrimaryGeneratedColumn)()
9838
10721
  ], Config.prototype, "id", 2);
9839
10722
  __decorateClass([
9840
- (0, import_typeorm30.Column)("varchar")
10723
+ (0, import_typeorm32.Column)("varchar")
9841
10724
  ], Config.prototype, "settings", 2);
9842
10725
  __decorateClass([
9843
- (0, import_typeorm30.Column)("varchar")
10726
+ (0, import_typeorm32.Column)("varchar")
9844
10727
  ], Config.prototype, "key", 2);
9845
10728
  __decorateClass([
9846
- (0, import_typeorm30.Column)("varchar")
10729
+ (0, import_typeorm32.Column)("varchar")
9847
10730
  ], Config.prototype, "value", 2);
9848
10731
  __decorateClass([
9849
- (0, import_typeorm30.Column)("varchar", { default: "private" })
10732
+ (0, import_typeorm32.Column)("varchar", { default: "private" })
9850
10733
  ], Config.prototype, "type", 2);
9851
10734
  __decorateClass([
9852
- (0, import_typeorm30.Column)("boolean", { default: false })
10735
+ (0, import_typeorm32.Column)("boolean", { default: false })
9853
10736
  ], Config.prototype, "encrypted", 2);
9854
10737
  __decorateClass([
9855
- (0, import_typeorm30.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10738
+ (0, import_typeorm32.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9856
10739
  ], Config.prototype, "createdAt", 2);
9857
10740
  __decorateClass([
9858
- (0, import_typeorm30.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10741
+ (0, import_typeorm32.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9859
10742
  ], Config.prototype, "updatedAt", 2);
9860
10743
  __decorateClass([
9861
- (0, import_typeorm30.Column)({ type: "timestamp", nullable: true })
10744
+ (0, import_typeorm32.Column)({ type: "timestamp", nullable: true })
9862
10745
  ], Config.prototype, "deletedAt", 2);
9863
10746
  __decorateClass([
9864
- (0, import_typeorm30.Column)("boolean", { default: false })
10747
+ (0, import_typeorm32.Column)("boolean", { default: false })
9865
10748
  ], Config.prototype, "deleted", 2);
9866
10749
  __decorateClass([
9867
- (0, import_typeorm30.Column)("int", { nullable: true })
10750
+ (0, import_typeorm32.Column)("int", { nullable: true })
9868
10751
  ], Config.prototype, "createdBy", 2);
9869
10752
  __decorateClass([
9870
- (0, import_typeorm30.Column)("int", { nullable: true })
10753
+ (0, import_typeorm32.Column)("int", { nullable: true })
9871
10754
  ], Config.prototype, "updatedBy", 2);
9872
10755
  __decorateClass([
9873
- (0, import_typeorm30.Column)("int", { nullable: true })
10756
+ (0, import_typeorm32.Column)("int", { nullable: true })
9874
10757
  ], Config.prototype, "deletedBy", 2);
9875
10758
  Config = __decorateClass([
9876
- (0, import_typeorm30.Entity)("configs"),
9877
- (0, import_typeorm30.Unique)(["settings", "key"])
10759
+ (0, import_typeorm32.Entity)("configs"),
10760
+ (0, import_typeorm32.Unique)(["settings", "key"])
9878
10761
  ], Config);
9879
10762
 
9880
10763
  // src/entities/message-template.entity.ts
9881
- var import_typeorm31 = require("typeorm");
10764
+ var import_typeorm33 = require("typeorm");
9882
10765
  var MessageTemplate = class {
9883
10766
  id;
9884
10767
  channel;
@@ -9898,59 +10781,59 @@ var MessageTemplate = class {
9898
10781
  deletedBy;
9899
10782
  };
9900
10783
  __decorateClass([
9901
- (0, import_typeorm31.PrimaryGeneratedColumn)()
10784
+ (0, import_typeorm33.PrimaryGeneratedColumn)()
9902
10785
  ], MessageTemplate.prototype, "id", 2);
9903
10786
  __decorateClass([
9904
- (0, import_typeorm31.Column)("varchar")
10787
+ (0, import_typeorm33.Column)("varchar")
9905
10788
  ], MessageTemplate.prototype, "channel", 2);
9906
10789
  __decorateClass([
9907
- (0, import_typeorm31.Column)("varchar", { name: "template_key" })
10790
+ (0, import_typeorm33.Column)("varchar", { name: "template_key" })
9908
10791
  ], MessageTemplate.prototype, "templateKey", 2);
9909
10792
  __decorateClass([
9910
- (0, import_typeorm31.Column)("varchar", { nullable: true })
10793
+ (0, import_typeorm33.Column)("varchar", { nullable: true })
9911
10794
  ], MessageTemplate.prototype, "name", 2);
9912
10795
  __decorateClass([
9913
- (0, import_typeorm31.Column)("varchar", { nullable: true })
10796
+ (0, import_typeorm33.Column)("varchar", { nullable: true })
9914
10797
  ], MessageTemplate.prototype, "subject", 2);
9915
10798
  __decorateClass([
9916
- (0, import_typeorm31.Column)("text", { default: "" })
10799
+ (0, import_typeorm33.Column)("text", { default: "" })
9917
10800
  ], MessageTemplate.prototype, "body", 2);
9918
10801
  __decorateClass([
9919
- (0, import_typeorm31.Column)("varchar", { name: "external_template_ref", nullable: true })
10802
+ (0, import_typeorm33.Column)("varchar", { name: "external_template_ref", nullable: true })
9920
10803
  ], MessageTemplate.prototype, "externalTemplateRef", 2);
9921
10804
  __decorateClass([
9922
- (0, import_typeorm31.Column)({ type: "jsonb", nullable: true })
10805
+ (0, import_typeorm33.Column)({ type: "jsonb", nullable: true })
9923
10806
  ], MessageTemplate.prototype, "providerMeta", 2);
9924
10807
  __decorateClass([
9925
- (0, import_typeorm31.Column)("boolean", { default: true })
10808
+ (0, import_typeorm33.Column)("boolean", { default: true })
9926
10809
  ], MessageTemplate.prototype, "enabled", 2);
9927
10810
  __decorateClass([
9928
- (0, import_typeorm31.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10811
+ (0, import_typeorm33.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9929
10812
  ], MessageTemplate.prototype, "createdAt", 2);
9930
10813
  __decorateClass([
9931
- (0, import_typeorm31.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10814
+ (0, import_typeorm33.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
9932
10815
  ], MessageTemplate.prototype, "updatedAt", 2);
9933
10816
  __decorateClass([
9934
- (0, import_typeorm31.Column)({ type: "timestamp", nullable: true })
10817
+ (0, import_typeorm33.Column)({ type: "timestamp", nullable: true })
9935
10818
  ], MessageTemplate.prototype, "deletedAt", 2);
9936
10819
  __decorateClass([
9937
- (0, import_typeorm31.Column)("boolean", { default: false })
10820
+ (0, import_typeorm33.Column)("boolean", { default: false })
9938
10821
  ], MessageTemplate.prototype, "deleted", 2);
9939
10822
  __decorateClass([
9940
- (0, import_typeorm31.Column)("int", { nullable: true })
10823
+ (0, import_typeorm33.Column)("int", { nullable: true })
9941
10824
  ], MessageTemplate.prototype, "createdBy", 2);
9942
10825
  __decorateClass([
9943
- (0, import_typeorm31.Column)("int", { nullable: true })
10826
+ (0, import_typeorm33.Column)("int", { nullable: true })
9944
10827
  ], MessageTemplate.prototype, "updatedBy", 2);
9945
10828
  __decorateClass([
9946
- (0, import_typeorm31.Column)("int", { nullable: true })
10829
+ (0, import_typeorm33.Column)("int", { nullable: true })
9947
10830
  ], MessageTemplate.prototype, "deletedBy", 2);
9948
10831
  MessageTemplate = __decorateClass([
9949
- (0, import_typeorm31.Entity)("message_templates")
10832
+ (0, import_typeorm33.Entity)("message_templates")
9950
10833
  ], MessageTemplate);
9951
10834
 
9952
10835
  // src/entities/media.entity.ts
9953
- var import_typeorm32 = require("typeorm");
10836
+ var import_typeorm34 = require("typeorm");
9954
10837
  var Media = class {
9955
10838
  id;
9956
10839
  kind;
@@ -9969,57 +10852,57 @@ var Media = class {
9969
10852
  deleted;
9970
10853
  };
9971
10854
  __decorateClass([
9972
- (0, import_typeorm32.PrimaryGeneratedColumn)()
10855
+ (0, import_typeorm34.PrimaryGeneratedColumn)()
9973
10856
  ], Media.prototype, "id", 2);
9974
10857
  __decorateClass([
9975
- (0, import_typeorm32.Column)({ type: "varchar", length: 16, default: "file" })
10858
+ (0, import_typeorm34.Column)({ type: "varchar", length: 16, default: "file" })
9976
10859
  ], Media.prototype, "kind", 2);
9977
10860
  __decorateClass([
9978
- (0, import_typeorm32.Column)({ type: "int", nullable: true })
10861
+ (0, import_typeorm34.Column)({ type: "int", nullable: true })
9979
10862
  ], Media.prototype, "parentId", 2);
9980
10863
  __decorateClass([
9981
- (0, import_typeorm32.ManyToOne)(() => Media, (m) => m.children, { onDelete: "CASCADE" }),
9982
- (0, import_typeorm32.JoinColumn)({ name: "parentId" })
10864
+ (0, import_typeorm34.ManyToOne)(() => Media, (m) => m.children, { onDelete: "CASCADE" }),
10865
+ (0, import_typeorm34.JoinColumn)({ name: "parentId" })
9983
10866
  ], Media.prototype, "parent", 2);
9984
10867
  __decorateClass([
9985
- (0, import_typeorm32.OneToMany)(() => Media, (m) => m.parent)
10868
+ (0, import_typeorm34.OneToMany)(() => Media, (m) => m.parent)
9986
10869
  ], Media.prototype, "children", 2);
9987
10870
  __decorateClass([
9988
- (0, import_typeorm32.Column)("varchar")
10871
+ (0, import_typeorm34.Column)("varchar")
9989
10872
  ], Media.prototype, "filename", 2);
9990
10873
  __decorateClass([
9991
- (0, import_typeorm32.Column)("varchar", { nullable: true })
10874
+ (0, import_typeorm34.Column)("varchar", { nullable: true })
9992
10875
  ], Media.prototype, "url", 2);
9993
10876
  __decorateClass([
9994
- (0, import_typeorm32.Column)("varchar", { nullable: true })
10877
+ (0, import_typeorm34.Column)("varchar", { nullable: true })
9995
10878
  ], Media.prototype, "mimeType", 2);
9996
10879
  __decorateClass([
9997
- (0, import_typeorm32.Column)("int", { default: 0 })
10880
+ (0, import_typeorm34.Column)("int", { default: 0 })
9998
10881
  ], Media.prototype, "size", 2);
9999
10882
  __decorateClass([
10000
- (0, import_typeorm32.Column)("varchar", { nullable: true })
10883
+ (0, import_typeorm34.Column)("varchar", { nullable: true })
10001
10884
  ], Media.prototype, "alt", 2);
10002
10885
  __decorateClass([
10003
- (0, import_typeorm32.Column)("boolean", { default: false })
10886
+ (0, import_typeorm34.Column)("boolean", { default: false })
10004
10887
  ], Media.prototype, "isPublic", 2);
10005
10888
  __decorateClass([
10006
- (0, import_typeorm32.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10889
+ (0, import_typeorm34.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10007
10890
  ], Media.prototype, "createdAt", 2);
10008
10891
  __decorateClass([
10009
- (0, import_typeorm32.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10892
+ (0, import_typeorm34.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10010
10893
  ], Media.prototype, "updatedAt", 2);
10011
10894
  __decorateClass([
10012
- (0, import_typeorm32.Column)({ type: "timestamp", nullable: true })
10895
+ (0, import_typeorm34.Column)({ type: "timestamp", nullable: true })
10013
10896
  ], Media.prototype, "deletedAt", 2);
10014
10897
  __decorateClass([
10015
- (0, import_typeorm32.Column)("boolean", { default: false })
10898
+ (0, import_typeorm34.Column)("boolean", { default: false })
10016
10899
  ], Media.prototype, "deleted", 2);
10017
10900
  Media = __decorateClass([
10018
- (0, import_typeorm32.Entity)("media")
10901
+ (0, import_typeorm34.Entity)("media")
10019
10902
  ], Media);
10020
10903
 
10021
10904
  // src/entities/page.entity.ts
10022
- var import_typeorm33 = require("typeorm");
10905
+ var import_typeorm35 = require("typeorm");
10023
10906
  var Page = class {
10024
10907
  id;
10025
10908
  title;
@@ -10040,64 +10923,64 @@ var Page = class {
10040
10923
  deletedBy;
10041
10924
  };
10042
10925
  __decorateClass([
10043
- (0, import_typeorm33.PrimaryGeneratedColumn)()
10926
+ (0, import_typeorm35.PrimaryGeneratedColumn)()
10044
10927
  ], Page.prototype, "id", 2);
10045
10928
  __decorateClass([
10046
- (0, import_typeorm33.Column)("varchar")
10929
+ (0, import_typeorm35.Column)("varchar")
10047
10930
  ], Page.prototype, "title", 2);
10048
10931
  __decorateClass([
10049
- (0, import_typeorm33.Column)("varchar", { unique: true })
10932
+ (0, import_typeorm35.Column)("varchar", { unique: true })
10050
10933
  ], Page.prototype, "slug", 2);
10051
10934
  __decorateClass([
10052
- (0, import_typeorm33.Column)({ type: "jsonb", default: {} })
10935
+ (0, import_typeorm35.Column)({ type: "jsonb", default: {} })
10053
10936
  ], Page.prototype, "content", 2);
10054
10937
  __decorateClass([
10055
- (0, import_typeorm33.Column)("boolean", { default: false })
10938
+ (0, import_typeorm35.Column)("boolean", { default: false })
10056
10939
  ], Page.prototype, "published", 2);
10057
10940
  __decorateClass([
10058
- (0, import_typeorm33.Column)("varchar", { default: "default" })
10941
+ (0, import_typeorm35.Column)("varchar", { default: "default" })
10059
10942
  ], Page.prototype, "theme", 2);
10060
10943
  __decorateClass([
10061
- (0, import_typeorm33.Column)("int", { nullable: true })
10944
+ (0, import_typeorm35.Column)("int", { nullable: true })
10062
10945
  ], Page.prototype, "parentId", 2);
10063
10946
  __decorateClass([
10064
- (0, import_typeorm33.ManyToOne)(() => Page, { onDelete: "SET NULL" }),
10065
- (0, import_typeorm33.JoinColumn)({ name: "parentId" })
10947
+ (0, import_typeorm35.ManyToOne)(() => Page, { onDelete: "SET NULL" }),
10948
+ (0, import_typeorm35.JoinColumn)({ name: "parentId" })
10066
10949
  ], Page.prototype, "parent", 2);
10067
10950
  __decorateClass([
10068
- (0, import_typeorm33.Column)("int", { nullable: true })
10951
+ (0, import_typeorm35.Column)("int", { nullable: true })
10069
10952
  ], Page.prototype, "seoId", 2);
10070
10953
  __decorateClass([
10071
- (0, import_typeorm33.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
10072
- (0, import_typeorm33.JoinColumn)({ name: "seoId" })
10954
+ (0, import_typeorm35.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
10955
+ (0, import_typeorm35.JoinColumn)({ name: "seoId" })
10073
10956
  ], Page.prototype, "seo", 2);
10074
10957
  __decorateClass([
10075
- (0, import_typeorm33.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10958
+ (0, import_typeorm35.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10076
10959
  ], Page.prototype, "createdAt", 2);
10077
10960
  __decorateClass([
10078
- (0, import_typeorm33.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10961
+ (0, import_typeorm35.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10079
10962
  ], Page.prototype, "updatedAt", 2);
10080
10963
  __decorateClass([
10081
- (0, import_typeorm33.Column)({ type: "timestamp", nullable: true })
10964
+ (0, import_typeorm35.Column)({ type: "timestamp", nullable: true })
10082
10965
  ], Page.prototype, "deletedAt", 2);
10083
10966
  __decorateClass([
10084
- (0, import_typeorm33.Column)("boolean", { default: false })
10967
+ (0, import_typeorm35.Column)("boolean", { default: false })
10085
10968
  ], Page.prototype, "deleted", 2);
10086
10969
  __decorateClass([
10087
- (0, import_typeorm33.Column)("int", { nullable: true })
10970
+ (0, import_typeorm35.Column)("int", { nullable: true })
10088
10971
  ], Page.prototype, "createdBy", 2);
10089
10972
  __decorateClass([
10090
- (0, import_typeorm33.Column)("int", { nullable: true })
10973
+ (0, import_typeorm35.Column)("int", { nullable: true })
10091
10974
  ], Page.prototype, "updatedBy", 2);
10092
10975
  __decorateClass([
10093
- (0, import_typeorm33.Column)("int", { nullable: true })
10976
+ (0, import_typeorm35.Column)("int", { nullable: true })
10094
10977
  ], Page.prototype, "deletedBy", 2);
10095
10978
  Page = __decorateClass([
10096
- (0, import_typeorm33.Entity)("pages")
10979
+ (0, import_typeorm35.Entity)("pages")
10097
10980
  ], Page);
10098
10981
 
10099
10982
  // src/entities/product-category.entity.ts
10100
- var import_typeorm34 = require("typeorm");
10983
+ var import_typeorm36 = require("typeorm");
10101
10984
  var ProductCategory = class {
10102
10985
  id;
10103
10986
  vendorId;
@@ -10123,83 +11006,83 @@ var ProductCategory = class {
10123
11006
  collections;
10124
11007
  };
10125
11008
  __decorateClass([
10126
- (0, import_typeorm34.PrimaryGeneratedColumn)()
11009
+ (0, import_typeorm36.PrimaryGeneratedColumn)()
10127
11010
  ], ProductCategory.prototype, "id", 2);
10128
11011
  __decorateClass([
10129
- (0, import_typeorm34.Column)("int")
11012
+ (0, import_typeorm36.Column)("int")
10130
11013
  ], ProductCategory.prototype, "vendorId", 2);
10131
11014
  __decorateClass([
10132
- (0, import_typeorm34.Column)("varchar")
11015
+ (0, import_typeorm36.Column)("varchar")
10133
11016
  ], ProductCategory.prototype, "name", 2);
10134
11017
  __decorateClass([
10135
- (0, import_typeorm34.Column)("varchar")
11018
+ (0, import_typeorm36.Column)("varchar")
10136
11019
  ], ProductCategory.prototype, "slug", 2);
10137
11020
  __decorateClass([
10138
- (0, import_typeorm34.Column)("int", { nullable: true })
11021
+ (0, import_typeorm36.Column)("int", { nullable: true })
10139
11022
  ], ProductCategory.prototype, "parentId", 2);
10140
11023
  __decorateClass([
10141
- (0, import_typeorm34.Column)("varchar", { nullable: true })
11024
+ (0, import_typeorm36.Column)("varchar", { nullable: true })
10142
11025
  ], ProductCategory.prototype, "image", 2);
10143
11026
  __decorateClass([
10144
- (0, import_typeorm34.Column)("text", { nullable: true })
11027
+ (0, import_typeorm36.Column)("text", { nullable: true })
10145
11028
  ], ProductCategory.prototype, "description", 2);
10146
11029
  __decorateClass([
10147
- (0, import_typeorm34.Column)("jsonb", { nullable: true })
11030
+ (0, import_typeorm36.Column)("jsonb", { nullable: true })
10148
11031
  ], ProductCategory.prototype, "metadata", 2);
10149
11032
  __decorateClass([
10150
- (0, import_typeorm34.Column)("boolean", { default: true })
11033
+ (0, import_typeorm36.Column)("boolean", { default: true })
10151
11034
  ], ProductCategory.prototype, "active", 2);
10152
11035
  __decorateClass([
10153
- (0, import_typeorm34.Column)("int", { default: 0 })
11036
+ (0, import_typeorm36.Column)("int", { default: 0 })
10154
11037
  ], ProductCategory.prototype, "sortOrder", 2);
10155
11038
  __decorateClass([
10156
- (0, import_typeorm34.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11039
+ (0, import_typeorm36.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10157
11040
  ], ProductCategory.prototype, "createdAt", 2);
10158
11041
  __decorateClass([
10159
- (0, import_typeorm34.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11042
+ (0, import_typeorm36.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10160
11043
  ], ProductCategory.prototype, "updatedAt", 2);
10161
11044
  __decorateClass([
10162
- (0, import_typeorm34.Column)({ type: "timestamp", nullable: true })
11045
+ (0, import_typeorm36.Column)({ type: "timestamp", nullable: true })
10163
11046
  ], ProductCategory.prototype, "deletedAt", 2);
10164
11047
  __decorateClass([
10165
- (0, import_typeorm34.Column)("boolean", { default: false })
11048
+ (0, import_typeorm36.Column)("boolean", { default: false })
10166
11049
  ], ProductCategory.prototype, "deleted", 2);
10167
11050
  __decorateClass([
10168
- (0, import_typeorm34.Column)("int", { nullable: true })
11051
+ (0, import_typeorm36.Column)("int", { nullable: true })
10169
11052
  ], ProductCategory.prototype, "createdBy", 2);
10170
11053
  __decorateClass([
10171
- (0, import_typeorm34.Column)("int", { nullable: true })
11054
+ (0, import_typeorm36.Column)("int", { nullable: true })
10172
11055
  ], ProductCategory.prototype, "updatedBy", 2);
10173
11056
  __decorateClass([
10174
- (0, import_typeorm34.Column)("int", { nullable: true })
11057
+ (0, import_typeorm36.Column)("int", { nullable: true })
10175
11058
  ], ProductCategory.prototype, "deletedBy", 2);
10176
11059
  __decorateClass([
10177
- (0, import_typeorm34.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10178
- (0, import_typeorm34.JoinColumn)({ name: "vendorId" })
11060
+ (0, import_typeorm36.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11061
+ (0, import_typeorm36.JoinColumn)({ name: "vendorId" })
10179
11062
  ], ProductCategory.prototype, "vendor", 2);
10180
11063
  __decorateClass([
10181
- (0, import_typeorm34.ManyToOne)(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
10182
- (0, import_typeorm34.JoinColumn)({ name: "parentId" })
11064
+ (0, import_typeorm36.ManyToOne)(() => ProductCategory, (c) => c.children, { onDelete: "SET NULL" }),
11065
+ (0, import_typeorm36.JoinColumn)({ name: "parentId" })
10183
11066
  ], ProductCategory.prototype, "parent", 2);
10184
11067
  __decorateClass([
10185
- (0, import_typeorm34.OneToMany)(() => ProductCategory, (c) => c.parent)
11068
+ (0, import_typeorm36.OneToMany)(() => ProductCategory, (c) => c.parent)
10186
11069
  ], ProductCategory.prototype, "children", 2);
10187
11070
  __decorateClass([
10188
- (0, import_typeorm34.OneToMany)("Product", "category")
11071
+ (0, import_typeorm36.OneToMany)("Product", "category")
10189
11072
  ], ProductCategory.prototype, "products", 2);
10190
11073
  __decorateClass([
10191
- (0, import_typeorm34.OneToMany)("Collection", "category")
11074
+ (0, import_typeorm36.OneToMany)("Collection", "category")
10192
11075
  ], ProductCategory.prototype, "collections", 2);
10193
11076
  ProductCategory = __decorateClass([
10194
- (0, import_typeorm34.Entity)("product_categories"),
10195
- (0, import_typeorm34.Unique)("UQ_product_categories_vendor_slug", ["vendorId", "slug"])
11077
+ (0, import_typeorm36.Entity)("product_categories"),
11078
+ (0, import_typeorm36.Unique)("UQ_product_categories_vendor_slug", ["vendorId", "slug"])
10196
11079
  ], ProductCategory);
10197
11080
 
10198
11081
  // src/entities/collection.entity.ts
10199
- var import_typeorm36 = require("typeorm");
11082
+ var import_typeorm38 = require("typeorm");
10200
11083
 
10201
11084
  // src/entities/brand.entity.ts
10202
- var import_typeorm35 = require("typeorm");
11085
+ var import_typeorm37 = require("typeorm");
10203
11086
  var Brand = class {
10204
11087
  id;
10205
11088
  vendorId;
@@ -10224,73 +11107,73 @@ var Brand = class {
10224
11107
  collections;
10225
11108
  };
10226
11109
  __decorateClass([
10227
- (0, import_typeorm35.PrimaryGeneratedColumn)()
11110
+ (0, import_typeorm37.PrimaryGeneratedColumn)()
10228
11111
  ], Brand.prototype, "id", 2);
10229
11112
  __decorateClass([
10230
- (0, import_typeorm35.Column)("int")
11113
+ (0, import_typeorm37.Column)("int")
10231
11114
  ], Brand.prototype, "vendorId", 2);
10232
11115
  __decorateClass([
10233
- (0, import_typeorm35.Column)("varchar")
11116
+ (0, import_typeorm37.Column)("varchar")
10234
11117
  ], Brand.prototype, "name", 2);
10235
11118
  __decorateClass([
10236
- (0, import_typeorm35.Column)("varchar")
11119
+ (0, import_typeorm37.Column)("varchar")
10237
11120
  ], Brand.prototype, "slug", 2);
10238
11121
  __decorateClass([
10239
- (0, import_typeorm35.Column)("varchar", { nullable: true })
11122
+ (0, import_typeorm37.Column)("varchar", { nullable: true })
10240
11123
  ], Brand.prototype, "logo", 2);
10241
11124
  __decorateClass([
10242
- (0, import_typeorm35.Column)("jsonb", { nullable: true })
11125
+ (0, import_typeorm37.Column)("jsonb", { nullable: true })
10243
11126
  ], Brand.prototype, "metadata", 2);
10244
11127
  __decorateClass([
10245
- (0, import_typeorm35.Column)("text", { nullable: true })
11128
+ (0, import_typeorm37.Column)("text", { nullable: true })
10246
11129
  ], Brand.prototype, "description", 2);
10247
11130
  __decorateClass([
10248
- (0, import_typeorm35.Column)("boolean", { default: true })
11131
+ (0, import_typeorm37.Column)("boolean", { default: true })
10249
11132
  ], Brand.prototype, "active", 2);
10250
11133
  __decorateClass([
10251
- (0, import_typeorm35.Column)("int", { default: 0 })
11134
+ (0, import_typeorm37.Column)("int", { default: 0 })
10252
11135
  ], Brand.prototype, "sortOrder", 2);
10253
11136
  __decorateClass([
10254
- (0, import_typeorm35.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11137
+ (0, import_typeorm37.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10255
11138
  ], Brand.prototype, "createdAt", 2);
10256
11139
  __decorateClass([
10257
- (0, import_typeorm35.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11140
+ (0, import_typeorm37.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10258
11141
  ], Brand.prototype, "updatedAt", 2);
10259
11142
  __decorateClass([
10260
- (0, import_typeorm35.Column)({ type: "timestamp", nullable: true })
11143
+ (0, import_typeorm37.Column)({ type: "timestamp", nullable: true })
10261
11144
  ], Brand.prototype, "deletedAt", 2);
10262
11145
  __decorateClass([
10263
- (0, import_typeorm35.Column)("boolean", { default: false })
11146
+ (0, import_typeorm37.Column)("boolean", { default: false })
10264
11147
  ], Brand.prototype, "deleted", 2);
10265
11148
  __decorateClass([
10266
- (0, import_typeorm35.Column)("int", { nullable: true })
11149
+ (0, import_typeorm37.Column)("int", { nullable: true })
10267
11150
  ], Brand.prototype, "createdBy", 2);
10268
11151
  __decorateClass([
10269
- (0, import_typeorm35.Column)("int", { nullable: true })
11152
+ (0, import_typeorm37.Column)("int", { nullable: true })
10270
11153
  ], Brand.prototype, "updatedBy", 2);
10271
11154
  __decorateClass([
10272
- (0, import_typeorm35.Column)("int", { nullable: true })
11155
+ (0, import_typeorm37.Column)("int", { nullable: true })
10273
11156
  ], Brand.prototype, "deletedBy", 2);
10274
11157
  __decorateClass([
10275
- (0, import_typeorm35.Column)("int", { nullable: true })
11158
+ (0, import_typeorm37.Column)("int", { nullable: true })
10276
11159
  ], Brand.prototype, "seoId", 2);
10277
11160
  __decorateClass([
10278
- (0, import_typeorm35.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10279
- (0, import_typeorm35.JoinColumn)({ name: "vendorId" })
11161
+ (0, import_typeorm37.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11162
+ (0, import_typeorm37.JoinColumn)({ name: "vendorId" })
10280
11163
  ], Brand.prototype, "vendor", 2);
10281
11164
  __decorateClass([
10282
- (0, import_typeorm35.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
10283
- (0, import_typeorm35.JoinColumn)({ name: "seoId" })
11165
+ (0, import_typeorm37.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
11166
+ (0, import_typeorm37.JoinColumn)({ name: "seoId" })
10284
11167
  ], Brand.prototype, "seo", 2);
10285
11168
  __decorateClass([
10286
- (0, import_typeorm35.OneToMany)("Product", "brand")
11169
+ (0, import_typeorm37.OneToMany)("Product", "brand")
10287
11170
  ], Brand.prototype, "products", 2);
10288
11171
  __decorateClass([
10289
- (0, import_typeorm35.OneToMany)("Collection", "brand")
11172
+ (0, import_typeorm37.OneToMany)("Collection", "brand")
10290
11173
  ], Brand.prototype, "collections", 2);
10291
11174
  Brand = __decorateClass([
10292
- (0, import_typeorm35.Entity)("brands"),
10293
- (0, import_typeorm35.Unique)("UQ_brands_vendor_slug", ["vendorId", "slug"])
11175
+ (0, import_typeorm37.Entity)("brands"),
11176
+ (0, import_typeorm37.Unique)("UQ_brands_vendor_slug", ["vendorId", "slug"])
10294
11177
  ], Brand);
10295
11178
 
10296
11179
  // src/entities/collection.entity.ts
@@ -10323,94 +11206,94 @@ var Collection = class {
10323
11206
  products;
10324
11207
  };
10325
11208
  __decorateClass([
10326
- (0, import_typeorm36.PrimaryGeneratedColumn)()
11209
+ (0, import_typeorm38.PrimaryGeneratedColumn)()
10327
11210
  ], Collection.prototype, "id", 2);
10328
11211
  __decorateClass([
10329
- (0, import_typeorm36.Column)("int")
11212
+ (0, import_typeorm38.Column)("int")
10330
11213
  ], Collection.prototype, "vendorId", 2);
10331
11214
  __decorateClass([
10332
- (0, import_typeorm36.Column)("int", { nullable: true })
11215
+ (0, import_typeorm38.Column)("int", { nullable: true })
10333
11216
  ], Collection.prototype, "categoryId", 2);
10334
11217
  __decorateClass([
10335
- (0, import_typeorm36.Column)("int", { nullable: true })
11218
+ (0, import_typeorm38.Column)("int", { nullable: true })
10336
11219
  ], Collection.prototype, "brandId", 2);
10337
11220
  __decorateClass([
10338
- (0, import_typeorm36.Column)("varchar")
11221
+ (0, import_typeorm38.Column)("varchar")
10339
11222
  ], Collection.prototype, "name", 2);
10340
11223
  __decorateClass([
10341
- (0, import_typeorm36.Column)("varchar")
11224
+ (0, import_typeorm38.Column)("varchar")
10342
11225
  ], Collection.prototype, "slug", 2);
10343
11226
  __decorateClass([
10344
- (0, import_typeorm36.Column)("varchar", { nullable: true })
11227
+ (0, import_typeorm38.Column)("varchar", { nullable: true })
10345
11228
  ], Collection.prototype, "hsn", 2);
10346
11229
  __decorateClass([
10347
- (0, import_typeorm36.Column)("text", { nullable: true })
11230
+ (0, import_typeorm38.Column)("text", { nullable: true })
10348
11231
  ], Collection.prototype, "description", 2);
10349
11232
  __decorateClass([
10350
- (0, import_typeorm36.Column)("varchar", { nullable: true })
11233
+ (0, import_typeorm38.Column)("varchar", { nullable: true })
10351
11234
  ], Collection.prototype, "image", 2);
10352
11235
  __decorateClass([
10353
- (0, import_typeorm36.Column)("jsonb", { nullable: true })
11236
+ (0, import_typeorm38.Column)("jsonb", { nullable: true })
10354
11237
  ], Collection.prototype, "metadata", 2);
10355
11238
  __decorateClass([
10356
- (0, import_typeorm36.Column)("jsonb", { nullable: true })
11239
+ (0, import_typeorm38.Column)("jsonb", { nullable: true })
10357
11240
  ], Collection.prototype, "variants", 2);
10358
11241
  __decorateClass([
10359
- (0, import_typeorm36.Column)("boolean", { default: true })
11242
+ (0, import_typeorm38.Column)("boolean", { default: true })
10360
11243
  ], Collection.prototype, "active", 2);
10361
11244
  __decorateClass([
10362
- (0, import_typeorm36.Column)("int", { default: 0 })
11245
+ (0, import_typeorm38.Column)("int", { default: 0 })
10363
11246
  ], Collection.prototype, "sortOrder", 2);
10364
11247
  __decorateClass([
10365
- (0, import_typeorm36.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11248
+ (0, import_typeorm38.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10366
11249
  ], Collection.prototype, "createdAt", 2);
10367
11250
  __decorateClass([
10368
- (0, import_typeorm36.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11251
+ (0, import_typeorm38.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10369
11252
  ], Collection.prototype, "updatedAt", 2);
10370
11253
  __decorateClass([
10371
- (0, import_typeorm36.Column)({ type: "timestamp", nullable: true })
11254
+ (0, import_typeorm38.Column)({ type: "timestamp", nullable: true })
10372
11255
  ], Collection.prototype, "deletedAt", 2);
10373
11256
  __decorateClass([
10374
- (0, import_typeorm36.Column)("boolean", { default: false })
11257
+ (0, import_typeorm38.Column)("boolean", { default: false })
10375
11258
  ], Collection.prototype, "deleted", 2);
10376
11259
  __decorateClass([
10377
- (0, import_typeorm36.Column)("int", { nullable: true })
11260
+ (0, import_typeorm38.Column)("int", { nullable: true })
10378
11261
  ], Collection.prototype, "createdBy", 2);
10379
11262
  __decorateClass([
10380
- (0, import_typeorm36.Column)("int", { nullable: true })
11263
+ (0, import_typeorm38.Column)("int", { nullable: true })
10381
11264
  ], Collection.prototype, "updatedBy", 2);
10382
11265
  __decorateClass([
10383
- (0, import_typeorm36.Column)("int", { nullable: true })
11266
+ (0, import_typeorm38.Column)("int", { nullable: true })
10384
11267
  ], Collection.prototype, "deletedBy", 2);
10385
11268
  __decorateClass([
10386
- (0, import_typeorm36.Column)("int", { nullable: true })
11269
+ (0, import_typeorm38.Column)("int", { nullable: true })
10387
11270
  ], Collection.prototype, "seoId", 2);
10388
11271
  __decorateClass([
10389
- (0, import_typeorm36.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10390
- (0, import_typeorm36.JoinColumn)({ name: "vendorId" })
11272
+ (0, import_typeorm38.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11273
+ (0, import_typeorm38.JoinColumn)({ name: "vendorId" })
10391
11274
  ], Collection.prototype, "vendor", 2);
10392
11275
  __decorateClass([
10393
- (0, import_typeorm36.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
10394
- (0, import_typeorm36.JoinColumn)({ name: "seoId" })
11276
+ (0, import_typeorm38.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
11277
+ (0, import_typeorm38.JoinColumn)({ name: "seoId" })
10395
11278
  ], Collection.prototype, "seo", 2);
10396
11279
  __decorateClass([
10397
- (0, import_typeorm36.ManyToOne)(() => ProductCategory, (c) => c.collections, { onDelete: "SET NULL" }),
10398
- (0, import_typeorm36.JoinColumn)({ name: "categoryId" })
11280
+ (0, import_typeorm38.ManyToOne)(() => ProductCategory, (c) => c.collections, { onDelete: "SET NULL" }),
11281
+ (0, import_typeorm38.JoinColumn)({ name: "categoryId" })
10399
11282
  ], Collection.prototype, "category", 2);
10400
11283
  __decorateClass([
10401
- (0, import_typeorm36.ManyToOne)(() => Brand, (b) => b.collections, { onDelete: "SET NULL" }),
10402
- (0, import_typeorm36.JoinColumn)({ name: "brandId" })
11284
+ (0, import_typeorm38.ManyToOne)(() => Brand, (b) => b.collections, { onDelete: "SET NULL" }),
11285
+ (0, import_typeorm38.JoinColumn)({ name: "brandId" })
10403
11286
  ], Collection.prototype, "brand", 2);
10404
11287
  __decorateClass([
10405
- (0, import_typeorm36.OneToMany)("Product", "collection")
11288
+ (0, import_typeorm38.OneToMany)("Product", "collection")
10406
11289
  ], Collection.prototype, "products", 2);
10407
11290
  Collection = __decorateClass([
10408
- (0, import_typeorm36.Entity)("collections"),
10409
- (0, import_typeorm36.Unique)("UQ_collections_vendor_slug", ["vendorId", "slug"])
11291
+ (0, import_typeorm38.Entity)("collections"),
11292
+ (0, import_typeorm38.Unique)("UQ_collections_vendor_slug", ["vendorId", "slug"])
10410
11293
  ], Collection);
10411
11294
 
10412
11295
  // src/entities/product.entity.ts
10413
- var import_typeorm37 = require("typeorm");
11296
+ var import_typeorm39 = require("typeorm");
10414
11297
  var Product = class {
10415
11298
  id;
10416
11299
  vendorId;
@@ -10446,113 +11329,113 @@ var Product = class {
10446
11329
  taxes;
10447
11330
  };
10448
11331
  __decorateClass([
10449
- (0, import_typeorm37.PrimaryGeneratedColumn)()
11332
+ (0, import_typeorm39.PrimaryGeneratedColumn)()
10450
11333
  ], Product.prototype, "id", 2);
10451
11334
  __decorateClass([
10452
- (0, import_typeorm37.Column)("int")
11335
+ (0, import_typeorm39.Column)("int")
10453
11336
  ], Product.prototype, "vendorId", 2);
10454
11337
  __decorateClass([
10455
- (0, import_typeorm37.Column)("int", { nullable: true })
11338
+ (0, import_typeorm39.Column)("int", { nullable: true })
10456
11339
  ], Product.prototype, "collectionId", 2);
10457
11340
  __decorateClass([
10458
- (0, import_typeorm37.Column)("int", { nullable: true })
11341
+ (0, import_typeorm39.Column)("int", { nullable: true })
10459
11342
  ], Product.prototype, "brandId", 2);
10460
11343
  __decorateClass([
10461
- (0, import_typeorm37.Column)("int", { nullable: true })
11344
+ (0, import_typeorm39.Column)("int", { nullable: true })
10462
11345
  ], Product.prototype, "categoryId", 2);
10463
11346
  __decorateClass([
10464
- (0, import_typeorm37.Column)("varchar", { nullable: true })
11347
+ (0, import_typeorm39.Column)("varchar", { nullable: true })
10465
11348
  ], Product.prototype, "sku", 2);
10466
11349
  __decorateClass([
10467
- (0, import_typeorm37.Column)("varchar", { nullable: true })
11350
+ (0, import_typeorm39.Column)("varchar", { nullable: true })
10468
11351
  ], Product.prototype, "hsn", 2);
10469
11352
  __decorateClass([
10470
- (0, import_typeorm37.Column)("varchar", { nullable: true })
11353
+ (0, import_typeorm39.Column)("varchar", { nullable: true })
10471
11354
  ], Product.prototype, "uom", 2);
10472
11355
  __decorateClass([
10473
- (0, import_typeorm37.Column)("varchar", { default: "product" })
11356
+ (0, import_typeorm39.Column)("varchar", { default: "product" })
10474
11357
  ], Product.prototype, "type", 2);
10475
11358
  __decorateClass([
10476
- (0, import_typeorm37.Column)("varchar", { nullable: true })
11359
+ (0, import_typeorm39.Column)("varchar", { nullable: true })
10477
11360
  ], Product.prototype, "slug", 2);
10478
11361
  __decorateClass([
10479
- (0, import_typeorm37.Column)("varchar", { nullable: true })
11362
+ (0, import_typeorm39.Column)("varchar", { nullable: true })
10480
11363
  ], Product.prototype, "name", 2);
10481
11364
  __decorateClass([
10482
- (0, import_typeorm37.Column)("decimal", { precision: 12, scale: 2 })
11365
+ (0, import_typeorm39.Column)("decimal", { precision: 12, scale: 2 })
10483
11366
  ], Product.prototype, "price", 2);
10484
11367
  __decorateClass([
10485
- (0, import_typeorm37.Column)("decimal", { precision: 12, scale: 2, nullable: true })
11368
+ (0, import_typeorm39.Column)("decimal", { precision: 12, scale: 2, nullable: true })
10486
11369
  ], Product.prototype, "compareAtPrice", 2);
10487
11370
  __decorateClass([
10488
- (0, import_typeorm37.Column)("int", { default: 0 })
11371
+ (0, import_typeorm39.Column)("int", { default: 0 })
10489
11372
  ], Product.prototype, "quantity", 2);
10490
11373
  __decorateClass([
10491
- (0, import_typeorm37.Column)("varchar", { default: "draft" })
11374
+ (0, import_typeorm39.Column)("varchar", { default: "draft" })
10492
11375
  ], Product.prototype, "status", 2);
10493
11376
  __decorateClass([
10494
- (0, import_typeorm37.Column)("boolean", { default: false })
11377
+ (0, import_typeorm39.Column)("boolean", { default: false })
10495
11378
  ], Product.prototype, "featured", 2);
10496
11379
  __decorateClass([
10497
- (0, import_typeorm37.Column)("jsonb", { nullable: true })
11380
+ (0, import_typeorm39.Column)("jsonb", { nullable: true })
10498
11381
  ], Product.prototype, "metadata", 2);
10499
11382
  __decorateClass([
10500
- (0, import_typeorm37.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11383
+ (0, import_typeorm39.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10501
11384
  ], Product.prototype, "createdAt", 2);
10502
11385
  __decorateClass([
10503
- (0, import_typeorm37.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11386
+ (0, import_typeorm39.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10504
11387
  ], Product.prototype, "updatedAt", 2);
10505
11388
  __decorateClass([
10506
- (0, import_typeorm37.Column)({ type: "timestamp", nullable: true })
11389
+ (0, import_typeorm39.Column)({ type: "timestamp", nullable: true })
10507
11390
  ], Product.prototype, "deletedAt", 2);
10508
11391
  __decorateClass([
10509
- (0, import_typeorm37.Column)("boolean", { default: false })
11392
+ (0, import_typeorm39.Column)("boolean", { default: false })
10510
11393
  ], Product.prototype, "deleted", 2);
10511
11394
  __decorateClass([
10512
- (0, import_typeorm37.Column)("int", { nullable: true })
11395
+ (0, import_typeorm39.Column)("int", { nullable: true })
10513
11396
  ], Product.prototype, "createdBy", 2);
10514
11397
  __decorateClass([
10515
- (0, import_typeorm37.Column)("int", { nullable: true })
11398
+ (0, import_typeorm39.Column)("int", { nullable: true })
10516
11399
  ], Product.prototype, "updatedBy", 2);
10517
11400
  __decorateClass([
10518
- (0, import_typeorm37.Column)("int", { nullable: true })
11401
+ (0, import_typeorm39.Column)("int", { nullable: true })
10519
11402
  ], Product.prototype, "deletedBy", 2);
10520
11403
  __decorateClass([
10521
- (0, import_typeorm37.Column)("int", { nullable: true })
11404
+ (0, import_typeorm39.Column)("int", { nullable: true })
10522
11405
  ], Product.prototype, "seoId", 2);
10523
11406
  __decorateClass([
10524
- (0, import_typeorm37.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10525
- (0, import_typeorm37.JoinColumn)({ name: "vendorId" })
11407
+ (0, import_typeorm39.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11408
+ (0, import_typeorm39.JoinColumn)({ name: "vendorId" })
10526
11409
  ], Product.prototype, "vendor", 2);
10527
11410
  __decorateClass([
10528
- (0, import_typeorm37.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
10529
- (0, import_typeorm37.JoinColumn)({ name: "seoId" })
11411
+ (0, import_typeorm39.ManyToOne)(() => Seo, { onDelete: "SET NULL" }),
11412
+ (0, import_typeorm39.JoinColumn)({ name: "seoId" })
10530
11413
  ], Product.prototype, "seo", 2);
10531
11414
  __decorateClass([
10532
- (0, import_typeorm37.ManyToOne)(() => Collection, (c) => c.products, { onDelete: "SET NULL" }),
10533
- (0, import_typeorm37.JoinColumn)({ name: "collectionId" })
11415
+ (0, import_typeorm39.ManyToOne)(() => Collection, (c) => c.products, { onDelete: "SET NULL" }),
11416
+ (0, import_typeorm39.JoinColumn)({ name: "collectionId" })
10534
11417
  ], Product.prototype, "collection", 2);
10535
11418
  __decorateClass([
10536
- (0, import_typeorm37.ManyToOne)(() => Brand, (b) => b.products, { onDelete: "SET NULL" }),
10537
- (0, import_typeorm37.JoinColumn)({ name: "brandId" })
11419
+ (0, import_typeorm39.ManyToOne)(() => Brand, (b) => b.products, { onDelete: "SET NULL" }),
11420
+ (0, import_typeorm39.JoinColumn)({ name: "brandId" })
10538
11421
  ], Product.prototype, "brand", 2);
10539
11422
  __decorateClass([
10540
- (0, import_typeorm37.ManyToOne)(() => ProductCategory, (c) => c.products, { onDelete: "SET NULL" }),
10541
- (0, import_typeorm37.JoinColumn)({ name: "categoryId" })
11423
+ (0, import_typeorm39.ManyToOne)(() => ProductCategory, (c) => c.products, { onDelete: "SET NULL" }),
11424
+ (0, import_typeorm39.JoinColumn)({ name: "categoryId" })
10542
11425
  ], Product.prototype, "category", 2);
10543
11426
  __decorateClass([
10544
- (0, import_typeorm37.OneToMany)("ProductAttribute", "product")
11427
+ (0, import_typeorm39.OneToMany)("ProductAttribute", "product")
10545
11428
  ], Product.prototype, "attributes", 2);
10546
11429
  __decorateClass([
10547
- (0, import_typeorm37.OneToMany)("ProductTax", "product")
11430
+ (0, import_typeorm39.OneToMany)("ProductTax", "product")
10548
11431
  ], Product.prototype, "taxes", 2);
10549
11432
  Product = __decorateClass([
10550
- (0, import_typeorm37.Entity)("products"),
10551
- (0, import_typeorm37.Unique)("UQ_products_vendor_slug", ["vendorId", "slug"])
11433
+ (0, import_typeorm39.Entity)("products"),
11434
+ (0, import_typeorm39.Unique)("UQ_products_vendor_slug", ["vendorId", "slug"])
10552
11435
  ], Product);
10553
11436
 
10554
11437
  // src/entities/attribute.entity.ts
10555
- var import_typeorm38 = require("typeorm");
11438
+ var import_typeorm40 = require("typeorm");
10556
11439
  var Attribute = class {
10557
11440
  id;
10558
11441
  vendorId;
@@ -10573,64 +11456,64 @@ var Attribute = class {
10573
11456
  vendor;
10574
11457
  };
10575
11458
  __decorateClass([
10576
- (0, import_typeorm38.PrimaryGeneratedColumn)()
11459
+ (0, import_typeorm40.PrimaryGeneratedColumn)()
10577
11460
  ], Attribute.prototype, "id", 2);
10578
11461
  __decorateClass([
10579
- (0, import_typeorm38.Column)("int")
11462
+ (0, import_typeorm40.Column)("int")
10580
11463
  ], Attribute.prototype, "vendorId", 2);
10581
11464
  __decorateClass([
10582
- (0, import_typeorm38.Column)("varchar")
11465
+ (0, import_typeorm40.Column)("varchar")
10583
11466
  ], Attribute.prototype, "name", 2);
10584
11467
  __decorateClass([
10585
- (0, import_typeorm38.Column)("varchar")
11468
+ (0, import_typeorm40.Column)("varchar")
10586
11469
  ], Attribute.prototype, "slug", 2);
10587
11470
  __decorateClass([
10588
- (0, import_typeorm38.Column)("varchar", { default: "text" })
11471
+ (0, import_typeorm40.Column)("varchar", { default: "text" })
10589
11472
  ], Attribute.prototype, "type", 2);
10590
11473
  __decorateClass([
10591
- (0, import_typeorm38.Column)("jsonb", { nullable: true })
11474
+ (0, import_typeorm40.Column)("jsonb", { nullable: true })
10592
11475
  ], Attribute.prototype, "options", 2);
10593
11476
  __decorateClass([
10594
- (0, import_typeorm38.Column)("jsonb", { nullable: true })
11477
+ (0, import_typeorm40.Column)("jsonb", { nullable: true })
10595
11478
  ], Attribute.prototype, "metadata", 2);
10596
11479
  __decorateClass([
10597
- (0, import_typeorm38.Column)("boolean", { default: true })
11480
+ (0, import_typeorm40.Column)("boolean", { default: true })
10598
11481
  ], Attribute.prototype, "active", 2);
10599
11482
  __decorateClass([
10600
- (0, import_typeorm38.Column)("int", { default: 0 })
11483
+ (0, import_typeorm40.Column)("int", { default: 0 })
10601
11484
  ], Attribute.prototype, "sortOrder", 2);
10602
11485
  __decorateClass([
10603
- (0, import_typeorm38.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11486
+ (0, import_typeorm40.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10604
11487
  ], Attribute.prototype, "createdAt", 2);
10605
11488
  __decorateClass([
10606
- (0, import_typeorm38.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11489
+ (0, import_typeorm40.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10607
11490
  ], Attribute.prototype, "updatedAt", 2);
10608
11491
  __decorateClass([
10609
- (0, import_typeorm38.Column)({ type: "timestamp", nullable: true })
11492
+ (0, import_typeorm40.Column)({ type: "timestamp", nullable: true })
10610
11493
  ], Attribute.prototype, "deletedAt", 2);
10611
11494
  __decorateClass([
10612
- (0, import_typeorm38.Column)("boolean", { default: false })
11495
+ (0, import_typeorm40.Column)("boolean", { default: false })
10613
11496
  ], Attribute.prototype, "deleted", 2);
10614
11497
  __decorateClass([
10615
- (0, import_typeorm38.Column)("int", { nullable: true })
11498
+ (0, import_typeorm40.Column)("int", { nullable: true })
10616
11499
  ], Attribute.prototype, "createdBy", 2);
10617
11500
  __decorateClass([
10618
- (0, import_typeorm38.Column)("int", { nullable: true })
11501
+ (0, import_typeorm40.Column)("int", { nullable: true })
10619
11502
  ], Attribute.prototype, "updatedBy", 2);
10620
11503
  __decorateClass([
10621
- (0, import_typeorm38.Column)("int", { nullable: true })
11504
+ (0, import_typeorm40.Column)("int", { nullable: true })
10622
11505
  ], Attribute.prototype, "deletedBy", 2);
10623
11506
  __decorateClass([
10624
- (0, import_typeorm38.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10625
- (0, import_typeorm38.JoinColumn)({ name: "vendorId" })
11507
+ (0, import_typeorm40.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11508
+ (0, import_typeorm40.JoinColumn)({ name: "vendorId" })
10626
11509
  ], Attribute.prototype, "vendor", 2);
10627
11510
  Attribute = __decorateClass([
10628
- (0, import_typeorm38.Entity)("attributes"),
10629
- (0, import_typeorm38.Unique)("UQ_attributes_vendor_slug", ["vendorId", "slug"])
11511
+ (0, import_typeorm40.Entity)("attributes"),
11512
+ (0, import_typeorm40.Unique)("UQ_attributes_vendor_slug", ["vendorId", "slug"])
10630
11513
  ], Attribute);
10631
11514
 
10632
11515
  // src/entities/product-attribute.entity.ts
10633
- var import_typeorm39 = require("typeorm");
11516
+ var import_typeorm41 = require("typeorm");
10634
11517
  var ProductAttribute = class {
10635
11518
  id;
10636
11519
  productId;
@@ -10643,40 +11526,40 @@ var ProductAttribute = class {
10643
11526
  attribute;
10644
11527
  };
10645
11528
  __decorateClass([
10646
- (0, import_typeorm39.PrimaryGeneratedColumn)()
11529
+ (0, import_typeorm41.PrimaryGeneratedColumn)()
10647
11530
  ], ProductAttribute.prototype, "id", 2);
10648
11531
  __decorateClass([
10649
- (0, import_typeorm39.Column)("int")
11532
+ (0, import_typeorm41.Column)("int")
10650
11533
  ], ProductAttribute.prototype, "productId", 2);
10651
11534
  __decorateClass([
10652
- (0, import_typeorm39.Column)("int")
11535
+ (0, import_typeorm41.Column)("int")
10653
11536
  ], ProductAttribute.prototype, "attributeId", 2);
10654
11537
  __decorateClass([
10655
- (0, import_typeorm39.Column)("varchar")
11538
+ (0, import_typeorm41.Column)("varchar")
10656
11539
  ], ProductAttribute.prototype, "value", 2);
10657
11540
  __decorateClass([
10658
- (0, import_typeorm39.Column)("jsonb", { nullable: true })
11541
+ (0, import_typeorm41.Column)("jsonb", { nullable: true })
10659
11542
  ], ProductAttribute.prototype, "metadata", 2);
10660
11543
  __decorateClass([
10661
- (0, import_typeorm39.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11544
+ (0, import_typeorm41.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10662
11545
  ], ProductAttribute.prototype, "createdAt", 2);
10663
11546
  __decorateClass([
10664
- (0, import_typeorm39.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11547
+ (0, import_typeorm41.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10665
11548
  ], ProductAttribute.prototype, "updatedAt", 2);
10666
11549
  __decorateClass([
10667
- (0, import_typeorm39.ManyToOne)(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
10668
- (0, import_typeorm39.JoinColumn)({ name: "productId" })
11550
+ (0, import_typeorm41.ManyToOne)(() => Product, (p) => p.attributes, { onDelete: "CASCADE" }),
11551
+ (0, import_typeorm41.JoinColumn)({ name: "productId" })
10669
11552
  ], ProductAttribute.prototype, "product", 2);
10670
11553
  __decorateClass([
10671
- (0, import_typeorm39.ManyToOne)(() => Attribute, { onDelete: "CASCADE" }),
10672
- (0, import_typeorm39.JoinColumn)({ name: "attributeId" })
11554
+ (0, import_typeorm41.ManyToOne)(() => Attribute, { onDelete: "CASCADE" }),
11555
+ (0, import_typeorm41.JoinColumn)({ name: "attributeId" })
10673
11556
  ], ProductAttribute.prototype, "attribute", 2);
10674
11557
  ProductAttribute = __decorateClass([
10675
- (0, import_typeorm39.Entity)("product_attributes")
11558
+ (0, import_typeorm41.Entity)("product_attributes")
10676
11559
  ], ProductAttribute);
10677
11560
 
10678
11561
  // src/entities/tax.entity.ts
10679
- var import_typeorm40 = require("typeorm");
11562
+ var import_typeorm42 = require("typeorm");
10680
11563
  var Tax = class {
10681
11564
  id;
10682
11565
  vendorId;
@@ -10697,64 +11580,64 @@ var Tax = class {
10697
11580
  vendor;
10698
11581
  };
10699
11582
  __decorateClass([
10700
- (0, import_typeorm40.PrimaryGeneratedColumn)()
11583
+ (0, import_typeorm42.PrimaryGeneratedColumn)()
10701
11584
  ], Tax.prototype, "id", 2);
10702
11585
  __decorateClass([
10703
- (0, import_typeorm40.Column)("int")
11586
+ (0, import_typeorm42.Column)("int")
10704
11587
  ], Tax.prototype, "vendorId", 2);
10705
11588
  __decorateClass([
10706
- (0, import_typeorm40.Column)("varchar")
11589
+ (0, import_typeorm42.Column)("varchar")
10707
11590
  ], Tax.prototype, "name", 2);
10708
11591
  __decorateClass([
10709
- (0, import_typeorm40.Column)("varchar")
11592
+ (0, import_typeorm42.Column)("varchar")
10710
11593
  ], Tax.prototype, "slug", 2);
10711
11594
  __decorateClass([
10712
- (0, import_typeorm40.Column)("decimal", { precision: 5, scale: 2 })
11595
+ (0, import_typeorm42.Column)("decimal", { precision: 5, scale: 2 })
10713
11596
  ], Tax.prototype, "rate", 2);
10714
11597
  __decorateClass([
10715
- (0, import_typeorm40.Column)("boolean", { default: false })
11598
+ (0, import_typeorm42.Column)("boolean", { default: false })
10716
11599
  ], Tax.prototype, "isDefault", 2);
10717
11600
  __decorateClass([
10718
- (0, import_typeorm40.Column)("text", { nullable: true })
11601
+ (0, import_typeorm42.Column)("text", { nullable: true })
10719
11602
  ], Tax.prototype, "description", 2);
10720
11603
  __decorateClass([
10721
- (0, import_typeorm40.Column)("boolean", { default: true })
11604
+ (0, import_typeorm42.Column)("boolean", { default: true })
10722
11605
  ], Tax.prototype, "active", 2);
10723
11606
  __decorateClass([
10724
- (0, import_typeorm40.Column)("jsonb", { nullable: true })
11607
+ (0, import_typeorm42.Column)("jsonb", { nullable: true })
10725
11608
  ], Tax.prototype, "metadata", 2);
10726
11609
  __decorateClass([
10727
- (0, import_typeorm40.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11610
+ (0, import_typeorm42.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10728
11611
  ], Tax.prototype, "createdAt", 2);
10729
11612
  __decorateClass([
10730
- (0, import_typeorm40.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11613
+ (0, import_typeorm42.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10731
11614
  ], Tax.prototype, "updatedAt", 2);
10732
11615
  __decorateClass([
10733
- (0, import_typeorm40.Column)({ type: "timestamp", nullable: true })
11616
+ (0, import_typeorm42.Column)({ type: "timestamp", nullable: true })
10734
11617
  ], Tax.prototype, "deletedAt", 2);
10735
11618
  __decorateClass([
10736
- (0, import_typeorm40.Column)("boolean", { default: false })
11619
+ (0, import_typeorm42.Column)("boolean", { default: false })
10737
11620
  ], Tax.prototype, "deleted", 2);
10738
11621
  __decorateClass([
10739
- (0, import_typeorm40.Column)("int", { nullable: true })
11622
+ (0, import_typeorm42.Column)("int", { nullable: true })
10740
11623
  ], Tax.prototype, "createdBy", 2);
10741
11624
  __decorateClass([
10742
- (0, import_typeorm40.Column)("int", { nullable: true })
11625
+ (0, import_typeorm42.Column)("int", { nullable: true })
10743
11626
  ], Tax.prototype, "updatedBy", 2);
10744
11627
  __decorateClass([
10745
- (0, import_typeorm40.Column)("int", { nullable: true })
11628
+ (0, import_typeorm42.Column)("int", { nullable: true })
10746
11629
  ], Tax.prototype, "deletedBy", 2);
10747
11630
  __decorateClass([
10748
- (0, import_typeorm40.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
10749
- (0, import_typeorm40.JoinColumn)({ name: "vendorId" })
11631
+ (0, import_typeorm42.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11632
+ (0, import_typeorm42.JoinColumn)({ name: "vendorId" })
10750
11633
  ], Tax.prototype, "vendor", 2);
10751
11634
  Tax = __decorateClass([
10752
- (0, import_typeorm40.Entity)("taxes"),
10753
- (0, import_typeorm40.Unique)("UQ_taxes_vendor_slug", ["vendorId", "slug"])
11635
+ (0, import_typeorm42.Entity)("taxes"),
11636
+ (0, import_typeorm42.Unique)("UQ_taxes_vendor_slug", ["vendorId", "slug"])
10754
11637
  ], Tax);
10755
11638
 
10756
11639
  // src/entities/product-tax.entity.ts
10757
- var import_typeorm41 = require("typeorm");
11640
+ var import_typeorm43 = require("typeorm");
10758
11641
  var ProductTax = class {
10759
11642
  id;
10760
11643
  productId;
@@ -10766,37 +11649,37 @@ var ProductTax = class {
10766
11649
  tax;
10767
11650
  };
10768
11651
  __decorateClass([
10769
- (0, import_typeorm41.PrimaryGeneratedColumn)()
11652
+ (0, import_typeorm43.PrimaryGeneratedColumn)()
10770
11653
  ], ProductTax.prototype, "id", 2);
10771
11654
  __decorateClass([
10772
- (0, import_typeorm41.Column)("int")
11655
+ (0, import_typeorm43.Column)("int")
10773
11656
  ], ProductTax.prototype, "productId", 2);
10774
11657
  __decorateClass([
10775
- (0, import_typeorm41.Column)("int")
11658
+ (0, import_typeorm43.Column)("int")
10776
11659
  ], ProductTax.prototype, "taxId", 2);
10777
11660
  __decorateClass([
10778
- (0, import_typeorm41.Column)("decimal", { precision: 5, scale: 2, nullable: true })
11661
+ (0, import_typeorm43.Column)("decimal", { precision: 5, scale: 2, nullable: true })
10779
11662
  ], ProductTax.prototype, "rate", 2);
10780
11663
  __decorateClass([
10781
- (0, import_typeorm41.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11664
+ (0, import_typeorm43.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10782
11665
  ], ProductTax.prototype, "createdAt", 2);
10783
11666
  __decorateClass([
10784
- (0, import_typeorm41.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11667
+ (0, import_typeorm43.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10785
11668
  ], ProductTax.prototype, "updatedAt", 2);
10786
11669
  __decorateClass([
10787
- (0, import_typeorm41.ManyToOne)(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
10788
- (0, import_typeorm41.JoinColumn)({ name: "productId" })
11670
+ (0, import_typeorm43.ManyToOne)(() => Product, (p) => p.taxes, { onDelete: "CASCADE" }),
11671
+ (0, import_typeorm43.JoinColumn)({ name: "productId" })
10789
11672
  ], ProductTax.prototype, "product", 2);
10790
11673
  __decorateClass([
10791
- (0, import_typeorm41.ManyToOne)(() => Tax, { onDelete: "CASCADE" }),
10792
- (0, import_typeorm41.JoinColumn)({ name: "taxId" })
11674
+ (0, import_typeorm43.ManyToOne)(() => Tax, { onDelete: "CASCADE" }),
11675
+ (0, import_typeorm43.JoinColumn)({ name: "taxId" })
10793
11676
  ], ProductTax.prototype, "tax", 2);
10794
11677
  ProductTax = __decorateClass([
10795
- (0, import_typeorm41.Entity)("product_taxes")
11678
+ (0, import_typeorm43.Entity)("product_taxes")
10796
11679
  ], ProductTax);
10797
11680
 
10798
11681
  // src/entities/order-item.entity.ts
10799
- var import_typeorm42 = require("typeorm");
11682
+ var import_typeorm44 = require("typeorm");
10800
11683
  var OrderItem = class {
10801
11684
  id;
10802
11685
  orderId;
@@ -10821,79 +11704,79 @@ var OrderItem = class {
10821
11704
  product;
10822
11705
  };
10823
11706
  __decorateClass([
10824
- (0, import_typeorm42.PrimaryGeneratedColumn)()
11707
+ (0, import_typeorm44.PrimaryGeneratedColumn)()
10825
11708
  ], OrderItem.prototype, "id", 2);
10826
11709
  __decorateClass([
10827
- (0, import_typeorm42.Column)("int")
11710
+ (0, import_typeorm44.Column)("int")
10828
11711
  ], OrderItem.prototype, "orderId", 2);
10829
11712
  __decorateClass([
10830
- (0, import_typeorm42.Column)("int")
11713
+ (0, import_typeorm44.Column)("int")
10831
11714
  ], OrderItem.prototype, "productId", 2);
10832
11715
  __decorateClass([
10833
- (0, import_typeorm42.Column)({ type: "int", array: true, nullable: true, default: () => "ARRAY[]::INTEGER[]" })
11716
+ (0, import_typeorm44.Column)({ type: "int", array: true, nullable: true, default: () => "ARRAY[]::INTEGER[]" })
10834
11717
  ], OrderItem.prototype, "discountIds", 2);
10835
11718
  __decorateClass([
10836
- (0, import_typeorm42.Column)("int", { default: 1 })
11719
+ (0, import_typeorm44.Column)("int", { default: 1 })
10837
11720
  ], OrderItem.prototype, "quantity", 2);
10838
11721
  __decorateClass([
10839
- (0, import_typeorm42.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11722
+ (0, import_typeorm44.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
10840
11723
  ], OrderItem.prototype, "unitPrice", 2);
10841
11724
  __decorateClass([
10842
- (0, import_typeorm42.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11725
+ (0, import_typeorm44.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
10843
11726
  ], OrderItem.prototype, "subTotal", 2);
10844
11727
  __decorateClass([
10845
- (0, import_typeorm42.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11728
+ (0, import_typeorm44.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
10846
11729
  ], OrderItem.prototype, "discount", 2);
10847
11730
  __decorateClass([
10848
- (0, import_typeorm42.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11731
+ (0, import_typeorm44.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
10849
11732
  ], OrderItem.prototype, "discountedAmount", 2);
10850
11733
  __decorateClass([
10851
- (0, import_typeorm42.Column)("decimal", { precision: 12, scale: 2, default: 0 })
11734
+ (0, import_typeorm44.Column)("decimal", { precision: 12, scale: 2, default: 0 })
10852
11735
  ], OrderItem.prototype, "tax", 2);
10853
11736
  __decorateClass([
10854
- (0, import_typeorm42.Column)("decimal", { precision: 12, scale: 2 })
11737
+ (0, import_typeorm44.Column)("decimal", { precision: 12, scale: 2 })
10855
11738
  ], OrderItem.prototype, "total", 2);
10856
11739
  __decorateClass([
10857
- (0, import_typeorm42.Column)("varchar", { nullable: true })
11740
+ (0, import_typeorm44.Column)("varchar", { nullable: true })
10858
11741
  ], OrderItem.prototype, "hsn", 2);
10859
11742
  __decorateClass([
10860
- (0, import_typeorm42.Column)("varchar", { nullable: true })
11743
+ (0, import_typeorm44.Column)("varchar", { nullable: true })
10861
11744
  ], OrderItem.prototype, "uom", 2);
10862
11745
  __decorateClass([
10863
- (0, import_typeorm42.Column)("varchar", { nullable: true })
11746
+ (0, import_typeorm44.Column)("varchar", { nullable: true })
10864
11747
  ], OrderItem.prototype, "productType", 2);
10865
11748
  __decorateClass([
10866
- (0, import_typeorm42.Column)("decimal", { precision: 5, scale: 2, nullable: true })
11749
+ (0, import_typeorm44.Column)("decimal", { precision: 5, scale: 2, nullable: true })
10867
11750
  ], OrderItem.prototype, "taxRate", 2);
10868
11751
  __decorateClass([
10869
- (0, import_typeorm42.Column)("varchar", { nullable: true })
11752
+ (0, import_typeorm44.Column)("varchar", { nullable: true })
10870
11753
  ], OrderItem.prototype, "taxCode", 2);
10871
11754
  __decorateClass([
10872
- (0, import_typeorm42.Column)("jsonb", { nullable: true })
11755
+ (0, import_typeorm44.Column)("jsonb", { nullable: true })
10873
11756
  ], OrderItem.prototype, "metadata", 2);
10874
11757
  __decorateClass([
10875
- (0, import_typeorm42.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11758
+ (0, import_typeorm44.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10876
11759
  ], OrderItem.prototype, "createdAt", 2);
10877
11760
  __decorateClass([
10878
- (0, import_typeorm42.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11761
+ (0, import_typeorm44.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10879
11762
  ], OrderItem.prototype, "updatedAt", 2);
10880
11763
  __decorateClass([
10881
- (0, import_typeorm42.ManyToOne)(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
10882
- (0, import_typeorm42.JoinColumn)({ name: "orderId" })
11764
+ (0, import_typeorm44.ManyToOne)(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
11765
+ (0, import_typeorm44.JoinColumn)({ name: "orderId" })
10883
11766
  ], OrderItem.prototype, "order", 2);
10884
11767
  __decorateClass([
10885
- (0, import_typeorm42.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
10886
- (0, import_typeorm42.JoinColumn)({ name: "productId" })
11768
+ (0, import_typeorm44.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
11769
+ (0, import_typeorm44.JoinColumn)({ name: "productId" })
10887
11770
  ], OrderItem.prototype, "product", 2);
10888
11771
  OrderItem = __decorateClass([
10889
- (0, import_typeorm42.Entity)("order_items")
11772
+ (0, import_typeorm44.Entity)("order_items")
10890
11773
  ], OrderItem);
10891
11774
 
10892
11775
  // src/entities/knowledge-base-document.entity.ts
10893
- var import_typeorm44 = require("typeorm");
11776
+ var import_typeorm46 = require("typeorm");
10894
11777
 
10895
11778
  // src/entities/knowledge-base-chunk.entity.ts
10896
- var import_typeorm43 = require("typeorm");
11779
+ var import_typeorm45 = require("typeorm");
10897
11780
  var KnowledgeBaseChunk = class {
10898
11781
  id;
10899
11782
  documentId;
@@ -10903,26 +11786,26 @@ var KnowledgeBaseChunk = class {
10903
11786
  document;
10904
11787
  };
10905
11788
  __decorateClass([
10906
- (0, import_typeorm43.PrimaryGeneratedColumn)()
11789
+ (0, import_typeorm45.PrimaryGeneratedColumn)()
10907
11790
  ], KnowledgeBaseChunk.prototype, "id", 2);
10908
11791
  __decorateClass([
10909
- (0, import_typeorm43.Column)("int")
11792
+ (0, import_typeorm45.Column)("int")
10910
11793
  ], KnowledgeBaseChunk.prototype, "documentId", 2);
10911
11794
  __decorateClass([
10912
- (0, import_typeorm43.Column)("text")
11795
+ (0, import_typeorm45.Column)("text")
10913
11796
  ], KnowledgeBaseChunk.prototype, "content", 2);
10914
11797
  __decorateClass([
10915
- (0, import_typeorm43.Column)("int", { default: 0 })
11798
+ (0, import_typeorm45.Column)("int", { default: 0 })
10916
11799
  ], KnowledgeBaseChunk.prototype, "chunkIndex", 2);
10917
11800
  __decorateClass([
10918
- (0, import_typeorm43.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11801
+ (0, import_typeorm45.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10919
11802
  ], KnowledgeBaseChunk.prototype, "createdAt", 2);
10920
11803
  __decorateClass([
10921
- (0, import_typeorm43.ManyToOne)(() => KnowledgeBaseDocument, (d) => d.chunks, { onDelete: "CASCADE" }),
10922
- (0, import_typeorm43.JoinColumn)({ name: "documentId" })
11804
+ (0, import_typeorm45.ManyToOne)(() => KnowledgeBaseDocument, (d) => d.chunks, { onDelete: "CASCADE" }),
11805
+ (0, import_typeorm45.JoinColumn)({ name: "documentId" })
10923
11806
  ], KnowledgeBaseChunk.prototype, "document", 2);
10924
11807
  KnowledgeBaseChunk = __decorateClass([
10925
- (0, import_typeorm43.Entity)("knowledge_base_chunks")
11808
+ (0, import_typeorm45.Entity)("knowledge_base_chunks")
10926
11809
  ], KnowledgeBaseChunk);
10927
11810
 
10928
11811
  // src/entities/knowledge-base-document.entity.ts
@@ -10936,32 +11819,32 @@ var KnowledgeBaseDocument = class {
10936
11819
  chunks;
10937
11820
  };
10938
11821
  __decorateClass([
10939
- (0, import_typeorm44.PrimaryGeneratedColumn)()
11822
+ (0, import_typeorm46.PrimaryGeneratedColumn)()
10940
11823
  ], KnowledgeBaseDocument.prototype, "id", 2);
10941
11824
  __decorateClass([
10942
- (0, import_typeorm44.Column)("varchar")
11825
+ (0, import_typeorm46.Column)("varchar")
10943
11826
  ], KnowledgeBaseDocument.prototype, "name", 2);
10944
11827
  __decorateClass([
10945
- (0, import_typeorm44.Column)("varchar", { nullable: true })
11828
+ (0, import_typeorm46.Column)("varchar", { nullable: true })
10946
11829
  ], KnowledgeBaseDocument.prototype, "sourceUrl", 2);
10947
11830
  __decorateClass([
10948
- (0, import_typeorm44.Column)("text")
11831
+ (0, import_typeorm46.Column)("text")
10949
11832
  ], KnowledgeBaseDocument.prototype, "content", 2);
10950
11833
  __decorateClass([
10951
- (0, import_typeorm44.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11834
+ (0, import_typeorm46.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10952
11835
  ], KnowledgeBaseDocument.prototype, "createdAt", 2);
10953
11836
  __decorateClass([
10954
- (0, import_typeorm44.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11837
+ (0, import_typeorm46.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10955
11838
  ], KnowledgeBaseDocument.prototype, "updatedAt", 2);
10956
11839
  __decorateClass([
10957
- (0, import_typeorm44.OneToMany)(() => KnowledgeBaseChunk, (c) => c.document)
11840
+ (0, import_typeorm46.OneToMany)(() => KnowledgeBaseChunk, (c) => c.document)
10958
11841
  ], KnowledgeBaseDocument.prototype, "chunks", 2);
10959
11842
  KnowledgeBaseDocument = __decorateClass([
10960
- (0, import_typeorm44.Entity)("knowledge_base_documents")
11843
+ (0, import_typeorm46.Entity)("knowledge_base_documents")
10961
11844
  ], KnowledgeBaseDocument);
10962
11845
 
10963
11846
  // src/entities/cart.entity.ts
10964
- var import_typeorm45 = require("typeorm");
11847
+ var import_typeorm47 = require("typeorm");
10965
11848
  var Cart = class {
10966
11849
  id;
10967
11850
  guestToken;
@@ -10974,39 +11857,39 @@ var Cart = class {
10974
11857
  items;
10975
11858
  };
10976
11859
  __decorateClass([
10977
- (0, import_typeorm45.PrimaryGeneratedColumn)()
11860
+ (0, import_typeorm47.PrimaryGeneratedColumn)()
10978
11861
  ], Cart.prototype, "id", 2);
10979
11862
  __decorateClass([
10980
- (0, import_typeorm45.Column)("varchar", { nullable: true })
11863
+ (0, import_typeorm47.Column)("varchar", { nullable: true })
10981
11864
  ], Cart.prototype, "guestToken", 2);
10982
11865
  __decorateClass([
10983
- (0, import_typeorm45.Column)("int", { nullable: true })
11866
+ (0, import_typeorm47.Column)("int", { nullable: true })
10984
11867
  ], Cart.prototype, "contactId", 2);
10985
11868
  __decorateClass([
10986
- (0, import_typeorm45.Column)("varchar", { default: "INR" })
11869
+ (0, import_typeorm47.Column)("varchar", { default: "INR" })
10987
11870
  ], Cart.prototype, "currency", 2);
10988
11871
  __decorateClass([
10989
- (0, import_typeorm45.Column)({ type: "timestamp", nullable: true })
11872
+ (0, import_typeorm47.Column)({ type: "timestamp", nullable: true })
10990
11873
  ], Cart.prototype, "expiresAt", 2);
10991
11874
  __decorateClass([
10992
- (0, import_typeorm45.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11875
+ (0, import_typeorm47.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10993
11876
  ], Cart.prototype, "createdAt", 2);
10994
11877
  __decorateClass([
10995
- (0, import_typeorm45.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11878
+ (0, import_typeorm47.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
10996
11879
  ], Cart.prototype, "updatedAt", 2);
10997
11880
  __decorateClass([
10998
- (0, import_typeorm45.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
10999
- (0, import_typeorm45.JoinColumn)({ name: "contactId" })
11881
+ (0, import_typeorm47.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
11882
+ (0, import_typeorm47.JoinColumn)({ name: "contactId" })
11000
11883
  ], Cart.prototype, "contact", 2);
11001
11884
  __decorateClass([
11002
- (0, import_typeorm45.OneToMany)("CartItem", "cart")
11885
+ (0, import_typeorm47.OneToMany)("CartItem", "cart")
11003
11886
  ], Cart.prototype, "items", 2);
11004
11887
  Cart = __decorateClass([
11005
- (0, import_typeorm45.Entity)("carts")
11888
+ (0, import_typeorm47.Entity)("carts")
11006
11889
  ], Cart);
11007
11890
 
11008
11891
  // src/entities/cart-item.entity.ts
11009
- var import_typeorm46 = require("typeorm");
11892
+ var import_typeorm48 = require("typeorm");
11010
11893
  var CartItem = class {
11011
11894
  id;
11012
11895
  cartId;
@@ -11019,40 +11902,40 @@ var CartItem = class {
11019
11902
  product;
11020
11903
  };
11021
11904
  __decorateClass([
11022
- (0, import_typeorm46.PrimaryGeneratedColumn)()
11905
+ (0, import_typeorm48.PrimaryGeneratedColumn)()
11023
11906
  ], CartItem.prototype, "id", 2);
11024
11907
  __decorateClass([
11025
- (0, import_typeorm46.Column)("int")
11908
+ (0, import_typeorm48.Column)("int")
11026
11909
  ], CartItem.prototype, "cartId", 2);
11027
11910
  __decorateClass([
11028
- (0, import_typeorm46.Column)("int")
11911
+ (0, import_typeorm48.Column)("int")
11029
11912
  ], CartItem.prototype, "productId", 2);
11030
11913
  __decorateClass([
11031
- (0, import_typeorm46.Column)("int", { default: 1 })
11914
+ (0, import_typeorm48.Column)("int", { default: 1 })
11032
11915
  ], CartItem.prototype, "quantity", 2);
11033
11916
  __decorateClass([
11034
- (0, import_typeorm46.Column)("jsonb", { nullable: true })
11917
+ (0, import_typeorm48.Column)("jsonb", { nullable: true })
11035
11918
  ], CartItem.prototype, "metadata", 2);
11036
11919
  __decorateClass([
11037
- (0, import_typeorm46.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11920
+ (0, import_typeorm48.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11038
11921
  ], CartItem.prototype, "createdAt", 2);
11039
11922
  __decorateClass([
11040
- (0, import_typeorm46.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11923
+ (0, import_typeorm48.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11041
11924
  ], CartItem.prototype, "updatedAt", 2);
11042
11925
  __decorateClass([
11043
- (0, import_typeorm46.ManyToOne)(() => Cart, (c) => c.items, { onDelete: "CASCADE" }),
11044
- (0, import_typeorm46.JoinColumn)({ name: "cartId" })
11926
+ (0, import_typeorm48.ManyToOne)(() => Cart, (c) => c.items, { onDelete: "CASCADE" }),
11927
+ (0, import_typeorm48.JoinColumn)({ name: "cartId" })
11045
11928
  ], CartItem.prototype, "cart", 2);
11046
11929
  __decorateClass([
11047
- (0, import_typeorm46.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
11048
- (0, import_typeorm46.JoinColumn)({ name: "productId" })
11930
+ (0, import_typeorm48.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
11931
+ (0, import_typeorm48.JoinColumn)({ name: "productId" })
11049
11932
  ], CartItem.prototype, "product", 2);
11050
11933
  CartItem = __decorateClass([
11051
- (0, import_typeorm46.Entity)("cart_items")
11934
+ (0, import_typeorm48.Entity)("cart_items")
11052
11935
  ], CartItem);
11053
11936
 
11054
11937
  // src/entities/wishlist.entity.ts
11055
- var import_typeorm47 = require("typeorm");
11938
+ var import_typeorm49 = require("typeorm");
11056
11939
  var Wishlist = class {
11057
11940
  id;
11058
11941
  guestId;
@@ -11064,36 +11947,36 @@ var Wishlist = class {
11064
11947
  items;
11065
11948
  };
11066
11949
  __decorateClass([
11067
- (0, import_typeorm47.PrimaryGeneratedColumn)()
11950
+ (0, import_typeorm49.PrimaryGeneratedColumn)()
11068
11951
  ], Wishlist.prototype, "id", 2);
11069
11952
  __decorateClass([
11070
- (0, import_typeorm47.Column)("varchar", { nullable: true })
11953
+ (0, import_typeorm49.Column)("varchar", { nullable: true })
11071
11954
  ], Wishlist.prototype, "guestId", 2);
11072
11955
  __decorateClass([
11073
- (0, import_typeorm47.Column)("int", { nullable: true })
11956
+ (0, import_typeorm49.Column)("int", { nullable: true })
11074
11957
  ], Wishlist.prototype, "contactId", 2);
11075
11958
  __decorateClass([
11076
- (0, import_typeorm47.Column)("varchar", { default: "default" })
11959
+ (0, import_typeorm49.Column)("varchar", { default: "default" })
11077
11960
  ], Wishlist.prototype, "name", 2);
11078
11961
  __decorateClass([
11079
- (0, import_typeorm47.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11962
+ (0, import_typeorm49.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11080
11963
  ], Wishlist.prototype, "createdAt", 2);
11081
11964
  __decorateClass([
11082
- (0, import_typeorm47.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11965
+ (0, import_typeorm49.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11083
11966
  ], Wishlist.prototype, "updatedAt", 2);
11084
11967
  __decorateClass([
11085
- (0, import_typeorm47.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
11086
- (0, import_typeorm47.JoinColumn)({ name: "contactId" })
11968
+ (0, import_typeorm49.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
11969
+ (0, import_typeorm49.JoinColumn)({ name: "contactId" })
11087
11970
  ], Wishlist.prototype, "contact", 2);
11088
11971
  __decorateClass([
11089
- (0, import_typeorm47.OneToMany)("WishlistItem", "wishlist")
11972
+ (0, import_typeorm49.OneToMany)("WishlistItem", "wishlist")
11090
11973
  ], Wishlist.prototype, "items", 2);
11091
11974
  Wishlist = __decorateClass([
11092
- (0, import_typeorm47.Entity)("wishlists")
11975
+ (0, import_typeorm49.Entity)("wishlists")
11093
11976
  ], Wishlist);
11094
11977
 
11095
11978
  // src/entities/wishlist-item.entity.ts
11096
- var import_typeorm48 = require("typeorm");
11979
+ var import_typeorm50 = require("typeorm");
11097
11980
  var WishlistItem = class {
11098
11981
  id;
11099
11982
  wishlistId;
@@ -11105,37 +11988,37 @@ var WishlistItem = class {
11105
11988
  product;
11106
11989
  };
11107
11990
  __decorateClass([
11108
- (0, import_typeorm48.PrimaryGeneratedColumn)()
11991
+ (0, import_typeorm50.PrimaryGeneratedColumn)()
11109
11992
  ], WishlistItem.prototype, "id", 2);
11110
11993
  __decorateClass([
11111
- (0, import_typeorm48.Column)("int")
11994
+ (0, import_typeorm50.Column)("int")
11112
11995
  ], WishlistItem.prototype, "wishlistId", 2);
11113
11996
  __decorateClass([
11114
- (0, import_typeorm48.Column)("int")
11997
+ (0, import_typeorm50.Column)("int")
11115
11998
  ], WishlistItem.prototype, "productId", 2);
11116
11999
  __decorateClass([
11117
- (0, import_typeorm48.Column)("jsonb", { nullable: true })
12000
+ (0, import_typeorm50.Column)("jsonb", { nullable: true })
11118
12001
  ], WishlistItem.prototype, "metadata", 2);
11119
12002
  __decorateClass([
11120
- (0, import_typeorm48.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12003
+ (0, import_typeorm50.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11121
12004
  ], WishlistItem.prototype, "createdAt", 2);
11122
12005
  __decorateClass([
11123
- (0, import_typeorm48.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12006
+ (0, import_typeorm50.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11124
12007
  ], WishlistItem.prototype, "updatedAt", 2);
11125
12008
  __decorateClass([
11126
- (0, import_typeorm48.ManyToOne)(() => Wishlist, (w) => w.items, { onDelete: "CASCADE" }),
11127
- (0, import_typeorm48.JoinColumn)({ name: "wishlistId" })
12009
+ (0, import_typeorm50.ManyToOne)(() => Wishlist, (w) => w.items, { onDelete: "CASCADE" }),
12010
+ (0, import_typeorm50.JoinColumn)({ name: "wishlistId" })
11128
12011
  ], WishlistItem.prototype, "wishlist", 2);
11129
12012
  __decorateClass([
11130
- (0, import_typeorm48.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
11131
- (0, import_typeorm48.JoinColumn)({ name: "productId" })
12013
+ (0, import_typeorm50.ManyToOne)(() => Product, { onDelete: "CASCADE" }),
12014
+ (0, import_typeorm50.JoinColumn)({ name: "productId" })
11132
12015
  ], WishlistItem.prototype, "product", 2);
11133
12016
  WishlistItem = __decorateClass([
11134
- (0, import_typeorm48.Entity)("wishlist_items")
12017
+ (0, import_typeorm50.Entity)("wishlist_items")
11135
12018
  ], WishlistItem);
11136
12019
 
11137
12020
  // src/entities/llm-agent-knowledge-document.entity.ts
11138
- var import_typeorm49 = require("typeorm");
12021
+ var import_typeorm51 = require("typeorm");
11139
12022
  var LlmAgentKnowledgeDocument = class {
11140
12023
  id;
11141
12024
  agentId;
@@ -11145,33 +12028,33 @@ var LlmAgentKnowledgeDocument = class {
11145
12028
  document;
11146
12029
  };
11147
12030
  __decorateClass([
11148
- (0, import_typeorm49.PrimaryGeneratedColumn)()
12031
+ (0, import_typeorm51.PrimaryGeneratedColumn)()
11149
12032
  ], LlmAgentKnowledgeDocument.prototype, "id", 2);
11150
12033
  __decorateClass([
11151
- (0, import_typeorm49.Column)("int")
12034
+ (0, import_typeorm51.Column)("int")
11152
12035
  ], LlmAgentKnowledgeDocument.prototype, "agentId", 2);
11153
12036
  __decorateClass([
11154
- (0, import_typeorm49.Column)("int")
12037
+ (0, import_typeorm51.Column)("int")
11155
12038
  ], LlmAgentKnowledgeDocument.prototype, "documentId", 2);
11156
12039
  __decorateClass([
11157
- (0, import_typeorm49.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12040
+ (0, import_typeorm51.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11158
12041
  ], LlmAgentKnowledgeDocument.prototype, "createdAt", 2);
11159
12042
  __decorateClass([
11160
- (0, import_typeorm49.ManyToOne)(() => LlmAgent, { onDelete: "CASCADE" }),
11161
- (0, import_typeorm49.JoinColumn)({ name: "agentId" })
12043
+ (0, import_typeorm51.ManyToOne)(() => LlmAgent, { onDelete: "CASCADE" }),
12044
+ (0, import_typeorm51.JoinColumn)({ name: "agentId" })
11162
12045
  ], LlmAgentKnowledgeDocument.prototype, "agent", 2);
11163
12046
  __decorateClass([
11164
- (0, import_typeorm49.ManyToOne)(() => KnowledgeBaseDocument, { onDelete: "CASCADE" }),
11165
- (0, import_typeorm49.JoinColumn)({ name: "documentId" })
12047
+ (0, import_typeorm51.ManyToOne)(() => KnowledgeBaseDocument, { onDelete: "CASCADE" }),
12048
+ (0, import_typeorm51.JoinColumn)({ name: "documentId" })
11166
12049
  ], LlmAgentKnowledgeDocument.prototype, "document", 2);
11167
12050
  LlmAgentKnowledgeDocument = __decorateClass([
11168
- (0, import_typeorm49.Entity)("llm_agent_knowledge_documents"),
11169
- (0, import_typeorm49.Unique)("UQ_llm_agent_knowledge_agent_document", ["agentId", "documentId"]),
11170
- (0, import_typeorm49.Index)("IDX_llm_agent_knowledge_agent", ["agentId"])
12051
+ (0, import_typeorm51.Entity)("llm_agent_knowledge_documents"),
12052
+ (0, import_typeorm51.Unique)("UQ_llm_agent_knowledge_agent_document", ["agentId", "documentId"]),
12053
+ (0, import_typeorm51.Index)("IDX_llm_agent_knowledge_agent", ["agentId"])
11171
12054
  ], LlmAgentKnowledgeDocument);
11172
12055
 
11173
12056
  // src/entities/currency.entity.ts
11174
- var import_typeorm50 = require("typeorm");
12057
+ var import_typeorm52 = require("typeorm");
11175
12058
  var Currency = class {
11176
12059
  id;
11177
12060
  code;
@@ -11181,29 +12064,29 @@ var Currency = class {
11181
12064
  isBaseCurrency;
11182
12065
  };
11183
12066
  __decorateClass([
11184
- (0, import_typeorm50.PrimaryGeneratedColumn)()
12067
+ (0, import_typeorm52.PrimaryGeneratedColumn)()
11185
12068
  ], Currency.prototype, "id", 2);
11186
12069
  __decorateClass([
11187
- (0, import_typeorm50.Column)({ type: "varchar", unique: true })
12070
+ (0, import_typeorm52.Column)({ type: "varchar", unique: true })
11188
12071
  ], Currency.prototype, "code", 2);
11189
12072
  __decorateClass([
11190
- (0, import_typeorm50.Column)({ type: "varchar" })
12073
+ (0, import_typeorm52.Column)({ type: "varchar" })
11191
12074
  ], Currency.prototype, "name", 2);
11192
12075
  __decorateClass([
11193
- (0, import_typeorm50.Column)({ type: "varchar" })
12076
+ (0, import_typeorm52.Column)({ type: "varchar" })
11194
12077
  ], Currency.prototype, "symbol", 2);
11195
12078
  __decorateClass([
11196
- (0, import_typeorm50.Column)({ type: "boolean", default: true })
12079
+ (0, import_typeorm52.Column)({ type: "boolean", default: true })
11197
12080
  ], Currency.prototype, "isActive", 2);
11198
12081
  __decorateClass([
11199
- (0, import_typeorm50.Column)({ type: "boolean", default: false })
12082
+ (0, import_typeorm52.Column)({ type: "boolean", default: false })
11200
12083
  ], Currency.prototype, "isBaseCurrency", 2);
11201
12084
  Currency = __decorateClass([
11202
- (0, import_typeorm50.Entity)("currency")
12085
+ (0, import_typeorm52.Entity)("currency")
11203
12086
  ], Currency);
11204
12087
 
11205
12088
  // src/entities/currency_exchange.entity.ts
11206
- var import_typeorm51 = require("typeorm");
12089
+ var import_typeorm53 = require("typeorm");
11207
12090
  var CurrencyExchange = class {
11208
12091
  id;
11209
12092
  fromCurrency;
@@ -11211,26 +12094,26 @@ var CurrencyExchange = class {
11211
12094
  rate;
11212
12095
  };
11213
12096
  __decorateClass([
11214
- (0, import_typeorm51.PrimaryGeneratedColumn)()
12097
+ (0, import_typeorm53.PrimaryGeneratedColumn)()
11215
12098
  ], CurrencyExchange.prototype, "id", 2);
11216
12099
  __decorateClass([
11217
- (0, import_typeorm51.Column)({ type: "varchar" })
12100
+ (0, import_typeorm53.Column)({ type: "varchar" })
11218
12101
  ], CurrencyExchange.prototype, "fromCurrency", 2);
11219
12102
  __decorateClass([
11220
- (0, import_typeorm51.Column)({ type: "varchar" })
12103
+ (0, import_typeorm53.Column)({ type: "varchar" })
11221
12104
  ], CurrencyExchange.prototype, "toCurrency", 2);
11222
12105
  __decorateClass([
11223
- (0, import_typeorm51.Column)("decimal", { precision: 12, scale: 6, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
12106
+ (0, import_typeorm53.Column)("decimal", { precision: 12, scale: 6, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11224
12107
  ], CurrencyExchange.prototype, "rate", 2);
11225
12108
  CurrencyExchange = __decorateClass([
11226
- (0, import_typeorm51.Entity)("currency_exchange")
12109
+ (0, import_typeorm53.Entity)("currency_exchange")
11227
12110
  ], CurrencyExchange);
11228
12111
 
11229
12112
  // src/entities/discount.entity.ts
11230
- var import_typeorm53 = require("typeorm");
12113
+ var import_typeorm55 = require("typeorm");
11231
12114
 
11232
12115
  // src/entities/discount_rules.entity.ts
11233
- var import_typeorm52 = require("typeorm");
12116
+ var import_typeorm54 = require("typeorm");
11234
12117
  var Type = /* @__PURE__ */ ((Type2) => {
11235
12118
  Type2["MIN_AMOUNT"] = "minAmount";
11236
12119
  Type2["USER"] = "user";
@@ -11297,45 +12180,45 @@ var DiscountRules = class {
11297
12180
  value;
11298
12181
  };
11299
12182
  __decorateClass([
11300
- (0, import_typeorm52.PrimaryGeneratedColumn)()
12183
+ (0, import_typeorm54.PrimaryGeneratedColumn)()
11301
12184
  ], DiscountRules.prototype, "id", 2);
11302
12185
  __decorateClass([
11303
- (0, import_typeorm52.ManyToOne)(() => Discount, (discount) => discount.rules, { onDelete: "CASCADE" }),
11304
- (0, import_typeorm52.JoinColumn)({ name: "discountId" })
12186
+ (0, import_typeorm54.ManyToOne)(() => Discount, (discount) => discount.rules, { onDelete: "CASCADE" }),
12187
+ (0, import_typeorm54.JoinColumn)({ name: "discountId" })
11305
12188
  ], DiscountRules.prototype, "discount", 2);
11306
12189
  __decorateClass([
11307
- (0, import_typeorm52.Column)({ type: "int" })
12190
+ (0, import_typeorm54.Column)({ type: "int" })
11308
12191
  ], DiscountRules.prototype, "discountId", 2);
11309
12192
  __decorateClass([
11310
- (0, import_typeorm52.ManyToOne)(() => DiscountRules, (rule) => rule.children, { nullable: true, onDelete: "CASCADE" }),
11311
- (0, import_typeorm52.JoinColumn)({ name: "parentId" })
12193
+ (0, import_typeorm54.ManyToOne)(() => DiscountRules, (rule) => rule.children, { nullable: true, onDelete: "CASCADE" }),
12194
+ (0, import_typeorm54.JoinColumn)({ name: "parentId" })
11312
12195
  ], DiscountRules.prototype, "parent", 2);
11313
12196
  __decorateClass([
11314
- (0, import_typeorm52.OneToMany)(() => DiscountRules, (rule) => rule.parent)
12197
+ (0, import_typeorm54.OneToMany)(() => DiscountRules, (rule) => rule.parent)
11315
12198
  ], DiscountRules.prototype, "children", 2);
11316
12199
  __decorateClass([
11317
- (0, import_typeorm52.Column)({ type: "int", nullable: true })
12200
+ (0, import_typeorm54.Column)({ type: "int", nullable: true })
11318
12201
  ], DiscountRules.prototype, "parentId", 2);
11319
12202
  __decorateClass([
11320
- (0, import_typeorm52.Column)({ type: "enum", enum: ConditionType })
12203
+ (0, import_typeorm54.Column)({ type: "enum", enum: ConditionType })
11321
12204
  ], DiscountRules.prototype, "conditionType", 2);
11322
12205
  __decorateClass([
11323
- (0, import_typeorm52.Column)({ type: "enum", enum: ConditionOperator, nullable: true })
12206
+ (0, import_typeorm54.Column)({ type: "enum", enum: ConditionOperator, nullable: true })
11324
12207
  ], DiscountRules.prototype, "conditionOperator", 2);
11325
12208
  __decorateClass([
11326
- (0, import_typeorm52.Column)({ type: "enum", enum: Type, nullable: true })
12209
+ (0, import_typeorm54.Column)({ type: "enum", enum: Type, nullable: true })
11327
12210
  ], DiscountRules.prototype, "type", 2);
11328
12211
  __decorateClass([
11329
- (0, import_typeorm52.Column)({ type: "enum", enum: SubType, nullable: true })
12212
+ (0, import_typeorm54.Column)({ type: "enum", enum: SubType, nullable: true })
11330
12213
  ], DiscountRules.prototype, "subType", 2);
11331
12214
  __decorateClass([
11332
- (0, import_typeorm52.Column)({ type: "enum", enum: ComparisonOperator, nullable: true })
12215
+ (0, import_typeorm54.Column)({ type: "enum", enum: ComparisonOperator, nullable: true })
11333
12216
  ], DiscountRules.prototype, "comparisonOperator", 2);
11334
12217
  __decorateClass([
11335
- (0, import_typeorm52.Column)({ type: "jsonb" })
12218
+ (0, import_typeorm54.Column)({ type: "jsonb" })
11336
12219
  ], DiscountRules.prototype, "value", 2);
11337
12220
  DiscountRules = __decorateClass([
11338
- (0, import_typeorm52.Entity)("discount_rules")
12221
+ (0, import_typeorm54.Entity)("discount_rules")
11339
12222
  ], DiscountRules);
11340
12223
 
11341
12224
  // src/entities/discount.entity.ts
@@ -11372,71 +12255,71 @@ var Discount = class {
11372
12255
  rules;
11373
12256
  };
11374
12257
  __decorateClass([
11375
- (0, import_typeorm53.PrimaryGeneratedColumn)()
12258
+ (0, import_typeorm55.PrimaryGeneratedColumn)()
11376
12259
  ], Discount.prototype, "id", 2);
11377
12260
  __decorateClass([
11378
- (0, import_typeorm53.Column)("int")
12261
+ (0, import_typeorm55.Column)("int")
11379
12262
  ], Discount.prototype, "vendorId", 2);
11380
12263
  __decorateClass([
11381
- (0, import_typeorm53.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
11382
- (0, import_typeorm53.JoinColumn)({ name: "vendorId" })
12264
+ (0, import_typeorm55.ManyToOne)(() => Vendor, { onDelete: "RESTRICT" }),
12265
+ (0, import_typeorm55.JoinColumn)({ name: "vendorId" })
11383
12266
  ], Discount.prototype, "vendor", 2);
11384
12267
  __decorateClass([
11385
- (0, import_typeorm53.Column)({ type: "varchar" })
12268
+ (0, import_typeorm55.Column)({ type: "varchar" })
11386
12269
  ], Discount.prototype, "name", 2);
11387
12270
  __decorateClass([
11388
- (0, import_typeorm53.Column)({ type: "varchar", nullable: true })
12271
+ (0, import_typeorm55.Column)({ type: "varchar", nullable: true })
11389
12272
  ], Discount.prototype, "couponCode", 2);
11390
12273
  __decorateClass([
11391
- (0, import_typeorm53.Column)({ type: "varchar", nullable: true })
12274
+ (0, import_typeorm55.Column)({ type: "varchar", nullable: true })
11392
12275
  ], Discount.prototype, "description", 2);
11393
12276
  __decorateClass([
11394
- (0, import_typeorm53.Column)({ type: "enum", enum: DiscountType })
12277
+ (0, import_typeorm55.Column)({ type: "enum", enum: DiscountType })
11395
12278
  ], Discount.prototype, "discountType", 2);
11396
12279
  __decorateClass([
11397
- (0, import_typeorm53.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
12280
+ (0, import_typeorm55.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11398
12281
  ], Discount.prototype, "value", 2);
11399
12282
  __decorateClass([
11400
- (0, import_typeorm53.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
12283
+ (0, import_typeorm55.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11401
12284
  ], Discount.prototype, "maxDiscountAmount", 2);
11402
12285
  __decorateClass([
11403
- (0, import_typeorm53.Column)({ type: "int", nullable: true })
12286
+ (0, import_typeorm55.Column)({ type: "int", nullable: true })
11404
12287
  ], Discount.prototype, "maxTotalUsage", 2);
11405
12288
  __decorateClass([
11406
- (0, import_typeorm53.Column)({ type: "int", nullable: true })
12289
+ (0, import_typeorm55.Column)({ type: "int", nullable: true })
11407
12290
  ], Discount.prototype, "maxUsagePerUser", 2);
11408
12291
  __decorateClass([
11409
- (0, import_typeorm53.Column)({ type: "int", default: 0 })
12292
+ (0, import_typeorm55.Column)({ type: "int", default: 0 })
11410
12293
  ], Discount.prototype, "usedCount", 2);
11411
12294
  __decorateClass([
11412
- (0, import_typeorm53.Column)({ type: "timestamp" })
12295
+ (0, import_typeorm55.Column)({ type: "timestamp" })
11413
12296
  ], Discount.prototype, "validFrom", 2);
11414
12297
  __decorateClass([
11415
- (0, import_typeorm53.Column)({ type: "timestamp" })
12298
+ (0, import_typeorm55.Column)({ type: "timestamp" })
11416
12299
  ], Discount.prototype, "validUntil", 2);
11417
12300
  __decorateClass([
11418
- (0, import_typeorm53.Column)({ type: "enum", enum: DiscountStatus, default: "ACTIVE" /* ACTIVE */ })
12301
+ (0, import_typeorm55.Column)({ type: "enum", enum: DiscountStatus, default: "ACTIVE" /* ACTIVE */ })
11419
12302
  ], Discount.prototype, "status", 2);
11420
12303
  __decorateClass([
11421
- (0, import_typeorm53.Column)({ type: "boolean" })
12304
+ (0, import_typeorm55.Column)({ type: "boolean" })
11422
12305
  ], Discount.prototype, "canCombineWithOtherDiscounts", 2);
11423
12306
  __decorateClass([
11424
- (0, import_typeorm53.Column)({ type: "boolean", default: false })
12307
+ (0, import_typeorm55.Column)({ type: "boolean", default: false })
11425
12308
  ], Discount.prototype, "isAutomatic", 2);
11426
12309
  __decorateClass([
11427
- (0, import_typeorm53.Column)({ type: "varchar", default: "INR" })
12310
+ (0, import_typeorm55.Column)({ type: "varchar", default: "INR" })
11428
12311
  ], Discount.prototype, "currency", 2);
11429
12312
  __decorateClass([
11430
- (0, import_typeorm53.OneToMany)(() => DiscountRules, (rule) => rule.discount, {
12313
+ (0, import_typeorm55.OneToMany)(() => DiscountRules, (rule) => rule.discount, {
11431
12314
  cascade: true
11432
12315
  })
11433
12316
  ], Discount.prototype, "rules", 2);
11434
12317
  Discount = __decorateClass([
11435
- (0, import_typeorm53.Entity)("discounts")
12318
+ (0, import_typeorm55.Entity)("discounts")
11436
12319
  ], Discount);
11437
12320
 
11438
12321
  // src/entities/order_discounts.entity.ts
11439
- var import_typeorm54 = require("typeorm");
12322
+ var import_typeorm56 = require("typeorm");
11440
12323
  var OrderDiscounts = class {
11441
12324
  id;
11442
12325
  order;
@@ -11451,50 +12334,50 @@ var OrderDiscounts = class {
11451
12334
  metaData;
11452
12335
  };
11453
12336
  __decorateClass([
11454
- (0, import_typeorm54.PrimaryGeneratedColumn)()
12337
+ (0, import_typeorm56.PrimaryGeneratedColumn)()
11455
12338
  ], OrderDiscounts.prototype, "id", 2);
11456
12339
  __decorateClass([
11457
- (0, import_typeorm54.ManyToOne)(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
11458
- (0, import_typeorm54.JoinColumn)({ name: "orderId" })
12340
+ (0, import_typeorm56.ManyToOne)(() => Order, (o) => o.items, { onDelete: "CASCADE" }),
12341
+ (0, import_typeorm56.JoinColumn)({ name: "orderId" })
11459
12342
  ], OrderDiscounts.prototype, "order", 2);
11460
12343
  __decorateClass([
11461
- (0, import_typeorm54.Column)({ type: "int" })
12344
+ (0, import_typeorm56.Column)({ type: "int" })
11462
12345
  ], OrderDiscounts.prototype, "orderId", 2);
11463
12346
  __decorateClass([
11464
- (0, import_typeorm54.ManyToOne)(() => OrderItem, { onDelete: "CASCADE" }),
11465
- (0, import_typeorm54.JoinColumn)({ name: "orderItemId" })
12347
+ (0, import_typeorm56.ManyToOne)(() => OrderItem, { onDelete: "CASCADE" }),
12348
+ (0, import_typeorm56.JoinColumn)({ name: "orderItemId" })
11466
12349
  ], OrderDiscounts.prototype, "orderItem", 2);
11467
12350
  __decorateClass([
11468
- (0, import_typeorm54.Column)({ type: "int" })
12351
+ (0, import_typeorm56.Column)({ type: "int" })
11469
12352
  ], OrderDiscounts.prototype, "orderItemId", 2);
11470
12353
  __decorateClass([
11471
- (0, import_typeorm54.Column)({ type: "int" })
12354
+ (0, import_typeorm56.Column)({ type: "int" })
11472
12355
  ], OrderDiscounts.prototype, "userId", 2);
11473
12356
  __decorateClass([
11474
- (0, import_typeorm54.ManyToOne)(() => Discount, { onDelete: "CASCADE" }),
11475
- (0, import_typeorm54.JoinColumn)({ name: "discountId" })
12357
+ (0, import_typeorm56.ManyToOne)(() => Discount, { onDelete: "CASCADE" }),
12358
+ (0, import_typeorm56.JoinColumn)({ name: "discountId" })
11476
12359
  ], OrderDiscounts.prototype, "discount", 2);
11477
12360
  __decorateClass([
11478
- (0, import_typeorm54.Column)({ type: "int" })
12361
+ (0, import_typeorm56.Column)({ type: "int" })
11479
12362
  ], OrderDiscounts.prototype, "discountId", 2);
11480
12363
  __decorateClass([
11481
- (0, import_typeorm54.Column)({ type: "varchar" })
12364
+ (0, import_typeorm56.Column)({ type: "varchar" })
11482
12365
  ], OrderDiscounts.prototype, "discountCode", 2);
11483
12366
  __decorateClass([
11484
- (0, import_typeorm54.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
12367
+ (0, import_typeorm56.Column)({ type: "decimal", precision: 10, scale: 2, transformer: { to: (value) => value, from: (value) => parseFloat(value) } })
11485
12368
  ], OrderDiscounts.prototype, "discountAmount", 2);
11486
12369
  __decorateClass([
11487
- (0, import_typeorm54.Column)({ type: "jsonb", nullable: true })
12370
+ (0, import_typeorm56.Column)({ type: "jsonb", nullable: true })
11488
12371
  ], OrderDiscounts.prototype, "metaData", 2);
11489
12372
  OrderDiscounts = __decorateClass([
11490
- (0, import_typeorm54.Entity)("order_discounts")
12373
+ (0, import_typeorm56.Entity)("order_discounts")
11491
12374
  ], OrderDiscounts);
11492
12375
 
11493
12376
  // src/entities/rss-feed.entity.ts
11494
- var import_typeorm56 = require("typeorm");
12377
+ var import_typeorm58 = require("typeorm");
11495
12378
 
11496
12379
  // src/entities/rss-article.entity.ts
11497
- var import_typeorm55 = require("typeorm");
12380
+ var import_typeorm57 = require("typeorm");
11498
12381
  var RssArticle = class {
11499
12382
  id;
11500
12383
  rssFeedId;
@@ -11513,54 +12396,54 @@ var RssArticle = class {
11513
12396
  createdAt;
11514
12397
  };
11515
12398
  __decorateClass([
11516
- (0, import_typeorm55.PrimaryGeneratedColumn)("uuid")
12399
+ (0, import_typeorm57.PrimaryGeneratedColumn)("uuid")
11517
12400
  ], RssArticle.prototype, "id", 2);
11518
12401
  __decorateClass([
11519
- (0, import_typeorm55.Column)("uuid")
12402
+ (0, import_typeorm57.Column)("uuid")
11520
12403
  ], RssArticle.prototype, "rssFeedId", 2);
11521
12404
  __decorateClass([
11522
- (0, import_typeorm55.ManyToOne)(() => RssFeed, (f) => f.articles, { onDelete: "CASCADE" }),
11523
- (0, import_typeorm55.JoinColumn)({ name: "rssFeedId" })
12405
+ (0, import_typeorm57.ManyToOne)(() => RssFeed, (f) => f.articles, { onDelete: "CASCADE" }),
12406
+ (0, import_typeorm57.JoinColumn)({ name: "rssFeedId" })
11524
12407
  ], RssArticle.prototype, "rssFeed", 2);
11525
12408
  __decorateClass([
11526
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12409
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11527
12410
  ], RssArticle.prototype, "externalId", 2);
11528
12411
  __decorateClass([
11529
- (0, import_typeorm55.Column)({ type: "text" })
12412
+ (0, import_typeorm57.Column)({ type: "text" })
11530
12413
  ], RssArticle.prototype, "title", 2);
11531
12414
  __decorateClass([
11532
- (0, import_typeorm55.Column)({ type: "text" })
12415
+ (0, import_typeorm57.Column)({ type: "text" })
11533
12416
  ], RssArticle.prototype, "articleUrl", 2);
11534
12417
  __decorateClass([
11535
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12418
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11536
12419
  ], RssArticle.prototype, "summary", 2);
11537
12420
  __decorateClass([
11538
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12421
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11539
12422
  ], RssArticle.prototype, "content", 2);
11540
12423
  __decorateClass([
11541
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12424
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11542
12425
  ], RssArticle.prototype, "author", 2);
11543
12426
  __decorateClass([
11544
- (0, import_typeorm55.Column)({ type: "timestamp", nullable: true })
12427
+ (0, import_typeorm57.Column)({ type: "timestamp", nullable: true })
11545
12428
  ], RssArticle.prototype, "publishedAt", 2);
11546
12429
  __decorateClass([
11547
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12430
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11548
12431
  ], RssArticle.prototype, "imageUrl", 2);
11549
12432
  __decorateClass([
11550
- (0, import_typeorm55.Column)({ type: "jsonb", nullable: true })
12433
+ (0, import_typeorm57.Column)({ type: "jsonb", nullable: true })
11551
12434
  ], RssArticle.prototype, "rawData", 2);
11552
12435
  __decorateClass([
11553
- (0, import_typeorm55.Column)({ type: "text", nullable: true })
12436
+ (0, import_typeorm57.Column)({ type: "text", nullable: true })
11554
12437
  ], RssArticle.prototype, "contentHash", 2);
11555
12438
  __decorateClass([
11556
- (0, import_typeorm55.Column)({ type: "boolean", default: false })
12439
+ (0, import_typeorm57.Column)({ type: "boolean", default: false })
11557
12440
  ], RssArticle.prototype, "isProcessed", 2);
11558
12441
  __decorateClass([
11559
- (0, import_typeorm55.CreateDateColumn)()
12442
+ (0, import_typeorm57.CreateDateColumn)()
11560
12443
  ], RssArticle.prototype, "createdAt", 2);
11561
12444
  RssArticle = __decorateClass([
11562
- (0, import_typeorm55.Entity)("rss_articles"),
11563
- (0, import_typeorm55.Unique)("UQ_rss_articles_feed_article_url", ["rssFeedId", "articleUrl"])
12445
+ (0, import_typeorm57.Entity)("rss_articles"),
12446
+ (0, import_typeorm57.Unique)("UQ_rss_articles_feed_article_url", ["rssFeedId", "articleUrl"])
11564
12447
  ], RssArticle);
11565
12448
 
11566
12449
  // src/entities/rss-feed.entity.ts
@@ -11578,47 +12461,47 @@ var RssFeed = class {
11578
12461
  updatedAt;
11579
12462
  };
11580
12463
  __decorateClass([
11581
- (0, import_typeorm56.PrimaryGeneratedColumn)("uuid")
12464
+ (0, import_typeorm58.PrimaryGeneratedColumn)("uuid")
11582
12465
  ], RssFeed.prototype, "id", 2);
11583
12466
  __decorateClass([
11584
- (0, import_typeorm56.Column)({ type: "text" })
12467
+ (0, import_typeorm58.Column)({ type: "text" })
11585
12468
  ], RssFeed.prototype, "name", 2);
11586
12469
  __decorateClass([
11587
- (0, import_typeorm56.Column)({ type: "text", unique: true })
12470
+ (0, import_typeorm58.Column)({ type: "text", unique: true })
11588
12471
  ], RssFeed.prototype, "rssUrl", 2);
11589
12472
  __decorateClass([
11590
- (0, import_typeorm56.Column)({ type: "text", nullable: true })
12473
+ (0, import_typeorm58.Column)({ type: "text", nullable: true })
11591
12474
  ], RssFeed.prototype, "websiteUrl", 2);
11592
12475
  __decorateClass([
11593
- (0, import_typeorm56.Column)({ type: "boolean", default: true })
12476
+ (0, import_typeorm58.Column)({ type: "boolean", default: true })
11594
12477
  ], RssFeed.prototype, "isActive", 2);
11595
12478
  __decorateClass([
11596
- (0, import_typeorm56.Column)({ type: "int", default: 60 })
12479
+ (0, import_typeorm58.Column)({ type: "int", default: 60 })
11597
12480
  ], RssFeed.prototype, "fetchFrequencyMinutes", 2);
11598
12481
  __decorateClass([
11599
- (0, import_typeorm56.Column)({ type: "timestamp", nullable: true })
12482
+ (0, import_typeorm58.Column)({ type: "timestamp", nullable: true })
11600
12483
  ], RssFeed.prototype, "lastFetchedAt", 2);
11601
12484
  __decorateClass([
11602
- (0, import_typeorm56.Column)({ type: "timestamp", nullable: true })
12485
+ (0, import_typeorm58.Column)({ type: "timestamp", nullable: true })
11603
12486
  ], RssFeed.prototype, "lastArticleDate", 2);
11604
12487
  __decorateClass([
11605
- (0, import_typeorm56.OneToMany)(() => RssArticle, (article) => article.rssFeed)
12488
+ (0, import_typeorm58.OneToMany)(() => RssArticle, (article) => article.rssFeed)
11606
12489
  ], RssFeed.prototype, "articles", 2);
11607
12490
  __decorateClass([
11608
- (0, import_typeorm56.CreateDateColumn)()
12491
+ (0, import_typeorm58.CreateDateColumn)()
11609
12492
  ], RssFeed.prototype, "createdAt", 2);
11610
12493
  __decorateClass([
11611
- (0, import_typeorm56.UpdateDateColumn)()
12494
+ (0, import_typeorm58.UpdateDateColumn)()
11612
12495
  ], RssFeed.prototype, "updatedAt", 2);
11613
12496
  RssFeed = __decorateClass([
11614
- (0, import_typeorm56.Entity)("rss_feeds")
12497
+ (0, import_typeorm58.Entity)("rss_feeds")
11615
12498
  ], RssFeed);
11616
12499
 
11617
12500
  // src/entities/job-schedule.entity.ts
11618
- var import_typeorm58 = require("typeorm");
12501
+ var import_typeorm60 = require("typeorm");
11619
12502
 
11620
12503
  // src/entities/job-schedule-run.entity.ts
11621
- var import_typeorm57 = require("typeorm");
12504
+ var import_typeorm59 = require("typeorm");
11622
12505
  var JobScheduleRun = class {
11623
12506
  id;
11624
12507
  scheduleId;
@@ -11632,38 +12515,38 @@ var JobScheduleRun = class {
11632
12515
  createdAt;
11633
12516
  };
11634
12517
  __decorateClass([
11635
- (0, import_typeorm57.PrimaryGeneratedColumn)("uuid")
12518
+ (0, import_typeorm59.PrimaryGeneratedColumn)("uuid")
11636
12519
  ], JobScheduleRun.prototype, "id", 2);
11637
12520
  __decorateClass([
11638
- (0, import_typeorm57.Column)({ type: "uuid" })
12521
+ (0, import_typeorm59.Column)({ type: "uuid" })
11639
12522
  ], JobScheduleRun.prototype, "scheduleId", 2);
11640
12523
  __decorateClass([
11641
- (0, import_typeorm57.ManyToOne)(() => JobSchedule, (s) => s.runs, { onDelete: "CASCADE" }),
11642
- (0, import_typeorm57.JoinColumn)({ name: "scheduleId" })
12524
+ (0, import_typeorm59.ManyToOne)(() => JobSchedule, (s) => s.runs, { onDelete: "CASCADE" }),
12525
+ (0, import_typeorm59.JoinColumn)({ name: "scheduleId" })
11643
12526
  ], JobScheduleRun.prototype, "schedule", 2);
11644
12527
  __decorateClass([
11645
- (0, import_typeorm57.Column)({ type: "timestamp" })
12528
+ (0, import_typeorm59.Column)({ type: "timestamp" })
11646
12529
  ], JobScheduleRun.prototype, "startedAt", 2);
11647
12530
  __decorateClass([
11648
- (0, import_typeorm57.Column)({ type: "timestamp", nullable: true })
12531
+ (0, import_typeorm59.Column)({ type: "timestamp", nullable: true })
11649
12532
  ], JobScheduleRun.prototype, "finishedAt", 2);
11650
12533
  __decorateClass([
11651
- (0, import_typeorm57.Column)({ type: "varchar", length: 32 })
12534
+ (0, import_typeorm59.Column)({ type: "varchar", length: 32 })
11652
12535
  ], JobScheduleRun.prototype, "status", 2);
11653
12536
  __decorateClass([
11654
- (0, import_typeorm57.Column)({ type: "text", nullable: true })
12537
+ (0, import_typeorm59.Column)({ type: "text", nullable: true })
11655
12538
  ], JobScheduleRun.prototype, "error", 2);
11656
12539
  __decorateClass([
11657
- (0, import_typeorm57.Column)({ type: "jsonb", nullable: true })
12540
+ (0, import_typeorm59.Column)({ type: "jsonb", nullable: true })
11658
12541
  ], JobScheduleRun.prototype, "result", 2);
11659
12542
  __decorateClass([
11660
- (0, import_typeorm57.Column)({ type: "varchar", length: 16, default: "schedule" })
12543
+ (0, import_typeorm59.Column)({ type: "varchar", length: 16, default: "schedule" })
11661
12544
  ], JobScheduleRun.prototype, "triggeredBy", 2);
11662
12545
  __decorateClass([
11663
- (0, import_typeorm57.CreateDateColumn)()
12546
+ (0, import_typeorm59.CreateDateColumn)()
11664
12547
  ], JobScheduleRun.prototype, "createdAt", 2);
11665
12548
  JobScheduleRun = __decorateClass([
11666
- (0, import_typeorm57.Entity)("job_schedule_runs")
12549
+ (0, import_typeorm59.Entity)("job_schedule_runs")
11667
12550
  ], JobScheduleRun);
11668
12551
 
11669
12552
  // src/entities/job-schedule.entity.ts
@@ -11690,71 +12573,71 @@ var JobSchedule = class {
11690
12573
  updatedAt;
11691
12574
  };
11692
12575
  __decorateClass([
11693
- (0, import_typeorm58.PrimaryGeneratedColumn)("uuid")
12576
+ (0, import_typeorm60.PrimaryGeneratedColumn)("uuid")
11694
12577
  ], JobSchedule.prototype, "id", 2);
11695
12578
  __decorateClass([
11696
- (0, import_typeorm58.Column)({ type: "text" })
12579
+ (0, import_typeorm60.Column)({ type: "text" })
11697
12580
  ], JobSchedule.prototype, "name", 2);
11698
12581
  __decorateClass([
11699
- (0, import_typeorm58.Column)({ type: "varchar", length: 64, default: "blog_generate" })
12582
+ (0, import_typeorm60.Column)({ type: "varchar", length: 64, default: "blog_generate" })
11700
12583
  ], JobSchedule.prototype, "jobType", 2);
11701
12584
  __decorateClass([
11702
- (0, import_typeorm58.Column)({ type: "boolean", default: false })
12585
+ (0, import_typeorm60.Column)({ type: "boolean", default: false })
11703
12586
  ], JobSchedule.prototype, "enabled", 2);
11704
12587
  __decorateClass([
11705
- (0, import_typeorm58.Column)({ type: "varchar", length: 32, default: "daily" })
12588
+ (0, import_typeorm60.Column)({ type: "varchar", length: 32, default: "daily" })
11706
12589
  ], JobSchedule.prototype, "scheduleMode", 2);
11707
12590
  __decorateClass([
11708
- (0, import_typeorm58.Column)({ type: "int", nullable: true })
12591
+ (0, import_typeorm60.Column)({ type: "int", nullable: true })
11709
12592
  ], JobSchedule.prototype, "intervalMinutes", 2);
11710
12593
  __decorateClass([
11711
- (0, import_typeorm58.Column)({ type: "varchar", length: 8, nullable: true })
12594
+ (0, import_typeorm60.Column)({ type: "varchar", length: 8, nullable: true })
11712
12595
  ], JobSchedule.prototype, "runAtTime", 2);
11713
12596
  __decorateClass([
11714
- (0, import_typeorm58.Column)({ type: "jsonb", nullable: true })
12597
+ (0, import_typeorm60.Column)({ type: "jsonb", nullable: true })
11715
12598
  ], JobSchedule.prototype, "runOnDays", 2);
11716
12599
  __decorateClass([
11717
- (0, import_typeorm58.Column)({ type: "varchar", length: 64, default: "UTC" })
12600
+ (0, import_typeorm60.Column)({ type: "varchar", length: 64, default: "UTC" })
11718
12601
  ], JobSchedule.prototype, "timezone", 2);
11719
12602
  __decorateClass([
11720
- (0, import_typeorm58.Column)({ type: "text", nullable: true })
12603
+ (0, import_typeorm60.Column)({ type: "text", nullable: true })
11721
12604
  ], JobSchedule.prototype, "cronExpression", 2);
11722
12605
  __decorateClass([
11723
- (0, import_typeorm58.Column)({ type: "jsonb", default: {} })
12606
+ (0, import_typeorm60.Column)({ type: "jsonb", default: {} })
11724
12607
  ], JobSchedule.prototype, "payload", 2);
11725
12608
  __decorateClass([
11726
- (0, import_typeorm58.Column)({ type: "int", nullable: true })
12609
+ (0, import_typeorm60.Column)({ type: "int", nullable: true })
11727
12610
  ], JobSchedule.prototype, "authorId", 2);
11728
12611
  __decorateClass([
11729
- (0, import_typeorm58.Column)({ type: "varchar", length: 128, unique: true })
12612
+ (0, import_typeorm60.Column)({ type: "varchar", length: 128, unique: true })
11730
12613
  ], JobSchedule.prototype, "pgBossScheduleName", 2);
11731
12614
  __decorateClass([
11732
- (0, import_typeorm58.Column)({ type: "timestamp", nullable: true })
12615
+ (0, import_typeorm60.Column)({ type: "timestamp", nullable: true })
11733
12616
  ], JobSchedule.prototype, "lastRunAt", 2);
11734
12617
  __decorateClass([
11735
- (0, import_typeorm58.Column)({ type: "varchar", length: 32, nullable: true })
12618
+ (0, import_typeorm60.Column)({ type: "varchar", length: 32, nullable: true })
11736
12619
  ], JobSchedule.prototype, "lastRunStatus", 2);
11737
12620
  __decorateClass([
11738
- (0, import_typeorm58.Column)({ type: "text", nullable: true })
12621
+ (0, import_typeorm60.Column)({ type: "text", nullable: true })
11739
12622
  ], JobSchedule.prototype, "lastRunError", 2);
11740
12623
  __decorateClass([
11741
- (0, import_typeorm58.Column)({ type: "timestamp", nullable: true })
12624
+ (0, import_typeorm60.Column)({ type: "timestamp", nullable: true })
11742
12625
  ], JobSchedule.prototype, "nextRunAt", 2);
11743
12626
  __decorateClass([
11744
- (0, import_typeorm58.OneToMany)(() => JobScheduleRun, (r) => r.schedule)
12627
+ (0, import_typeorm60.OneToMany)(() => JobScheduleRun, (r) => r.schedule)
11745
12628
  ], JobSchedule.prototype, "runs", 2);
11746
12629
  __decorateClass([
11747
- (0, import_typeorm58.CreateDateColumn)()
12630
+ (0, import_typeorm60.CreateDateColumn)()
11748
12631
  ], JobSchedule.prototype, "createdAt", 2);
11749
12632
  __decorateClass([
11750
- (0, import_typeorm58.UpdateDateColumn)()
12633
+ (0, import_typeorm60.UpdateDateColumn)()
11751
12634
  ], JobSchedule.prototype, "updatedAt", 2);
11752
12635
  JobSchedule = __decorateClass([
11753
- (0, import_typeorm58.Entity)("job_schedules")
12636
+ (0, import_typeorm60.Entity)("job_schedules")
11754
12637
  ], JobSchedule);
11755
12638
 
11756
12639
  // src/entities/vendor-user.entity.ts
11757
- var import_typeorm59 = require("typeorm");
12640
+ var import_typeorm61 = require("typeorm");
11758
12641
  var VendorUser = class {
11759
12642
  id;
11760
12643
  vendorId;
@@ -11766,85 +12649,93 @@ var VendorUser = class {
11766
12649
  user;
11767
12650
  };
11768
12651
  __decorateClass([
11769
- (0, import_typeorm59.PrimaryGeneratedColumn)()
12652
+ (0, import_typeorm61.PrimaryGeneratedColumn)()
11770
12653
  ], VendorUser.prototype, "id", 2);
11771
12654
  __decorateClass([
11772
- (0, import_typeorm59.Column)("int")
12655
+ (0, import_typeorm61.Column)("int")
11773
12656
  ], VendorUser.prototype, "vendorId", 2);
11774
12657
  __decorateClass([
11775
- (0, import_typeorm59.Column)("int")
12658
+ (0, import_typeorm61.Column)("int")
11776
12659
  ], VendorUser.prototype, "userId", 2);
11777
12660
  __decorateClass([
11778
- (0, import_typeorm59.Column)("varchar", { default: "staff" })
12661
+ (0, import_typeorm61.Column)("varchar", { default: "staff" })
11779
12662
  ], VendorUser.prototype, "role", 2);
11780
12663
  __decorateClass([
11781
- (0, import_typeorm59.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12664
+ (0, import_typeorm61.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11782
12665
  ], VendorUser.prototype, "createdAt", 2);
11783
12666
  __decorateClass([
11784
- (0, import_typeorm59.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12667
+ (0, import_typeorm61.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11785
12668
  ], VendorUser.prototype, "updatedAt", 2);
11786
12669
  __decorateClass([
11787
- (0, import_typeorm59.ManyToOne)(() => Vendor, (v) => v.vendorUsers, { onDelete: "CASCADE" }),
11788
- (0, import_typeorm59.JoinColumn)({ name: "vendorId" })
12670
+ (0, import_typeorm61.ManyToOne)(() => Vendor, (v) => v.vendorUsers, { onDelete: "CASCADE" }),
12671
+ (0, import_typeorm61.JoinColumn)({ name: "vendorId" })
11789
12672
  ], VendorUser.prototype, "vendor", 2);
11790
12673
  __decorateClass([
11791
- (0, import_typeorm59.ManyToOne)(() => User, { onDelete: "CASCADE" }),
11792
- (0, import_typeorm59.JoinColumn)({ name: "userId" })
12674
+ (0, import_typeorm61.ManyToOne)(() => User, { onDelete: "CASCADE" }),
12675
+ (0, import_typeorm61.JoinColumn)({ name: "userId" })
11793
12676
  ], VendorUser.prototype, "user", 2);
11794
12677
  VendorUser = __decorateClass([
11795
- (0, import_typeorm59.Entity)("vendor_users"),
11796
- (0, import_typeorm59.Unique)("UQ_vendor_users_vendor_user", ["vendorId", "userId"]),
11797
- (0, import_typeorm59.Index)("IDX_vendor_users_vendor", ["vendorId"]),
11798
- (0, import_typeorm59.Index)("IDX_vendor_users_user", ["userId"])
12678
+ (0, import_typeorm61.Entity)("vendor_users"),
12679
+ (0, import_typeorm61.Unique)("UQ_vendor_users_vendor_user", ["vendorId", "userId"]),
12680
+ (0, import_typeorm61.Index)("IDX_vendor_users_vendor", ["vendorId"]),
12681
+ (0, import_typeorm61.Index)("IDX_vendor_users_user", ["userId"])
11799
12682
  ], VendorUser);
11800
12683
 
11801
12684
  // src/entities/vendor-customer.entity.ts
11802
- var import_typeorm60 = require("typeorm");
12685
+ var import_typeorm62 = require("typeorm");
11803
12686
  var VendorCustomer = class {
11804
12687
  id;
11805
12688
  vendorId;
11806
12689
  contactId;
12690
+ customerId;
11807
12691
  notes;
11808
12692
  tags;
11809
12693
  createdAt;
11810
12694
  updatedAt;
11811
12695
  vendor;
11812
12696
  contact;
12697
+ customer;
11813
12698
  };
11814
12699
  __decorateClass([
11815
- (0, import_typeorm60.PrimaryGeneratedColumn)()
12700
+ (0, import_typeorm62.PrimaryGeneratedColumn)()
11816
12701
  ], VendorCustomer.prototype, "id", 2);
11817
12702
  __decorateClass([
11818
- (0, import_typeorm60.Column)("int")
12703
+ (0, import_typeorm62.Column)("int")
11819
12704
  ], VendorCustomer.prototype, "vendorId", 2);
11820
12705
  __decorateClass([
11821
- (0, import_typeorm60.Column)("int")
12706
+ (0, import_typeorm62.Column)("int", { nullable: true })
11822
12707
  ], VendorCustomer.prototype, "contactId", 2);
11823
12708
  __decorateClass([
11824
- (0, import_typeorm60.Column)("text", { nullable: true })
12709
+ (0, import_typeorm62.Column)("int")
12710
+ ], VendorCustomer.prototype, "customerId", 2);
12711
+ __decorateClass([
12712
+ (0, import_typeorm62.Column)("text", { nullable: true })
11825
12713
  ], VendorCustomer.prototype, "notes", 2);
11826
12714
  __decorateClass([
11827
- (0, import_typeorm60.Column)("simple-array", { nullable: true })
12715
+ (0, import_typeorm62.Column)("simple-array", { nullable: true })
11828
12716
  ], VendorCustomer.prototype, "tags", 2);
11829
12717
  __decorateClass([
11830
- (0, import_typeorm60.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12718
+ (0, import_typeorm62.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11831
12719
  ], VendorCustomer.prototype, "createdAt", 2);
11832
12720
  __decorateClass([
11833
- (0, import_typeorm60.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
12721
+ (0, import_typeorm62.Column)({ type: "timestamp", default: () => "CURRENT_TIMESTAMP" })
11834
12722
  ], VendorCustomer.prototype, "updatedAt", 2);
11835
12723
  __decorateClass([
11836
- (0, import_typeorm60.ManyToOne)(() => Vendor, { onDelete: "CASCADE" }),
11837
- (0, import_typeorm60.JoinColumn)({ name: "vendorId" })
12724
+ (0, import_typeorm62.ManyToOne)(() => Vendor, { onDelete: "CASCADE" }),
12725
+ (0, import_typeorm62.JoinColumn)({ name: "vendorId" })
11838
12726
  ], VendorCustomer.prototype, "vendor", 2);
11839
12727
  __decorateClass([
11840
- (0, import_typeorm60.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
11841
- (0, import_typeorm60.JoinColumn)({ name: "contactId" })
12728
+ (0, import_typeorm62.ManyToOne)(() => Contact, { onDelete: "CASCADE" }),
12729
+ (0, import_typeorm62.JoinColumn)({ name: "contactId" })
11842
12730
  ], VendorCustomer.prototype, "contact", 2);
12731
+ __decorateClass([
12732
+ (0, import_typeorm62.ManyToOne)(() => Customer, { onDelete: "CASCADE" }),
12733
+ (0, import_typeorm62.JoinColumn)({ name: "customerId" })
12734
+ ], VendorCustomer.prototype, "customer", 2);
11843
12735
  VendorCustomer = __decorateClass([
11844
- (0, import_typeorm60.Entity)("vendor_customers"),
11845
- (0, import_typeorm60.Unique)("UQ_vendor_customers_vendor_contact", ["vendorId", "contactId"]),
11846
- (0, import_typeorm60.Index)("IDX_vendor_customers_vendor", ["vendorId"]),
11847
- (0, import_typeorm60.Index)("IDX_vendor_customers_contact", ["contactId"])
12736
+ (0, import_typeorm62.Entity)("vendor_customers"),
12737
+ (0, import_typeorm62.Index)("IDX_vendor_customers_vendor", ["vendorId"]),
12738
+ (0, import_typeorm62.Index)("IDX_vendor_customers_contact", ["contactId"])
11848
12739
  ], VendorCustomer);
11849
12740
 
11850
12741
  // src/entities/index.ts
@@ -11901,7 +12792,9 @@ var CMS_ENTITY_MAP = {
11901
12792
  job_schedule_runs: JobScheduleRun,
11902
12793
  vendors: Vendor,
11903
12794
  vendor_users: VendorUser,
11904
- vendor_customers: VendorCustomer
12795
+ vendor_customers: VendorCustomer,
12796
+ customer: Customer,
12797
+ customer_contacts: Customer_Contacts
11905
12798
  };
11906
12799
 
11907
12800
  // src/plugins/blog-generator/blog-generator-service.ts
@@ -13324,7 +14217,7 @@ async function queueJobScheduleNow(cms, scheduleId) {
13324
14217
  init_pg_boss_service();
13325
14218
 
13326
14219
  // src/plugins/jobs/blog-generate-job.ts
13327
- var import_typeorm61 = require("typeorm");
14220
+ var import_typeorm63 = require("typeorm");
13328
14221
 
13329
14222
  // src/plugins/jobs/schedule-next-run.ts
13330
14223
  var import_cron_parser = require("cron-parser");
@@ -13735,6 +14628,10 @@ function createCmsApiHandler(config) {
13735
14628
  getVendorScope: async () => {
13736
14629
  const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
13737
14630
  return resolveVendorScopeFromSessionUser(u ?? null);
14631
+ },
14632
+ getHydratedSessionUser: async () => {
14633
+ const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
14634
+ return u ?? null;
13738
14635
  }
13739
14636
  } : {}
13740
14637
  };
@@ -13755,7 +14652,6 @@ function createCmsApiHandler(config) {
13755
14652
  getSessionUser,
13756
14653
  baseUrl: vendorOnboardBaseUrl,
13757
14654
  getCms,
13758
- getCompanyDetails: config.getCompanyDetails,
13759
14655
  hashPassword: userAuth?.hashPassword,
13760
14656
  minPasswordLength: 6
13761
14657
  });
@@ -14681,14 +15577,72 @@ function createCmsApiHandler(config) {
14681
15577
  const orderRepo = dataSource.getRepository(entityMap.orders);
14682
15578
  const order = await orderRepo.findOne({
14683
15579
  where: { qrToken: token, deleted: false },
14684
- relations: ["contact", "items", "items.product"]
15580
+ relations: ["contact", "items", "items.product", "items.product.collection"]
15581
+ });
15582
+ if (!order) return new Response(
15583
+ `<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>`,
15584
+ { status: 404, headers: { "Content-Type": "text/html; charset=utf-8" } }
15585
+ );
15586
+ const { renderOrderTrackingPage: renderOrderTrackingPage2 } = await Promise.resolve().then(() => (init_OrderTrackPage(), OrderTrackPage_exports));
15587
+ const html = renderOrderTrackingPage2(order);
15588
+ return new Response(html, {
15589
+ status: 200,
15590
+ headers: { "Content-Type": "text/html; charset=utf-8" }
14685
15591
  });
14686
- if (!order) return config.json({ error: "Order not found" }, { status: 404 });
14687
- return config.json(order);
14688
15592
  } catch (err) {
14689
15593
  const message = err instanceof Error ? err.message : String(err);
14690
- return config.json({ error: message }, { status: 500 });
15594
+ return new Response(
15595
+ `<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>`,
15596
+ { status: 500, headers: { "Content-Type": "text/html; charset=utf-8" } }
15597
+ );
15598
+ }
15599
+ }
15600
+ if (path2[0] === "customer_contacts" && entityMap["customer_contacts"]) {
15601
+ const a = await config.requireAuth(req);
15602
+ if (a) return a;
15603
+ const pe = await requireEntityPermissionEffective(req, "vendor_customers", "read");
15604
+ if (pe) return pe;
15605
+ if (path2.length === 1 && m === "GET") {
15606
+ const { searchParams } = new URL(req.url);
15607
+ const customerId = searchParams.get("customerId");
15608
+ const limit = Math.min(Number(searchParams.get("limit") || "200"), 500);
15609
+ if (!customerId || !Number.isFinite(Number(customerId))) {
15610
+ return config.json({ error: "customerId is required" }, { status: 400 });
15611
+ }
15612
+ const repo = dataSource.getRepository(entityMap["customer_contacts"]);
15613
+ const rows = await repo.find({
15614
+ where: { customerId: Number(customerId) },
15615
+ relations: ["contact"],
15616
+ take: limit,
15617
+ order: { id: "ASC" }
15618
+ });
15619
+ return config.json({ data: rows, total: rows.length });
15620
+ }
15621
+ if (path2.length === 1 && m === "POST") {
15622
+ const pe2 = await requireEntityPermissionEffective(req, "vendor_customers", "create");
15623
+ if (pe2) return pe2;
15624
+ const body = await req.json();
15625
+ const customerId = Number(body.customerId);
15626
+ const contactId = Number(body.contactId);
15627
+ if (!Number.isFinite(customerId) || customerId <= 0) {
15628
+ return config.json({ error: "customerId is required" }, { status: 400 });
15629
+ }
15630
+ if (!Number.isFinite(contactId) || contactId <= 0) {
15631
+ return config.json({ error: "contactId is required" }, { status: 400 });
15632
+ }
15633
+ const repo = dataSource.getRepository(entityMap["customer_contacts"]);
15634
+ const existing = await repo.findOne({
15635
+ where: { customerId, contactId }
15636
+ });
15637
+ if (existing) {
15638
+ return config.json(existing, { status: 200 });
15639
+ }
15640
+ const created = await repo.save(
15641
+ repo.create({ customerId, contactId })
15642
+ );
15643
+ return config.json(created, { status: 201 });
14691
15644
  }
15645
+ return config.json({ error: "Method not allowed" }, { status: 405 });
14692
15646
  }
14693
15647
  if (path2.length === 0) return config.json({ error: "Not found" }, { status: 404 });
14694
15648
  const resource = resolveResource(path2[0]);
@@ -14733,7 +15687,7 @@ function createCmsApiHandler(config) {
14733
15687
  }
14734
15688
 
14735
15689
  // src/api/storefront-handlers.ts
14736
- var import_typeorm63 = require("typeorm");
15690
+ var import_typeorm65 = require("typeorm");
14737
15691
 
14738
15692
  // src/lib/is-valid-signup-email.ts
14739
15693
  var MAX_EMAIL = 254;
@@ -14994,7 +15948,7 @@ async function queueSms(cms, payload) {
14994
15948
 
14995
15949
  // src/lib/otp-challenge.ts
14996
15950
  var import_crypto3 = require("crypto");
14997
- var import_typeorm62 = require("typeorm");
15951
+ var import_typeorm64 = require("typeorm");
14998
15952
  var OTP_TTL_MS = 10 * 60 * 1e3;
14999
15953
  var MAX_SENDS_PER_HOUR = 5;
15000
15954
  var MAX_VERIFY_ATTEMPTS = 8;
@@ -15028,7 +15982,7 @@ function normalizePhoneE164(raw, defaultCountryCode) {
15028
15982
  async function countRecentOtpSends(dataSource, entityMap, purpose, identifier, since) {
15029
15983
  const repo = dataSource.getRepository(entityMap.otp_challenges);
15030
15984
  return repo.count({
15031
- where: { purpose, identifier, createdAt: (0, import_typeorm62.MoreThan)(since) }
15985
+ where: { purpose, identifier, createdAt: (0, import_typeorm64.MoreThan)(since) }
15032
15986
  });
15033
15987
  }
15034
15988
  async function createOtpChallenge(dataSource, entityMap, input) {
@@ -15042,7 +15996,7 @@ async function createOtpChallenge(dataSource, entityMap, input) {
15042
15996
  await repo.delete({
15043
15997
  purpose,
15044
15998
  identifier,
15045
- consumedAt: (0, import_typeorm62.IsNull)()
15999
+ consumedAt: (0, import_typeorm64.IsNull)()
15046
16000
  });
15047
16001
  const expiresAt = new Date(Date.now() + OTP_TTL_MS);
15048
16002
  const codeHash = hashOtpCode(code, purpose, identifier, pepper);
@@ -15063,7 +16017,7 @@ async function verifyAndConsumeOtpChallenge(dataSource, entityMap, input) {
15063
16017
  const { purpose, identifier, code, pepper } = input;
15064
16018
  const repo = dataSource.getRepository(entityMap.otp_challenges);
15065
16019
  const row = await repo.findOne({
15066
- where: { purpose, identifier, consumedAt: (0, import_typeorm62.IsNull)() },
16020
+ where: { purpose, identifier, consumedAt: (0, import_typeorm64.IsNull)() },
15067
16021
  order: { id: "DESC" }
15068
16022
  });
15069
16023
  if (!row) {
@@ -15131,6 +16085,8 @@ function createStorefrontApiHandler(config) {
15131
16085
  const collectionRepo = () => dataSource.getRepository(entityMap.collections);
15132
16086
  const groupRepo = () => dataSource.getRepository(entityMap.user_groups);
15133
16087
  const configRepo = () => dataSource.getRepository(entityMap.configs);
16088
+ const customerRepo = () => dataSource.getRepository(entityMap.customer);
16089
+ const customerContactsRepo = () => dataSource.getRepository(entityMap.customer_contacts);
15134
16090
  const CART_CHECKOUT_RELATIONS = ["items", "items.product", "items.product.taxes", "items.product.taxes.tax"];
15135
16091
  function resolveSingleVendorIdFromCart(cart) {
15136
16092
  const vendorIds = /* @__PURE__ */ new Set();
@@ -15314,7 +16270,7 @@ function createStorefrontApiHandler(config) {
15314
16270
  const u = await userRepo().findOne({ where: { id: userId } });
15315
16271
  if (!u) return null;
15316
16272
  const unclaimed = await contactRepo().findOne({
15317
- where: { email: u.email, userId: (0, import_typeorm63.IsNull)(), deleted: false }
16273
+ where: { email: u.email, userId: (0, import_typeorm65.IsNull)(), deleted: false }
15318
16274
  });
15319
16275
  if (unclaimed) {
15320
16276
  await contactRepo().update(unclaimed.id, { userId });
@@ -15332,6 +16288,142 @@ function createStorefrontApiHandler(config) {
15332
16288
  await syncContactToErp(created);
15333
16289
  return { id: created.id };
15334
16290
  }
16291
+ function parseCheckoutContactDetails(b) {
16292
+ const src = b.contact && typeof b.contact === "object" && !Array.isArray(b.contact) ? b.contact : b;
16293
+ const name = String(src.name ?? "").trim();
16294
+ const email = String(src.email ?? "").trim().toLowerCase();
16295
+ const phone = src.phone != null && src.phone !== "" ? String(src.phone).trim() : null;
16296
+ if (!name || !email) return null;
16297
+ return { name, email, phone };
16298
+ }
16299
+ async function ensureCustomerContactLink(customerId, contactId) {
16300
+ if (!entityMap.customer_contacts) return;
16301
+ const existing = await customerContactsRepo().findOne({
16302
+ where: { customerId, contactId }
16303
+ });
16304
+ if (!existing) {
16305
+ await customerContactsRepo().save(
16306
+ customerContactsRepo().create({ customerId, contactId })
16307
+ );
16308
+ }
16309
+ }
16310
+ async function resolveCustomerCheckoutContact(b, sessionUserId) {
16311
+ if (!entityMap.customer) {
16312
+ return { ok: false, status: 503, message: "Customer not configured" };
16313
+ }
16314
+ const payloadUserId = intFromBody(b.userId) ?? sessionUserId;
16315
+ if (payloadUserId !== sessionUserId) {
16316
+ return { ok: false, status: 401, message: "Unauthorized" };
16317
+ }
16318
+ const details = parseCheckoutContactDetails(b);
16319
+ if (!details) {
16320
+ return { ok: false, status: 400, message: "contact name and email required" };
16321
+ }
16322
+ const customer = await customerRepo().findOne({
16323
+ where: { userId: payloadUserId, deleted: false }
16324
+ });
16325
+ if (!customer) {
16326
+ return { ok: false, status: 404, message: "Customer not found" };
16327
+ }
16328
+ const customerId = customer.id;
16329
+ let contact = await contactRepo().findOne({
16330
+ where: { email: details.email, deleted: false }
16331
+ });
16332
+ if (!contact) {
16333
+ contact = await contactRepo().save(
16334
+ contactRepo().create({
16335
+ name: details.name,
16336
+ email: details.email,
16337
+ phone: details.phone,
16338
+ type: "customer",
16339
+ userId: null,
16340
+ deleted: false
16341
+ })
16342
+ );
16343
+ await syncContactToErp(contact);
16344
+ } else {
16345
+ await contactRepo().update(contact.id, {
16346
+ name: details.name,
16347
+ phone: details.phone ?? contact.phone
16348
+ });
16349
+ }
16350
+ const contactId = contact.id;
16351
+ await ensureCustomerContactLink(customerId, contactId);
16352
+ return { ok: true, contactId, customerId };
16353
+ }
16354
+ async function loadBuyerCart(sessionUserId) {
16355
+ const buyerContact = await ensureContactForUser(sessionUserId);
16356
+ if (!buyerContact) return null;
16357
+ return cartRepo().findOne({
16358
+ where: { contactId: buyerContact.id },
16359
+ relations: [...CART_CHECKOUT_RELATIONS]
16360
+ });
16361
+ }
16362
+ async function resolveCheckoutContactAndCart(b, req, sessionUid) {
16363
+ if (Number.isFinite(sessionUid)) {
16364
+ const useCustomerFlow = Boolean(entityMap.customer && entityMap.customer_contacts) && parseCheckoutContactDetails(b) != null;
16365
+ if (useCustomerFlow) {
16366
+ const resolved = await resolveCustomerCheckoutContact(b, sessionUid);
16367
+ if (!resolved.ok) {
16368
+ return { ok: false, response: json({ error: resolved.message }, { status: resolved.status }) };
16369
+ }
16370
+ const cart3 = await loadBuyerCart(sessionUid);
16371
+ return { ok: true, contactId: resolved.contactId, cart: cart3 };
16372
+ }
16373
+ const contact2 = await ensureContactForUser(sessionUid);
16374
+ if (!contact2) {
16375
+ return { ok: false, response: json({ error: "Contact required" }, { status: 400 }) };
16376
+ }
16377
+ const cart2 = await cartRepo().findOne({
16378
+ where: { contactId: contact2.id },
16379
+ relations: [...CART_CHECKOUT_RELATIONS]
16380
+ });
16381
+ return { ok: true, contactId: contact2.id, cart: cart2 };
16382
+ }
16383
+ const details = parseCheckoutContactDetails(b);
16384
+ const email = details?.email ?? String(b.email ?? "").trim().toLowerCase();
16385
+ const name = details?.name ?? String(b.name ?? "").trim();
16386
+ const phone = details?.phone ?? (b.phone != null && b.phone !== "" ? String(b.phone).trim() : null);
16387
+ if (!email || !name) {
16388
+ return {
16389
+ ok: false,
16390
+ response: json({ error: "name and email required for guest checkout" }, { status: 400 })
16391
+ };
16392
+ }
16393
+ let contact = await contactRepo().findOne({ where: { email, deleted: false } });
16394
+ if (contact && contact.userId != null) {
16395
+ return { ok: false, response: json({ error: "Please sign in to complete checkout" }, { status: 400 }) };
16396
+ }
16397
+ if (!contact) {
16398
+ contact = await contactRepo().save(
16399
+ contactRepo().create({
16400
+ name,
16401
+ email,
16402
+ phone,
16403
+ userId: null,
16404
+ deleted: false
16405
+ })
16406
+ );
16407
+ } else {
16408
+ await contactRepo().update(contact.id, {
16409
+ name,
16410
+ phone: phone ?? contact.phone
16411
+ });
16412
+ }
16413
+ const contactId = contact.id;
16414
+ const guestForErp = await contactRepo().findOne({ where: { id: contactId } });
16415
+ if (guestForErp) await syncContactToErp(guestForErp);
16416
+ const cookies = parseCookies(req.headers.get("cookie"));
16417
+ const guestToken = cookies[cookieName];
16418
+ if (!guestToken) {
16419
+ return { ok: false, response: json({ error: "Cart not found" }, { status: 400 }) };
16420
+ }
16421
+ const cart = await cartRepo().findOne({
16422
+ where: { guestToken },
16423
+ relations: [...CART_CHECKOUT_RELATIONS]
16424
+ });
16425
+ return { ok: true, contactId, cart };
16426
+ }
15335
16427
  async function getOrCreateCart(req) {
15336
16428
  const u = await getSessionUser();
15337
16429
  const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
@@ -16151,50 +17243,9 @@ function createStorefrontApiHandler(config) {
16151
17243
  if (capOrd) return capOrd;
16152
17244
  const u = await getSessionUser();
16153
17245
  const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
16154
- let contactId;
16155
- let cart;
16156
- if (Number.isFinite(uid)) {
16157
- const contact = await ensureContactForUser(uid);
16158
- if (!contact) return json({ error: "Contact required" }, { status: 400 });
16159
- contactId = contact.id;
16160
- cart = await cartRepo().findOne({
16161
- where: { contactId },
16162
- relations: [...CART_CHECKOUT_RELATIONS]
16163
- });
16164
- } else {
16165
- const email = String(b.email ?? "").trim();
16166
- const name = String(b.name ?? "").trim();
16167
- if (!email || !name) return json({ error: "name and email required for guest checkout" }, { status: 400 });
16168
- let contact = await contactRepo().findOne({ where: { email, deleted: false } });
16169
- if (contact && contact.userId != null) {
16170
- return json({ error: "Please sign in to complete checkout" }, { status: 400 });
16171
- }
16172
- if (!contact) {
16173
- contact = await contactRepo().save(
16174
- contactRepo().create({
16175
- name,
16176
- email,
16177
- phone: b.phone != null && b.phone !== "" ? String(b.phone) : null,
16178
- userId: null,
16179
- deleted: false
16180
- })
16181
- );
16182
- } else if (name)
16183
- await contactRepo().update(contact.id, {
16184
- name,
16185
- phone: b.phone != null && b.phone !== "" ? String(b.phone) : contact.phone
16186
- });
16187
- contactId = contact.id;
16188
- const guestForErp = await contactRepo().findOne({ where: { id: contactId } });
16189
- if (guestForErp) await syncContactToErp(guestForErp);
16190
- const cookies = parseCookies(req.headers.get("cookie"));
16191
- const guestToken = cookies[cookieName];
16192
- if (!guestToken) return json({ error: "Cart not found" }, { status: 400 });
16193
- cart = await cartRepo().findOne({
16194
- where: { guestToken },
16195
- relations: [...CART_CHECKOUT_RELATIONS]
16196
- });
16197
- }
17246
+ const checkoutIdentity = await resolveCheckoutContactAndCart(b, req, uid);
17247
+ if (!checkoutIdentity.ok) return checkoutIdentity.response;
17248
+ const { contactId, cart } = checkoutIdentity;
16198
17249
  if (!cart || !(cart.items || []).length) {
16199
17250
  return json({ error: "Cart is empty" }, { status: 400 });
16200
17251
  }
@@ -16257,50 +17308,9 @@ function createStorefrontApiHandler(config) {
16257
17308
  if (capChk) return capChk;
16258
17309
  const u = await getSessionUser();
16259
17310
  const uid = u?.id ? parseInt(String(u.id), 10) : NaN;
16260
- let contactId;
16261
- let cart;
16262
- if (Number.isFinite(uid)) {
16263
- const contact = await ensureContactForUser(uid);
16264
- if (!contact) return json({ error: "Contact required" }, { status: 400 });
16265
- contactId = contact.id;
16266
- cart = await cartRepo().findOne({
16267
- where: { contactId },
16268
- relations: [...CART_CHECKOUT_RELATIONS]
16269
- });
16270
- } else {
16271
- const email = String(b.email ?? "").trim();
16272
- const name = String(b.name ?? "").trim();
16273
- if (!email || !name) return json({ error: "name and email required for guest checkout" }, { status: 400 });
16274
- let contact = await contactRepo().findOne({ where: { email, deleted: false } });
16275
- if (contact && contact.userId != null) {
16276
- return json({ error: "Please sign in to complete checkout" }, { status: 400 });
16277
- }
16278
- if (!contact) {
16279
- contact = await contactRepo().save(
16280
- contactRepo().create({
16281
- name,
16282
- email,
16283
- phone: b.phone != null && b.phone !== "" ? String(b.phone) : null,
16284
- userId: null,
16285
- deleted: false
16286
- })
16287
- );
16288
- } else if (name)
16289
- await contactRepo().update(contact.id, {
16290
- name,
16291
- phone: b.phone != null && b.phone !== "" ? String(b.phone) : contact.phone
16292
- });
16293
- contactId = contact.id;
16294
- const guestForErp2 = await contactRepo().findOne({ where: { id: contactId } });
16295
- if (guestForErp2) await syncContactToErp(guestForErp2);
16296
- const cookies = parseCookies(req.headers.get("cookie"));
16297
- const guestToken = cookies[cookieName];
16298
- if (!guestToken) return json({ error: "Cart not found" }, { status: 400 });
16299
- cart = await cartRepo().findOne({
16300
- where: { guestToken },
16301
- relations: [...CART_CHECKOUT_RELATIONS]
16302
- });
16303
- }
17311
+ const checkoutIdentity = await resolveCheckoutContactAndCart(b, req, uid);
17312
+ if (!checkoutIdentity.ok) return checkoutIdentity.response;
17313
+ const { contactId, cart } = checkoutIdentity;
16304
17314
  if (!cart || !(cart.items || []).length) {
16305
17315
  return json({ error: "Cart is empty" }, { status: 400 });
16306
17316
  }
@@ -16371,7 +17381,7 @@ function createStorefrontApiHandler(config) {
16371
17381
  const previewByOrder = {};
16372
17382
  if (orderIds.length) {
16373
17383
  const oItems = await orderItemRepo().find({
16374
- where: { orderId: (0, import_typeorm63.In)(orderIds) },
17384
+ where: { orderId: (0, import_typeorm65.In)(orderIds) },
16375
17385
  relations: ["product"],
16376
17386
  order: { id: "ASC" }
16377
17387
  });