@htlkg/data 0.0.20 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/index.d.ts +659 -66
- package/dist/hooks/index.js +711 -42
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1098 -51
- package/dist/index.js.map +1 -1
- package/dist/mutations/index.d.ts +338 -2
- package/dist/mutations/index.js +290 -4
- package/dist/mutations/index.js.map +1 -1
- package/dist/queries/index.d.ts +110 -2
- package/dist/queries/index.js +115 -6
- package/dist/queries/index.js.map +1 -1
- package/package.json +2 -2
- package/src/hooks/accounts/index.ts +2 -0
- package/src/hooks/{useAccounts.ts → accounts/useAccounts.ts} +48 -5
- package/src/hooks/accounts/usePaginatedAccounts.ts +166 -0
- package/src/hooks/brands/index.ts +2 -0
- package/src/hooks/{useBrands.ts → brands/useBrands.ts} +1 -1
- package/src/hooks/brands/usePaginatedBrands.ts +206 -0
- package/src/hooks/createPaginatedDataHook.ts +359 -0
- package/src/hooks/data-hook-errors.property.test.ts +4 -4
- package/src/hooks/data-hook-filters.property.test.ts +4 -4
- package/src/hooks/data-hooks.property.test.ts +4 -4
- package/src/hooks/index.ts +96 -7
- package/src/hooks/productInstances/index.ts +1 -0
- package/src/hooks/{useProductInstances.ts → productInstances/useProductInstances.ts} +9 -6
- package/src/hooks/products/index.ts +1 -0
- package/src/hooks/{useProducts.ts → products/useProducts.ts} +4 -5
- package/src/hooks/reservations/index.ts +2 -0
- package/src/hooks/reservations/usePaginatedReservations.ts +258 -0
- package/src/hooks/{useReservations.ts → reservations/useReservations.ts} +65 -10
- package/src/hooks/useContacts.test.ts +159 -0
- package/src/hooks/useContacts.ts +176 -0
- package/src/hooks/users/index.ts +2 -0
- package/src/hooks/users/usePaginatedUsers.ts +213 -0
- package/src/hooks/{useUsers.ts → users/useUsers.ts} +1 -1
- package/src/mutations/accounts/accounts.test.ts +287 -0
- package/src/mutations/{accounts.ts → accounts/accounts.ts} +2 -2
- package/src/mutations/accounts/index.ts +1 -0
- package/src/mutations/brands/brands.test.ts +292 -0
- package/src/mutations/{brands.ts → brands/brands.ts} +2 -2
- package/src/mutations/brands/index.ts +1 -0
- package/src/mutations/contacts.test.ts +604 -0
- package/src/mutations/contacts.ts +554 -0
- package/src/mutations/index.ts +18 -0
- package/src/mutations/reservations/index.ts +1 -0
- package/src/mutations/{reservations.test.ts → reservations/reservations.test.ts} +1 -1
- package/src/mutations/{reservations.ts → reservations/reservations.ts} +2 -2
- package/src/mutations/users/index.ts +1 -0
- package/src/mutations/users/users.test.ts +289 -0
- package/src/mutations/{users.ts → users/users.ts} +2 -2
- package/src/queries/accounts/accounts.test.ts +228 -0
- package/src/queries/accounts/index.ts +1 -0
- package/src/queries/brands/brands.test.ts +288 -0
- package/src/queries/brands/index.ts +1 -0
- package/src/queries/contacts.test.ts +505 -0
- package/src/queries/contacts.ts +237 -0
- package/src/queries/index.ts +10 -0
- package/src/queries/products/index.ts +1 -0
- package/src/queries/products/products.test.ts +347 -0
- package/src/queries/reservations/index.ts +1 -0
- package/src/queries/users/index.ts +1 -0
- package/src/queries/users/users.test.ts +301 -0
- /package/src/queries/{accounts.ts → accounts/accounts.ts} +0 -0
- /package/src/queries/{brands.ts → brands/brands.ts} +0 -0
- /package/src/queries/{products.ts → products/products.ts} +0 -0
- /package/src/queries/{reservations.test.ts → reservations/reservations.test.ts} +0 -0
- /package/src/queries/{reservations.ts → reservations/reservations.ts} +0 -0
- /package/src/queries/{users.ts → users/users.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -77,7 +77,7 @@ function generateServerClient(_options) {
|
|
|
77
77
|
return client;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// src/queries/brands.ts
|
|
80
|
+
// src/queries/brands/brands.ts
|
|
81
81
|
async function getBrand(client, id) {
|
|
82
82
|
try {
|
|
83
83
|
const { data, errors } = await client.models.Brand.get({ id });
|
|
@@ -149,7 +149,7 @@ async function listActiveBrands(client, options) {
|
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
// src/queries/accounts.ts
|
|
152
|
+
// src/queries/accounts/accounts.ts
|
|
153
153
|
async function getAccount(client, id) {
|
|
154
154
|
try {
|
|
155
155
|
const { data, errors } = await client.models.Account.get({ id });
|
|
@@ -205,7 +205,7 @@ async function getAccountWithBrands(client, id) {
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
// src/queries/users.ts
|
|
208
|
+
// src/queries/users/users.ts
|
|
209
209
|
async function getUser(client, id) {
|
|
210
210
|
try {
|
|
211
211
|
const { data, errors } = await client.models.User.get({ id });
|
|
@@ -282,7 +282,7 @@ async function listActiveUsers(client, options) {
|
|
|
282
282
|
});
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
// src/queries/products.ts
|
|
285
|
+
// src/queries/products/products.ts
|
|
286
286
|
async function getProduct(client, id) {
|
|
287
287
|
try {
|
|
288
288
|
const { data, errors } = await client.models.Product.get({ id });
|
|
@@ -487,7 +487,7 @@ function checkRestoreEligibility(deletedAt, retentionDays) {
|
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
// src/queries/reservations.ts
|
|
490
|
+
// src/queries/reservations/reservations.ts
|
|
491
491
|
async function getReservation2(client, id) {
|
|
492
492
|
try {
|
|
493
493
|
const { data, errors } = await client.models.Reservation.get({ id });
|
|
@@ -563,7 +563,110 @@ async function getReservationByConfirmation(client, confirmationCode, brandId) {
|
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
-
// src/
|
|
566
|
+
// src/queries/contacts.ts
|
|
567
|
+
async function getContact(client, id) {
|
|
568
|
+
try {
|
|
569
|
+
const { data, errors } = await client.models.Contact.get({ id });
|
|
570
|
+
if (errors) {
|
|
571
|
+
console.error("[getContact] GraphQL errors:", errors);
|
|
572
|
+
return null;
|
|
573
|
+
}
|
|
574
|
+
return data;
|
|
575
|
+
} catch (error) {
|
|
576
|
+
console.error("[getContact] Error fetching contact:", error);
|
|
577
|
+
throw error;
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
async function listContacts(client, options) {
|
|
581
|
+
try {
|
|
582
|
+
const { data, errors, nextToken } = await client.models.Contact.list(options);
|
|
583
|
+
if (errors) {
|
|
584
|
+
console.error("[listContacts] GraphQL errors:", errors);
|
|
585
|
+
return { items: [], nextToken: void 0 };
|
|
586
|
+
}
|
|
587
|
+
return {
|
|
588
|
+
items: data || [],
|
|
589
|
+
nextToken
|
|
590
|
+
};
|
|
591
|
+
} catch (error) {
|
|
592
|
+
console.error("[listContacts] Error fetching contacts:", error);
|
|
593
|
+
throw error;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
async function listContactsByBrand(client, brandId, options) {
|
|
597
|
+
return listContacts(client, {
|
|
598
|
+
filter: { brandId: { eq: brandId } },
|
|
599
|
+
...options
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
async function getContactByEmail(client, email, brandId) {
|
|
603
|
+
try {
|
|
604
|
+
const { data, errors } = await client.models.Contact.list({
|
|
605
|
+
filter: {
|
|
606
|
+
and: [{ email: { eq: email } }, { brandId: { eq: brandId } }]
|
|
607
|
+
},
|
|
608
|
+
limit: 1
|
|
609
|
+
});
|
|
610
|
+
if (errors) {
|
|
611
|
+
console.error("[getContactByEmail] GraphQL errors:", errors);
|
|
612
|
+
return null;
|
|
613
|
+
}
|
|
614
|
+
return data?.[0];
|
|
615
|
+
} catch (error) {
|
|
616
|
+
console.error("[getContactByEmail] Error fetching contact:", error);
|
|
617
|
+
throw error;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
async function getContactByPhone(client, phone, brandId) {
|
|
621
|
+
try {
|
|
622
|
+
const { data, errors } = await client.models.Contact.list({
|
|
623
|
+
filter: {
|
|
624
|
+
and: [{ phone: { eq: phone } }, { brandId: { eq: brandId } }]
|
|
625
|
+
},
|
|
626
|
+
limit: 1
|
|
627
|
+
});
|
|
628
|
+
if (errors) {
|
|
629
|
+
console.error("[getContactByPhone] GraphQL errors:", errors);
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
return data?.[0];
|
|
633
|
+
} catch (error) {
|
|
634
|
+
console.error("[getContactByPhone] Error fetching contact:", error);
|
|
635
|
+
throw error;
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
async function searchContacts(client, query2, brandId, options) {
|
|
639
|
+
try {
|
|
640
|
+
const { data, errors, nextToken } = await client.models.Contact.list({
|
|
641
|
+
filter: {
|
|
642
|
+
and: [
|
|
643
|
+
{ brandId: { eq: brandId } },
|
|
644
|
+
{
|
|
645
|
+
or: [
|
|
646
|
+
{ email: { contains: query2 } },
|
|
647
|
+
{ firstName: { contains: query2 } },
|
|
648
|
+
{ lastName: { contains: query2 } }
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
},
|
|
653
|
+
...options
|
|
654
|
+
});
|
|
655
|
+
if (errors) {
|
|
656
|
+
console.error("[searchContacts] GraphQL errors:", errors);
|
|
657
|
+
return { items: [], nextToken: void 0 };
|
|
658
|
+
}
|
|
659
|
+
return {
|
|
660
|
+
items: data || [],
|
|
661
|
+
nextToken
|
|
662
|
+
};
|
|
663
|
+
} catch (error) {
|
|
664
|
+
console.error("[searchContacts] Error searching contacts:", error);
|
|
665
|
+
throw error;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
// src/mutations/brands/brands.ts
|
|
567
670
|
async function createBrand(client, input) {
|
|
568
671
|
try {
|
|
569
672
|
const { data, errors } = await client.models.Brand.create(input);
|
|
@@ -651,7 +754,7 @@ async function deleteBrand(client, id) {
|
|
|
651
754
|
}
|
|
652
755
|
}
|
|
653
756
|
|
|
654
|
-
// src/mutations/accounts.ts
|
|
757
|
+
// src/mutations/accounts/accounts.ts
|
|
655
758
|
async function createAccount(client, input) {
|
|
656
759
|
try {
|
|
657
760
|
const { data, errors } = await client.models.Account.create(input);
|
|
@@ -739,7 +842,7 @@ async function deleteAccount(client, id) {
|
|
|
739
842
|
}
|
|
740
843
|
}
|
|
741
844
|
|
|
742
|
-
// src/mutations/users.ts
|
|
845
|
+
// src/mutations/users/users.ts
|
|
743
846
|
async function createUser(client, input) {
|
|
744
847
|
try {
|
|
745
848
|
const { data, errors } = await client.models.User.create(input);
|
|
@@ -1041,7 +1144,7 @@ async function initializeSystemSettings(client, initializedBy) {
|
|
|
1041
1144
|
}
|
|
1042
1145
|
}
|
|
1043
1146
|
|
|
1044
|
-
// src/mutations/reservations.ts
|
|
1147
|
+
// src/mutations/reservations/reservations.ts
|
|
1045
1148
|
var STATUS_TRANSITIONS = {
|
|
1046
1149
|
confirmed: ["checked_in", "cancelled", "no_show"],
|
|
1047
1150
|
checked_in: ["checked_out", "cancelled"],
|
|
@@ -1234,6 +1337,265 @@ async function updateReservationStatus2(client, id, newStatus) {
|
|
|
1234
1337
|
}
|
|
1235
1338
|
}
|
|
1236
1339
|
|
|
1340
|
+
// src/mutations/contacts.ts
|
|
1341
|
+
import { z } from "zod";
|
|
1342
|
+
var createContactSchema = z.object({
|
|
1343
|
+
brandId: z.string().min(1, "Brand ID is required"),
|
|
1344
|
+
email: z.string().email("Invalid email address"),
|
|
1345
|
+
phone: z.string().optional(),
|
|
1346
|
+
firstName: z.string().min(1, "First name is required"),
|
|
1347
|
+
lastName: z.string().min(1, "Last name is required"),
|
|
1348
|
+
locale: z.string().optional(),
|
|
1349
|
+
gdprConsent: z.boolean(),
|
|
1350
|
+
gdprConsentDate: z.string().optional(),
|
|
1351
|
+
marketingOptIn: z.boolean().optional(),
|
|
1352
|
+
preferences: z.record(z.any()).optional(),
|
|
1353
|
+
tags: z.array(z.string()).optional(),
|
|
1354
|
+
totalVisits: z.number().int().min(0).optional(),
|
|
1355
|
+
lastVisitDate: z.string().optional(),
|
|
1356
|
+
firstVisitDate: z.string().optional(),
|
|
1357
|
+
legacyId: z.string().optional(),
|
|
1358
|
+
// Audit fields
|
|
1359
|
+
createdAt: z.string().optional(),
|
|
1360
|
+
createdBy: z.string().optional(),
|
|
1361
|
+
updatedAt: z.string().optional(),
|
|
1362
|
+
updatedBy: z.string().optional()
|
|
1363
|
+
});
|
|
1364
|
+
var updateContactSchema = z.object({
|
|
1365
|
+
id: z.string().min(1, "Contact ID is required"),
|
|
1366
|
+
brandId: z.string().min(1).optional(),
|
|
1367
|
+
email: z.string().email("Invalid email address").optional(),
|
|
1368
|
+
phone: z.string().optional(),
|
|
1369
|
+
firstName: z.string().min(1).optional(),
|
|
1370
|
+
lastName: z.string().min(1).optional(),
|
|
1371
|
+
locale: z.string().optional(),
|
|
1372
|
+
gdprConsent: z.boolean().optional(),
|
|
1373
|
+
gdprConsentDate: z.string().optional(),
|
|
1374
|
+
marketingOptIn: z.boolean().optional(),
|
|
1375
|
+
preferences: z.record(z.any()).optional(),
|
|
1376
|
+
tags: z.array(z.string()).optional(),
|
|
1377
|
+
totalVisits: z.number().int().min(0).optional(),
|
|
1378
|
+
lastVisitDate: z.string().optional(),
|
|
1379
|
+
firstVisitDate: z.string().optional(),
|
|
1380
|
+
legacyId: z.string().optional(),
|
|
1381
|
+
// Audit fields
|
|
1382
|
+
updatedAt: z.string().optional(),
|
|
1383
|
+
updatedBy: z.string().optional(),
|
|
1384
|
+
deletedAt: z.string().nullable().optional(),
|
|
1385
|
+
deletedBy: z.string().nullable().optional()
|
|
1386
|
+
});
|
|
1387
|
+
var mergeContactsSchema = z.object({
|
|
1388
|
+
primaryId: z.string().min(1, "Primary contact ID is required"),
|
|
1389
|
+
duplicateIds: z.array(z.string().min(1)).min(1, "At least one duplicate ID is required")
|
|
1390
|
+
});
|
|
1391
|
+
var ContactValidationError = class extends Error {
|
|
1392
|
+
issues;
|
|
1393
|
+
constructor(message, issues = []) {
|
|
1394
|
+
super(message);
|
|
1395
|
+
this.name = "ContactValidationError";
|
|
1396
|
+
this.issues = issues;
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
async function createContact(client, input) {
|
|
1400
|
+
try {
|
|
1401
|
+
const validationResult = createContactSchema.safeParse(input);
|
|
1402
|
+
if (!validationResult.success) {
|
|
1403
|
+
const errorMessage = validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ");
|
|
1404
|
+
throw new ContactValidationError(
|
|
1405
|
+
`Validation failed: ${errorMessage}`,
|
|
1406
|
+
validationResult.error.issues
|
|
1407
|
+
);
|
|
1408
|
+
}
|
|
1409
|
+
const { data, errors } = await client.models.Contact.create(input);
|
|
1410
|
+
if (errors) {
|
|
1411
|
+
console.error("[createContact] GraphQL errors:", errors);
|
|
1412
|
+
return null;
|
|
1413
|
+
}
|
|
1414
|
+
return data;
|
|
1415
|
+
} catch (error) {
|
|
1416
|
+
if (error instanceof ContactValidationError) {
|
|
1417
|
+
console.error("[createContact] Validation error:", error.message);
|
|
1418
|
+
throw error;
|
|
1419
|
+
}
|
|
1420
|
+
console.error("[createContact] Error creating contact:", error);
|
|
1421
|
+
throw error;
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
async function updateContact(client, input) {
|
|
1425
|
+
try {
|
|
1426
|
+
const validationResult = updateContactSchema.safeParse(input);
|
|
1427
|
+
if (!validationResult.success) {
|
|
1428
|
+
const errorMessage = validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ");
|
|
1429
|
+
throw new ContactValidationError(
|
|
1430
|
+
`Validation failed: ${errorMessage}`,
|
|
1431
|
+
validationResult.error.issues
|
|
1432
|
+
);
|
|
1433
|
+
}
|
|
1434
|
+
const { data, errors } = await client.models.Contact.update(input);
|
|
1435
|
+
if (errors) {
|
|
1436
|
+
console.error("[updateContact] GraphQL errors:", errors);
|
|
1437
|
+
return null;
|
|
1438
|
+
}
|
|
1439
|
+
return data;
|
|
1440
|
+
} catch (error) {
|
|
1441
|
+
if (error instanceof ContactValidationError) {
|
|
1442
|
+
console.error("[updateContact] Validation error:", error.message);
|
|
1443
|
+
throw error;
|
|
1444
|
+
}
|
|
1445
|
+
console.error("[updateContact] Error updating contact:", error);
|
|
1446
|
+
throw error;
|
|
1447
|
+
}
|
|
1448
|
+
}
|
|
1449
|
+
async function softDeleteContact(client, id, deletedBy) {
|
|
1450
|
+
try {
|
|
1451
|
+
const { errors } = await client.models.Contact.update({
|
|
1452
|
+
id,
|
|
1453
|
+
deletedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1454
|
+
deletedBy
|
|
1455
|
+
});
|
|
1456
|
+
if (errors) {
|
|
1457
|
+
console.error("[softDeleteContact] GraphQL errors:", errors);
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
return true;
|
|
1461
|
+
} catch (error) {
|
|
1462
|
+
console.error("[softDeleteContact] Error soft-deleting contact:", error);
|
|
1463
|
+
throw error;
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
async function restoreContact(client, id, retentionDays = DEFAULT_SOFT_DELETE_RETENTION_DAYS) {
|
|
1467
|
+
try {
|
|
1468
|
+
const contact = await getContact(client, id);
|
|
1469
|
+
if (!contact) {
|
|
1470
|
+
console.error("[restoreContact] Contact not found");
|
|
1471
|
+
return { success: false, error: "Contact not found" };
|
|
1472
|
+
}
|
|
1473
|
+
const eligibility = checkRestoreEligibility(
|
|
1474
|
+
contact.deletedAt,
|
|
1475
|
+
retentionDays
|
|
1476
|
+
);
|
|
1477
|
+
if (!eligibility.canRestore) {
|
|
1478
|
+
const errorMsg = `Cannot restore contact. Retention period of ${retentionDays} days has expired. Item was deleted ${eligibility.daysExpired} days ago.`;
|
|
1479
|
+
console.error("[restoreContact]", errorMsg);
|
|
1480
|
+
return { success: false, error: errorMsg };
|
|
1481
|
+
}
|
|
1482
|
+
const { errors } = await client.models.Contact.update({
|
|
1483
|
+
id,
|
|
1484
|
+
deletedAt: null,
|
|
1485
|
+
deletedBy: null
|
|
1486
|
+
});
|
|
1487
|
+
if (errors) {
|
|
1488
|
+
console.error("[restoreContact] GraphQL errors:", errors);
|
|
1489
|
+
return { success: false, error: "Failed to restore contact" };
|
|
1490
|
+
}
|
|
1491
|
+
return { success: true };
|
|
1492
|
+
} catch (error) {
|
|
1493
|
+
console.error("[restoreContact] Error restoring contact:", error);
|
|
1494
|
+
throw error;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
async function deleteContact(client, id) {
|
|
1498
|
+
try {
|
|
1499
|
+
const { errors } = await client.models.Contact.delete({ id });
|
|
1500
|
+
if (errors) {
|
|
1501
|
+
console.error("[deleteContact] GraphQL errors:", errors);
|
|
1502
|
+
return false;
|
|
1503
|
+
}
|
|
1504
|
+
return true;
|
|
1505
|
+
} catch (error) {
|
|
1506
|
+
console.error("[deleteContact] Error deleting contact:", error);
|
|
1507
|
+
throw error;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
async function mergeContacts(client, input, mergedBy) {
|
|
1511
|
+
try {
|
|
1512
|
+
const validationResult = mergeContactsSchema.safeParse(input);
|
|
1513
|
+
if (!validationResult.success) {
|
|
1514
|
+
const errorMessage = validationResult.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ");
|
|
1515
|
+
throw new ContactValidationError(
|
|
1516
|
+
`Validation failed: ${errorMessage}`,
|
|
1517
|
+
validationResult.error.issues
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
const { primaryId, duplicateIds } = input;
|
|
1521
|
+
const primaryContact = await getContact(client, primaryId);
|
|
1522
|
+
if (!primaryContact) {
|
|
1523
|
+
return {
|
|
1524
|
+
success: false,
|
|
1525
|
+
error: `Primary contact not found: ${primaryId}`
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
const duplicateContacts = [];
|
|
1529
|
+
for (const duplicateId of duplicateIds) {
|
|
1530
|
+
const duplicate = await getContact(client, duplicateId);
|
|
1531
|
+
if (!duplicate) {
|
|
1532
|
+
return {
|
|
1533
|
+
success: false,
|
|
1534
|
+
error: `Duplicate contact not found: ${duplicateId}`
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
duplicateContacts.push(duplicate);
|
|
1538
|
+
}
|
|
1539
|
+
let totalVisits = primaryContact.totalVisits || 0;
|
|
1540
|
+
let firstVisitDate = primaryContact.firstVisitDate;
|
|
1541
|
+
let lastVisitDate = primaryContact.lastVisitDate;
|
|
1542
|
+
const allTags = new Set(primaryContact.tags || []);
|
|
1543
|
+
for (const duplicate of duplicateContacts) {
|
|
1544
|
+
totalVisits += duplicate.totalVisits || 0;
|
|
1545
|
+
if (duplicate.firstVisitDate) {
|
|
1546
|
+
if (!firstVisitDate || duplicate.firstVisitDate < firstVisitDate) {
|
|
1547
|
+
firstVisitDate = duplicate.firstVisitDate;
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
if (duplicate.lastVisitDate) {
|
|
1551
|
+
if (!lastVisitDate || duplicate.lastVisitDate > lastVisitDate) {
|
|
1552
|
+
lastVisitDate = duplicate.lastVisitDate;
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
if (duplicate.tags) {
|
|
1556
|
+
duplicate.tags.forEach((tag) => allTags.add(tag));
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
const updateInput = {
|
|
1560
|
+
id: primaryId,
|
|
1561
|
+
totalVisits,
|
|
1562
|
+
firstVisitDate,
|
|
1563
|
+
lastVisitDate,
|
|
1564
|
+
tags: Array.from(allTags),
|
|
1565
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1566
|
+
updatedBy: mergedBy
|
|
1567
|
+
};
|
|
1568
|
+
const updatedPrimary = await updateContact(client, updateInput);
|
|
1569
|
+
if (!updatedPrimary) {
|
|
1570
|
+
return {
|
|
1571
|
+
success: false,
|
|
1572
|
+
error: "Failed to update primary contact with merged data"
|
|
1573
|
+
};
|
|
1574
|
+
}
|
|
1575
|
+
const deletedIds = [];
|
|
1576
|
+
for (const duplicateId of duplicateIds) {
|
|
1577
|
+
const deleted = await softDeleteContact(client, duplicateId, mergedBy);
|
|
1578
|
+
if (deleted) {
|
|
1579
|
+
deletedIds.push(duplicateId);
|
|
1580
|
+
} else {
|
|
1581
|
+
console.error(`[mergeContacts] Failed to soft-delete duplicate: ${duplicateId}`);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
return {
|
|
1585
|
+
success: true,
|
|
1586
|
+
mergedContact: updatedPrimary,
|
|
1587
|
+
deletedIds
|
|
1588
|
+
};
|
|
1589
|
+
} catch (error) {
|
|
1590
|
+
if (error instanceof ContactValidationError) {
|
|
1591
|
+
console.error("[mergeContacts] Validation error:", error.message);
|
|
1592
|
+
throw error;
|
|
1593
|
+
}
|
|
1594
|
+
console.error("[mergeContacts] Error merging contacts:", error);
|
|
1595
|
+
throw error;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1237
1599
|
// src/hooks/createDataHook.ts
|
|
1238
1600
|
import { ref, computed, onMounted } from "vue";
|
|
1239
1601
|
function resetClientInstance() {
|
|
@@ -1244,7 +1606,7 @@ function createDataHook(config) {
|
|
|
1244
1606
|
defaultLimit,
|
|
1245
1607
|
selectionSet,
|
|
1246
1608
|
transform,
|
|
1247
|
-
buildFilter:
|
|
1609
|
+
buildFilter: buildFilter10,
|
|
1248
1610
|
computedProperties,
|
|
1249
1611
|
dataPropertyName = "data"
|
|
1250
1612
|
} = config;
|
|
@@ -1254,8 +1616,8 @@ function createDataHook(config) {
|
|
|
1254
1616
|
const loading = ref(false);
|
|
1255
1617
|
const error = ref(null);
|
|
1256
1618
|
const getFilter = () => {
|
|
1257
|
-
if (
|
|
1258
|
-
return
|
|
1619
|
+
if (buildFilter10) {
|
|
1620
|
+
return buildFilter10(options);
|
|
1259
1621
|
}
|
|
1260
1622
|
return baseFilter && Object.keys(baseFilter).length > 0 ? baseFilter : void 0;
|
|
1261
1623
|
};
|
|
@@ -1315,7 +1677,171 @@ function createDataHook(config) {
|
|
|
1315
1677
|
};
|
|
1316
1678
|
}
|
|
1317
1679
|
|
|
1318
|
-
// src/hooks/
|
|
1680
|
+
// src/hooks/createPaginatedDataHook.ts
|
|
1681
|
+
import { ref as ref2, computed as computed2, onMounted as onMounted2 } from "vue";
|
|
1682
|
+
var ACTIVE_FILTER = {
|
|
1683
|
+
or: [{ deletedAt: { attributeExists: false } }, { deletedAt: { eq: null } }]
|
|
1684
|
+
};
|
|
1685
|
+
var DELETED_FILTER = {
|
|
1686
|
+
deletedAt: { gt: "" }
|
|
1687
|
+
};
|
|
1688
|
+
function createPaginatedDataHook(config) {
|
|
1689
|
+
const {
|
|
1690
|
+
model,
|
|
1691
|
+
defaultPageSize = 25,
|
|
1692
|
+
selectionSet,
|
|
1693
|
+
transform,
|
|
1694
|
+
buildFilter: buildFilter10,
|
|
1695
|
+
dataPropertyName = "data",
|
|
1696
|
+
baseFilter
|
|
1697
|
+
} = config;
|
|
1698
|
+
return function usePaginatedData(options = {}) {
|
|
1699
|
+
const { filter: additionalFilter, pageSize = defaultPageSize, autoFetch = true } = options;
|
|
1700
|
+
const data = ref2([]);
|
|
1701
|
+
const loading = ref2(false);
|
|
1702
|
+
const initialLoading = ref2(false);
|
|
1703
|
+
const loadingMore = ref2(false);
|
|
1704
|
+
const error = ref2(null);
|
|
1705
|
+
const pagination = ref2({
|
|
1706
|
+
nextToken: null,
|
|
1707
|
+
hasMore: true,
|
|
1708
|
+
loadedCount: 0
|
|
1709
|
+
});
|
|
1710
|
+
const searchFilter = ref2(null);
|
|
1711
|
+
const hasMore = computed2(() => pagination.value.hasMore);
|
|
1712
|
+
const getFilter = () => {
|
|
1713
|
+
const filters = [];
|
|
1714
|
+
if (baseFilter) {
|
|
1715
|
+
filters.push(baseFilter);
|
|
1716
|
+
}
|
|
1717
|
+
if (buildFilter10) {
|
|
1718
|
+
const customFilter = buildFilter10(options);
|
|
1719
|
+
if (customFilter) {
|
|
1720
|
+
filters.push(customFilter);
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
if (additionalFilter && Object.keys(additionalFilter).length > 0) {
|
|
1724
|
+
filters.push(additionalFilter);
|
|
1725
|
+
}
|
|
1726
|
+
if (searchFilter.value && Object.keys(searchFilter.value).length > 0) {
|
|
1727
|
+
filters.push(searchFilter.value);
|
|
1728
|
+
}
|
|
1729
|
+
if (filters.length === 0) {
|
|
1730
|
+
return void 0;
|
|
1731
|
+
}
|
|
1732
|
+
if (filters.length === 1) {
|
|
1733
|
+
return filters[0];
|
|
1734
|
+
}
|
|
1735
|
+
return { and: filters };
|
|
1736
|
+
};
|
|
1737
|
+
async function fetchPage(nextToken, append = false) {
|
|
1738
|
+
if (!append) {
|
|
1739
|
+
initialLoading.value = true;
|
|
1740
|
+
} else {
|
|
1741
|
+
loadingMore.value = true;
|
|
1742
|
+
}
|
|
1743
|
+
loading.value = true;
|
|
1744
|
+
error.value = null;
|
|
1745
|
+
try {
|
|
1746
|
+
const queryOptions = {
|
|
1747
|
+
limit: pageSize
|
|
1748
|
+
};
|
|
1749
|
+
const filter = getFilter();
|
|
1750
|
+
if (filter) {
|
|
1751
|
+
queryOptions.filter = filter;
|
|
1752
|
+
}
|
|
1753
|
+
if (nextToken) {
|
|
1754
|
+
queryOptions.nextToken = nextToken;
|
|
1755
|
+
}
|
|
1756
|
+
if (selectionSet) {
|
|
1757
|
+
queryOptions.selectionSet = selectionSet;
|
|
1758
|
+
}
|
|
1759
|
+
const response = await query(model, "list", queryOptions);
|
|
1760
|
+
if (hasErrors(response)) {
|
|
1761
|
+
throw new Error(getErrorMessage(response) || `Failed to fetch ${model}`);
|
|
1762
|
+
}
|
|
1763
|
+
const items = response.data || [];
|
|
1764
|
+
const transformedItems = transform ? items.map(transform) : items;
|
|
1765
|
+
if (append) {
|
|
1766
|
+
data.value = [...data.value, ...transformedItems];
|
|
1767
|
+
} else {
|
|
1768
|
+
data.value = transformedItems;
|
|
1769
|
+
}
|
|
1770
|
+
const responseNextToken = response.nextToken;
|
|
1771
|
+
pagination.value = {
|
|
1772
|
+
nextToken: responseNextToken || null,
|
|
1773
|
+
hasMore: !!responseNextToken,
|
|
1774
|
+
loadedCount: data.value.length
|
|
1775
|
+
};
|
|
1776
|
+
} catch (e) {
|
|
1777
|
+
error.value = e;
|
|
1778
|
+
console.error(`[use${model}] Error fetching ${model}:`, e);
|
|
1779
|
+
} finally {
|
|
1780
|
+
loading.value = false;
|
|
1781
|
+
initialLoading.value = false;
|
|
1782
|
+
loadingMore.value = false;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
async function loadMore() {
|
|
1786
|
+
if (loadingMore.value || !pagination.value.hasMore) {
|
|
1787
|
+
return;
|
|
1788
|
+
}
|
|
1789
|
+
await fetchPage(pagination.value.nextToken, true);
|
|
1790
|
+
}
|
|
1791
|
+
async function refetch() {
|
|
1792
|
+
pagination.value = {
|
|
1793
|
+
nextToken: null,
|
|
1794
|
+
hasMore: true,
|
|
1795
|
+
loadedCount: 0
|
|
1796
|
+
};
|
|
1797
|
+
await fetchPage(null, false);
|
|
1798
|
+
}
|
|
1799
|
+
function reset() {
|
|
1800
|
+
data.value = [];
|
|
1801
|
+
error.value = null;
|
|
1802
|
+
searchFilter.value = null;
|
|
1803
|
+
pagination.value = {
|
|
1804
|
+
nextToken: null,
|
|
1805
|
+
hasMore: true,
|
|
1806
|
+
loadedCount: 0
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
async function setSearchFilter(filter) {
|
|
1810
|
+
searchFilter.value = filter;
|
|
1811
|
+
pagination.value = {
|
|
1812
|
+
nextToken: null,
|
|
1813
|
+
hasMore: true,
|
|
1814
|
+
loadedCount: 0
|
|
1815
|
+
};
|
|
1816
|
+
await fetchPage(null, false);
|
|
1817
|
+
}
|
|
1818
|
+
if (autoFetch) {
|
|
1819
|
+
onMounted2(() => {
|
|
1820
|
+
fetchPage(null, false);
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
const result = {
|
|
1824
|
+
data,
|
|
1825
|
+
loading,
|
|
1826
|
+
initialLoading,
|
|
1827
|
+
loadingMore,
|
|
1828
|
+
error,
|
|
1829
|
+
pagination,
|
|
1830
|
+
hasMore,
|
|
1831
|
+
loadMore,
|
|
1832
|
+
refetch,
|
|
1833
|
+
reset,
|
|
1834
|
+
setSearchFilter,
|
|
1835
|
+
searchFilter
|
|
1836
|
+
};
|
|
1837
|
+
if (dataPropertyName !== "data") {
|
|
1838
|
+
result[dataPropertyName] = data;
|
|
1839
|
+
}
|
|
1840
|
+
return result;
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
|
|
1844
|
+
// src/hooks/brands/useBrands.ts
|
|
1319
1845
|
function buildFilter(options) {
|
|
1320
1846
|
let filter = options.filter || {};
|
|
1321
1847
|
if (options.accountId) {
|
|
@@ -1345,23 +1871,96 @@ function useBrands(options = {}) {
|
|
|
1345
1871
|
};
|
|
1346
1872
|
}
|
|
1347
1873
|
|
|
1348
|
-
// src/hooks/
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1874
|
+
// src/hooks/brands/usePaginatedBrands.ts
|
|
1875
|
+
function buildFilter2(options) {
|
|
1876
|
+
const conditions = [];
|
|
1877
|
+
if (options.accountId) {
|
|
1878
|
+
conditions.push({ accountId: { eq: options.accountId } });
|
|
1879
|
+
}
|
|
1880
|
+
if (options.filter && Object.keys(options.filter).length > 0) {
|
|
1881
|
+
conditions.push(options.filter);
|
|
1882
|
+
}
|
|
1883
|
+
if (conditions.length === 0) {
|
|
1884
|
+
return void 0;
|
|
1885
|
+
}
|
|
1886
|
+
if (conditions.length === 1) {
|
|
1887
|
+
return conditions[0];
|
|
1888
|
+
}
|
|
1889
|
+
return { and: conditions };
|
|
1890
|
+
}
|
|
1891
|
+
function transformBrand(brand) {
|
|
1892
|
+
return {
|
|
1893
|
+
...brand,
|
|
1894
|
+
accountName: brand.account?.name || ""
|
|
1895
|
+
};
|
|
1896
|
+
}
|
|
1897
|
+
var BRAND_SELECTION_SET = [
|
|
1898
|
+
"id",
|
|
1899
|
+
"name",
|
|
1900
|
+
"accountId",
|
|
1901
|
+
"logo",
|
|
1902
|
+
"timezone",
|
|
1903
|
+
"status",
|
|
1904
|
+
"settings",
|
|
1905
|
+
"deletedAt",
|
|
1906
|
+
"deletedBy",
|
|
1907
|
+
"account.name"
|
|
1908
|
+
];
|
|
1909
|
+
var useActiveBrandsInternal = createPaginatedDataHook({
|
|
1910
|
+
model: "Brand",
|
|
1911
|
+
dataPropertyName: "brands",
|
|
1912
|
+
defaultPageSize: 25,
|
|
1913
|
+
selectionSet: BRAND_SELECTION_SET,
|
|
1914
|
+
transform: transformBrand,
|
|
1915
|
+
buildFilter: buildFilter2,
|
|
1916
|
+
baseFilter: ACTIVE_FILTER
|
|
1352
1917
|
});
|
|
1353
|
-
|
|
1354
|
-
|
|
1918
|
+
var useDeletedBrandsInternal = createPaginatedDataHook({
|
|
1919
|
+
model: "Brand",
|
|
1920
|
+
dataPropertyName: "brands",
|
|
1921
|
+
defaultPageSize: 25,
|
|
1922
|
+
selectionSet: BRAND_SELECTION_SET,
|
|
1923
|
+
transform: transformBrand,
|
|
1924
|
+
buildFilter: buildFilter2,
|
|
1925
|
+
baseFilter: DELETED_FILTER
|
|
1926
|
+
});
|
|
1927
|
+
function useActiveBrands(options = {}) {
|
|
1928
|
+
const result = useActiveBrandsInternal(options);
|
|
1355
1929
|
return {
|
|
1356
|
-
|
|
1930
|
+
brands: result.brands,
|
|
1357
1931
|
loading: result.loading,
|
|
1932
|
+
initialLoading: result.initialLoading,
|
|
1933
|
+
loadingMore: result.loadingMore,
|
|
1358
1934
|
error: result.error,
|
|
1359
|
-
|
|
1935
|
+
pagination: result.pagination,
|
|
1936
|
+
hasMore: result.hasMore,
|
|
1937
|
+
loadMore: result.loadMore,
|
|
1938
|
+
refetch: result.refetch,
|
|
1939
|
+
reset: result.reset,
|
|
1940
|
+
setSearchFilter: result.setSearchFilter,
|
|
1941
|
+
searchFilter: result.searchFilter
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
function useDeletedBrands(options = {}) {
|
|
1945
|
+
const result = useDeletedBrandsInternal(options);
|
|
1946
|
+
return {
|
|
1947
|
+
brands: result.brands,
|
|
1948
|
+
loading: result.loading,
|
|
1949
|
+
initialLoading: result.initialLoading,
|
|
1950
|
+
loadingMore: result.loadingMore,
|
|
1951
|
+
error: result.error,
|
|
1952
|
+
pagination: result.pagination,
|
|
1953
|
+
hasMore: result.hasMore,
|
|
1954
|
+
loadMore: result.loadMore,
|
|
1955
|
+
refetch: result.refetch,
|
|
1956
|
+
reset: result.reset,
|
|
1957
|
+
setSearchFilter: result.setSearchFilter,
|
|
1958
|
+
searchFilter: result.searchFilter
|
|
1360
1959
|
};
|
|
1361
1960
|
}
|
|
1362
1961
|
|
|
1363
|
-
// src/hooks/useUsers.ts
|
|
1364
|
-
function
|
|
1962
|
+
// src/hooks/users/useUsers.ts
|
|
1963
|
+
function buildFilter3(options) {
|
|
1365
1964
|
let filter = options.filter || {};
|
|
1366
1965
|
if (options.brandId) {
|
|
1367
1966
|
filter = { ...filter, brandIds: { contains: options.brandId } };
|
|
@@ -1374,7 +1973,7 @@ function buildFilter2(options) {
|
|
|
1374
1973
|
var useUsersInternal = createDataHook({
|
|
1375
1974
|
model: "User",
|
|
1376
1975
|
dataPropertyName: "users",
|
|
1377
|
-
buildFilter:
|
|
1976
|
+
buildFilter: buildFilter3
|
|
1378
1977
|
});
|
|
1379
1978
|
function useUsers(options = {}) {
|
|
1380
1979
|
const result = useUsersInternal(options);
|
|
@@ -1386,8 +1985,419 @@ function useUsers(options = {}) {
|
|
|
1386
1985
|
};
|
|
1387
1986
|
}
|
|
1388
1987
|
|
|
1389
|
-
// src/hooks/
|
|
1390
|
-
function
|
|
1988
|
+
// src/hooks/users/usePaginatedUsers.ts
|
|
1989
|
+
function buildFilter4(options) {
|
|
1990
|
+
const conditions = [];
|
|
1991
|
+
if (options.brandId) {
|
|
1992
|
+
conditions.push({ brandIds: { contains: options.brandId } });
|
|
1993
|
+
}
|
|
1994
|
+
if (options.accountId) {
|
|
1995
|
+
conditions.push({ accountId: { eq: options.accountId } });
|
|
1996
|
+
}
|
|
1997
|
+
if (options.filter && Object.keys(options.filter).length > 0) {
|
|
1998
|
+
conditions.push(options.filter);
|
|
1999
|
+
}
|
|
2000
|
+
if (conditions.length === 0) {
|
|
2001
|
+
return void 0;
|
|
2002
|
+
}
|
|
2003
|
+
if (conditions.length === 1) {
|
|
2004
|
+
return conditions[0];
|
|
2005
|
+
}
|
|
2006
|
+
return { and: conditions };
|
|
2007
|
+
}
|
|
2008
|
+
function transformUser(user) {
|
|
2009
|
+
return {
|
|
2010
|
+
...user,
|
|
2011
|
+
accountName: user.account?.name || ""
|
|
2012
|
+
};
|
|
2013
|
+
}
|
|
2014
|
+
var USER_SELECTION_SET = [
|
|
2015
|
+
"id",
|
|
2016
|
+
"email",
|
|
2017
|
+
"accountId",
|
|
2018
|
+
"brandIds",
|
|
2019
|
+
"roles",
|
|
2020
|
+
"status",
|
|
2021
|
+
"lastLogin",
|
|
2022
|
+
"createdAt",
|
|
2023
|
+
"deletedAt",
|
|
2024
|
+
"deletedBy",
|
|
2025
|
+
"account.name"
|
|
2026
|
+
];
|
|
2027
|
+
var useActiveUsersInternal = createPaginatedDataHook({
|
|
2028
|
+
model: "User",
|
|
2029
|
+
dataPropertyName: "users",
|
|
2030
|
+
defaultPageSize: 25,
|
|
2031
|
+
selectionSet: USER_SELECTION_SET,
|
|
2032
|
+
transform: transformUser,
|
|
2033
|
+
buildFilter: buildFilter4,
|
|
2034
|
+
baseFilter: ACTIVE_FILTER
|
|
2035
|
+
});
|
|
2036
|
+
var useDeletedUsersInternal = createPaginatedDataHook({
|
|
2037
|
+
model: "User",
|
|
2038
|
+
dataPropertyName: "users",
|
|
2039
|
+
defaultPageSize: 25,
|
|
2040
|
+
selectionSet: USER_SELECTION_SET,
|
|
2041
|
+
transform: transformUser,
|
|
2042
|
+
buildFilter: buildFilter4,
|
|
2043
|
+
baseFilter: DELETED_FILTER
|
|
2044
|
+
});
|
|
2045
|
+
function useActiveUsers(options = {}) {
|
|
2046
|
+
const result = useActiveUsersInternal(options);
|
|
2047
|
+
return {
|
|
2048
|
+
users: result.users,
|
|
2049
|
+
loading: result.loading,
|
|
2050
|
+
initialLoading: result.initialLoading,
|
|
2051
|
+
loadingMore: result.loadingMore,
|
|
2052
|
+
error: result.error,
|
|
2053
|
+
pagination: result.pagination,
|
|
2054
|
+
hasMore: result.hasMore,
|
|
2055
|
+
loadMore: result.loadMore,
|
|
2056
|
+
refetch: result.refetch,
|
|
2057
|
+
reset: result.reset,
|
|
2058
|
+
setSearchFilter: result.setSearchFilter,
|
|
2059
|
+
searchFilter: result.searchFilter
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
function useDeletedUsers(options = {}) {
|
|
2063
|
+
const result = useDeletedUsersInternal(options);
|
|
2064
|
+
return {
|
|
2065
|
+
users: result.users,
|
|
2066
|
+
loading: result.loading,
|
|
2067
|
+
initialLoading: result.initialLoading,
|
|
2068
|
+
loadingMore: result.loadingMore,
|
|
2069
|
+
error: result.error,
|
|
2070
|
+
pagination: result.pagination,
|
|
2071
|
+
hasMore: result.hasMore,
|
|
2072
|
+
loadMore: result.loadMore,
|
|
2073
|
+
refetch: result.refetch,
|
|
2074
|
+
reset: result.reset,
|
|
2075
|
+
setSearchFilter: result.setSearchFilter,
|
|
2076
|
+
searchFilter: result.searchFilter
|
|
2077
|
+
};
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// src/hooks/accounts/useAccounts.ts
|
|
2081
|
+
function transformAccount(account) {
|
|
2082
|
+
const brands = account.brands || [];
|
|
2083
|
+
return {
|
|
2084
|
+
...account,
|
|
2085
|
+
brands,
|
|
2086
|
+
brandCount: brands.length
|
|
2087
|
+
};
|
|
2088
|
+
}
|
|
2089
|
+
var useAccountsInternal = createDataHook({
|
|
2090
|
+
model: "Account",
|
|
2091
|
+
dataPropertyName: "accounts",
|
|
2092
|
+
// Include brands relationship for brand display
|
|
2093
|
+
selectionSet: [
|
|
2094
|
+
"id",
|
|
2095
|
+
"name",
|
|
2096
|
+
"logo",
|
|
2097
|
+
"subscription",
|
|
2098
|
+
"settings",
|
|
2099
|
+
"status",
|
|
2100
|
+
"deletedAt",
|
|
2101
|
+
"deletedBy",
|
|
2102
|
+
"brands.id",
|
|
2103
|
+
"brands.name",
|
|
2104
|
+
"brands.status"
|
|
2105
|
+
],
|
|
2106
|
+
transform: transformAccount
|
|
2107
|
+
});
|
|
2108
|
+
function useAccounts(options = {}) {
|
|
2109
|
+
const result = useAccountsInternal(options);
|
|
2110
|
+
return {
|
|
2111
|
+
accounts: result.accounts,
|
|
2112
|
+
loading: result.loading,
|
|
2113
|
+
error: result.error,
|
|
2114
|
+
refetch: result.refetch
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
// src/hooks/accounts/usePaginatedAccounts.ts
|
|
2119
|
+
function transformAccount2(account) {
|
|
2120
|
+
const brands = account.brands || [];
|
|
2121
|
+
return {
|
|
2122
|
+
...account,
|
|
2123
|
+
brands,
|
|
2124
|
+
brandCount: brands.length
|
|
2125
|
+
};
|
|
2126
|
+
}
|
|
2127
|
+
var ACCOUNT_SELECTION_SET = [
|
|
2128
|
+
"id",
|
|
2129
|
+
"name",
|
|
2130
|
+
"logo",
|
|
2131
|
+
"subscription",
|
|
2132
|
+
"settings",
|
|
2133
|
+
"status",
|
|
2134
|
+
"deletedAt",
|
|
2135
|
+
"deletedBy",
|
|
2136
|
+
"brands.id",
|
|
2137
|
+
"brands.name",
|
|
2138
|
+
"brands.status"
|
|
2139
|
+
];
|
|
2140
|
+
var useActiveAccountsInternal = createPaginatedDataHook({
|
|
2141
|
+
model: "Account",
|
|
2142
|
+
dataPropertyName: "accounts",
|
|
2143
|
+
defaultPageSize: 25,
|
|
2144
|
+
selectionSet: ACCOUNT_SELECTION_SET,
|
|
2145
|
+
transform: transformAccount2,
|
|
2146
|
+
baseFilter: ACTIVE_FILTER
|
|
2147
|
+
});
|
|
2148
|
+
var useDeletedAccountsInternal = createPaginatedDataHook({
|
|
2149
|
+
model: "Account",
|
|
2150
|
+
dataPropertyName: "accounts",
|
|
2151
|
+
defaultPageSize: 25,
|
|
2152
|
+
selectionSet: ACCOUNT_SELECTION_SET,
|
|
2153
|
+
transform: transformAccount2,
|
|
2154
|
+
baseFilter: DELETED_FILTER
|
|
2155
|
+
});
|
|
2156
|
+
function useActiveAccounts(options = {}) {
|
|
2157
|
+
const result = useActiveAccountsInternal(options);
|
|
2158
|
+
return {
|
|
2159
|
+
accounts: result.accounts,
|
|
2160
|
+
loading: result.loading,
|
|
2161
|
+
initialLoading: result.initialLoading,
|
|
2162
|
+
loadingMore: result.loadingMore,
|
|
2163
|
+
error: result.error,
|
|
2164
|
+
pagination: result.pagination,
|
|
2165
|
+
hasMore: result.hasMore,
|
|
2166
|
+
loadMore: result.loadMore,
|
|
2167
|
+
refetch: result.refetch,
|
|
2168
|
+
reset: result.reset,
|
|
2169
|
+
setSearchFilter: result.setSearchFilter,
|
|
2170
|
+
searchFilter: result.searchFilter
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
function useDeletedAccounts(options = {}) {
|
|
2174
|
+
const result = useDeletedAccountsInternal(options);
|
|
2175
|
+
return {
|
|
2176
|
+
accounts: result.accounts,
|
|
2177
|
+
loading: result.loading,
|
|
2178
|
+
initialLoading: result.initialLoading,
|
|
2179
|
+
loadingMore: result.loadingMore,
|
|
2180
|
+
error: result.error,
|
|
2181
|
+
pagination: result.pagination,
|
|
2182
|
+
hasMore: result.hasMore,
|
|
2183
|
+
loadMore: result.loadMore,
|
|
2184
|
+
refetch: result.refetch,
|
|
2185
|
+
reset: result.reset,
|
|
2186
|
+
setSearchFilter: result.setSearchFilter,
|
|
2187
|
+
searchFilter: result.searchFilter
|
|
2188
|
+
};
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
// src/hooks/reservations/useReservations.ts
|
|
2192
|
+
function buildFilter5(options) {
|
|
2193
|
+
const conditions = [];
|
|
2194
|
+
if (options.brandId) {
|
|
2195
|
+
conditions.push({ brandId: { eq: options.brandId } });
|
|
2196
|
+
}
|
|
2197
|
+
if (options.status) {
|
|
2198
|
+
conditions.push({ status: { eq: options.status } });
|
|
2199
|
+
}
|
|
2200
|
+
if (options.contactId) {
|
|
2201
|
+
conditions.push({ visitId: { eq: options.contactId } });
|
|
2202
|
+
}
|
|
2203
|
+
if (options.startDate) {
|
|
2204
|
+
conditions.push({ checkIn: { ge: options.startDate } });
|
|
2205
|
+
}
|
|
2206
|
+
if (options.endDate) {
|
|
2207
|
+
conditions.push({ checkIn: { le: options.endDate } });
|
|
2208
|
+
}
|
|
2209
|
+
if (options.filter) {
|
|
2210
|
+
conditions.push(options.filter);
|
|
2211
|
+
}
|
|
2212
|
+
if (conditions.length === 0) {
|
|
2213
|
+
return void 0;
|
|
2214
|
+
}
|
|
2215
|
+
if (conditions.length === 1) {
|
|
2216
|
+
return conditions[0];
|
|
2217
|
+
}
|
|
2218
|
+
return { and: conditions };
|
|
2219
|
+
}
|
|
2220
|
+
function transformReservation(r) {
|
|
2221
|
+
let snapshot = r.visit?.snapshot;
|
|
2222
|
+
if (typeof snapshot === "string") {
|
|
2223
|
+
try {
|
|
2224
|
+
snapshot = JSON.parse(snapshot);
|
|
2225
|
+
} catch {
|
|
2226
|
+
snapshot = null;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
return {
|
|
2230
|
+
...r,
|
|
2231
|
+
brandName: r.brand?.name || "Unknown Brand",
|
|
2232
|
+
guestName: snapshot ? `${snapshot.firstName || ""} ${snapshot.lastName || ""}`.trim() || "Unknown Guest" : "Unknown Guest",
|
|
2233
|
+
guestEmail: snapshot?.email || "",
|
|
2234
|
+
guestPhone: snapshot?.phone || ""
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
var useReservationsInternal = createDataHook({
|
|
2238
|
+
model: "Reservation",
|
|
2239
|
+
dataPropertyName: "reservations",
|
|
2240
|
+
buildFilter: buildFilter5,
|
|
2241
|
+
// Include related data for brand name and guest info
|
|
2242
|
+
selectionSet: [
|
|
2243
|
+
"id",
|
|
2244
|
+
"brandId",
|
|
2245
|
+
"visitId",
|
|
2246
|
+
"checkIn",
|
|
2247
|
+
"checkOut",
|
|
2248
|
+
"room",
|
|
2249
|
+
"roomType",
|
|
2250
|
+
"status",
|
|
2251
|
+
"source",
|
|
2252
|
+
"channel",
|
|
2253
|
+
"confirmationCode",
|
|
2254
|
+
"totalAmount",
|
|
2255
|
+
"currency",
|
|
2256
|
+
"nights",
|
|
2257
|
+
"deletedAt",
|
|
2258
|
+
"deletedBy",
|
|
2259
|
+
"brand.name",
|
|
2260
|
+
"visit.snapshot"
|
|
2261
|
+
],
|
|
2262
|
+
transform: transformReservation,
|
|
2263
|
+
computedProperties: {
|
|
2264
|
+
confirmedReservations: (reservations) => reservations.filter((r) => r.status === "confirmed"),
|
|
2265
|
+
activeReservations: (reservations) => reservations.filter((r) => r.status === "confirmed" || r.status === "checked_in")
|
|
2266
|
+
}
|
|
2267
|
+
});
|
|
2268
|
+
function useReservations(options = {}) {
|
|
2269
|
+
const result = useReservationsInternal(options);
|
|
2270
|
+
return {
|
|
2271
|
+
reservations: result.reservations,
|
|
2272
|
+
confirmedReservations: result.confirmedReservations,
|
|
2273
|
+
activeReservations: result.activeReservations,
|
|
2274
|
+
loading: result.loading,
|
|
2275
|
+
error: result.error,
|
|
2276
|
+
refetch: result.refetch
|
|
2277
|
+
};
|
|
2278
|
+
}
|
|
2279
|
+
|
|
2280
|
+
// src/hooks/reservations/usePaginatedReservations.ts
|
|
2281
|
+
function buildFilter6(options) {
|
|
2282
|
+
const conditions = [];
|
|
2283
|
+
if (options.brandId) {
|
|
2284
|
+
conditions.push({ brandId: { eq: options.brandId } });
|
|
2285
|
+
}
|
|
2286
|
+
if (options.status) {
|
|
2287
|
+
conditions.push({ status: { eq: options.status } });
|
|
2288
|
+
}
|
|
2289
|
+
if (options.contactId) {
|
|
2290
|
+
conditions.push({ visitId: { eq: options.contactId } });
|
|
2291
|
+
}
|
|
2292
|
+
if (options.startDate) {
|
|
2293
|
+
conditions.push({ checkIn: { ge: options.startDate } });
|
|
2294
|
+
}
|
|
2295
|
+
if (options.endDate) {
|
|
2296
|
+
conditions.push({ checkIn: { le: options.endDate } });
|
|
2297
|
+
}
|
|
2298
|
+
if (options.filter && Object.keys(options.filter).length > 0) {
|
|
2299
|
+
conditions.push(options.filter);
|
|
2300
|
+
}
|
|
2301
|
+
if (conditions.length === 0) {
|
|
2302
|
+
return void 0;
|
|
2303
|
+
}
|
|
2304
|
+
if (conditions.length === 1) {
|
|
2305
|
+
return conditions[0];
|
|
2306
|
+
}
|
|
2307
|
+
return { and: conditions };
|
|
2308
|
+
}
|
|
2309
|
+
function transformReservation2(r) {
|
|
2310
|
+
let snapshot = r.visit?.snapshot;
|
|
2311
|
+
if (typeof snapshot === "string") {
|
|
2312
|
+
try {
|
|
2313
|
+
snapshot = JSON.parse(snapshot);
|
|
2314
|
+
} catch {
|
|
2315
|
+
snapshot = null;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
return {
|
|
2319
|
+
...r,
|
|
2320
|
+
brandName: r.brand?.name || "Unknown Brand",
|
|
2321
|
+
guestName: snapshot ? `${snapshot.firstName || ""} ${snapshot.lastName || ""}`.trim() || "Unknown Guest" : "Unknown Guest",
|
|
2322
|
+
guestEmail: snapshot?.email || "",
|
|
2323
|
+
guestPhone: snapshot?.phone || ""
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
var RESERVATION_SELECTION_SET = [
|
|
2327
|
+
"id",
|
|
2328
|
+
"brandId",
|
|
2329
|
+
"visitId",
|
|
2330
|
+
"checkIn",
|
|
2331
|
+
"checkOut",
|
|
2332
|
+
"room",
|
|
2333
|
+
"roomType",
|
|
2334
|
+
"status",
|
|
2335
|
+
"source",
|
|
2336
|
+
"channel",
|
|
2337
|
+
"confirmationCode",
|
|
2338
|
+
"totalAmount",
|
|
2339
|
+
"currency",
|
|
2340
|
+
"nights",
|
|
2341
|
+
"deletedAt",
|
|
2342
|
+
"deletedBy",
|
|
2343
|
+
"brand.name",
|
|
2344
|
+
"visit.snapshot"
|
|
2345
|
+
];
|
|
2346
|
+
var useActiveReservationsInternal = createPaginatedDataHook({
|
|
2347
|
+
model: "Reservation",
|
|
2348
|
+
dataPropertyName: "reservations",
|
|
2349
|
+
defaultPageSize: 25,
|
|
2350
|
+
selectionSet: RESERVATION_SELECTION_SET,
|
|
2351
|
+
transform: transformReservation2,
|
|
2352
|
+
buildFilter: buildFilter6,
|
|
2353
|
+
baseFilter: ACTIVE_FILTER
|
|
2354
|
+
});
|
|
2355
|
+
var useDeletedReservationsInternal = createPaginatedDataHook({
|
|
2356
|
+
model: "Reservation",
|
|
2357
|
+
dataPropertyName: "reservations",
|
|
2358
|
+
defaultPageSize: 25,
|
|
2359
|
+
selectionSet: RESERVATION_SELECTION_SET,
|
|
2360
|
+
transform: transformReservation2,
|
|
2361
|
+
buildFilter: buildFilter6,
|
|
2362
|
+
baseFilter: DELETED_FILTER
|
|
2363
|
+
});
|
|
2364
|
+
function useActiveReservations(options = {}) {
|
|
2365
|
+
const result = useActiveReservationsInternal(options);
|
|
2366
|
+
return {
|
|
2367
|
+
reservations: result.reservations,
|
|
2368
|
+
loading: result.loading,
|
|
2369
|
+
initialLoading: result.initialLoading,
|
|
2370
|
+
loadingMore: result.loadingMore,
|
|
2371
|
+
error: result.error,
|
|
2372
|
+
pagination: result.pagination,
|
|
2373
|
+
hasMore: result.hasMore,
|
|
2374
|
+
loadMore: result.loadMore,
|
|
2375
|
+
refetch: result.refetch,
|
|
2376
|
+
reset: result.reset,
|
|
2377
|
+
setSearchFilter: result.setSearchFilter,
|
|
2378
|
+
searchFilter: result.searchFilter
|
|
2379
|
+
};
|
|
2380
|
+
}
|
|
2381
|
+
function useDeletedReservations(options = {}) {
|
|
2382
|
+
const result = useDeletedReservationsInternal(options);
|
|
2383
|
+
return {
|
|
2384
|
+
reservations: result.reservations,
|
|
2385
|
+
loading: result.loading,
|
|
2386
|
+
initialLoading: result.initialLoading,
|
|
2387
|
+
loadingMore: result.loadingMore,
|
|
2388
|
+
error: result.error,
|
|
2389
|
+
pagination: result.pagination,
|
|
2390
|
+
hasMore: result.hasMore,
|
|
2391
|
+
loadMore: result.loadMore,
|
|
2392
|
+
refetch: result.refetch,
|
|
2393
|
+
reset: result.reset,
|
|
2394
|
+
setSearchFilter: result.setSearchFilter,
|
|
2395
|
+
searchFilter: result.searchFilter
|
|
2396
|
+
};
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
// src/hooks/products/useProducts.ts
|
|
2400
|
+
function buildFilter7(options) {
|
|
1391
2401
|
let filter = options.filter || {};
|
|
1392
2402
|
if (options.activeOnly) {
|
|
1393
2403
|
filter = { ...filter, isActive: { eq: true } };
|
|
@@ -1397,7 +2407,7 @@ function buildFilter3(options) {
|
|
|
1397
2407
|
var useProductsInternal = createDataHook({
|
|
1398
2408
|
model: "Product",
|
|
1399
2409
|
dataPropertyName: "products",
|
|
1400
|
-
buildFilter:
|
|
2410
|
+
buildFilter: buildFilter7,
|
|
1401
2411
|
computedProperties: {
|
|
1402
2412
|
activeProducts: (products) => products.filter((p) => p.isActive === true)
|
|
1403
2413
|
}
|
|
@@ -1413,8 +2423,8 @@ function useProducts(options = {}) {
|
|
|
1413
2423
|
};
|
|
1414
2424
|
}
|
|
1415
2425
|
|
|
1416
|
-
// src/hooks/useProductInstances.ts
|
|
1417
|
-
function
|
|
2426
|
+
// src/hooks/productInstances/useProductInstances.ts
|
|
2427
|
+
function buildFilter8(options) {
|
|
1418
2428
|
let filter = options.filter || {};
|
|
1419
2429
|
if (options.brandId) {
|
|
1420
2430
|
filter = { ...filter, brandId: { eq: options.brandId } };
|
|
@@ -1433,7 +2443,7 @@ function buildFilter4(options) {
|
|
|
1433
2443
|
var useProductInstancesInternal = createDataHook({
|
|
1434
2444
|
model: "ProductInstance",
|
|
1435
2445
|
dataPropertyName: "instances",
|
|
1436
|
-
buildFilter:
|
|
2446
|
+
buildFilter: buildFilter8,
|
|
1437
2447
|
computedProperties: {
|
|
1438
2448
|
enabledInstances: (instances) => instances.filter((i) => i.enabled)
|
|
1439
2449
|
}
|
|
@@ -1481,23 +2491,32 @@ function useProductInstances(options = {}) {
|
|
|
1481
2491
|
};
|
|
1482
2492
|
}
|
|
1483
2493
|
|
|
1484
|
-
// src/hooks/
|
|
1485
|
-
function
|
|
2494
|
+
// src/hooks/useContacts.ts
|
|
2495
|
+
function buildFilter9(options) {
|
|
1486
2496
|
const conditions = [];
|
|
1487
2497
|
if (options.brandId) {
|
|
1488
2498
|
conditions.push({ brandId: { eq: options.brandId } });
|
|
1489
2499
|
}
|
|
1490
|
-
if (options.
|
|
1491
|
-
conditions.push({
|
|
2500
|
+
if (options.search) {
|
|
2501
|
+
conditions.push({
|
|
2502
|
+
or: [
|
|
2503
|
+
{ email: { contains: options.search } },
|
|
2504
|
+
{ firstName: { contains: options.search } },
|
|
2505
|
+
{ lastName: { contains: options.search } }
|
|
2506
|
+
]
|
|
2507
|
+
});
|
|
1492
2508
|
}
|
|
1493
|
-
if (options.
|
|
1494
|
-
conditions.push({
|
|
2509
|
+
if (options.gdprConsent !== void 0) {
|
|
2510
|
+
conditions.push({ gdprConsent: { eq: options.gdprConsent } });
|
|
1495
2511
|
}
|
|
1496
|
-
if (options.
|
|
1497
|
-
conditions.push({
|
|
2512
|
+
if (options.marketingOptIn !== void 0) {
|
|
2513
|
+
conditions.push({ marketingOptIn: { eq: options.marketingOptIn } });
|
|
1498
2514
|
}
|
|
1499
|
-
if (options.
|
|
1500
|
-
|
|
2515
|
+
if (options.tags && options.tags.length > 0) {
|
|
2516
|
+
const tagConditions = options.tags.map((tag) => ({
|
|
2517
|
+
tags: { contains: tag }
|
|
2518
|
+
}));
|
|
2519
|
+
conditions.push({ or: tagConditions });
|
|
1501
2520
|
}
|
|
1502
2521
|
if (options.filter) {
|
|
1503
2522
|
conditions.push(options.filter);
|
|
@@ -1510,21 +2529,21 @@ function buildFilter5(options) {
|
|
|
1510
2529
|
}
|
|
1511
2530
|
return { and: conditions };
|
|
1512
2531
|
}
|
|
1513
|
-
var
|
|
1514
|
-
model: "
|
|
1515
|
-
dataPropertyName: "
|
|
1516
|
-
buildFilter:
|
|
2532
|
+
var useContactsInternal = createDataHook({
|
|
2533
|
+
model: "Contact",
|
|
2534
|
+
dataPropertyName: "contacts",
|
|
2535
|
+
buildFilter: buildFilter9,
|
|
1517
2536
|
computedProperties: {
|
|
1518
|
-
|
|
1519
|
-
|
|
2537
|
+
consentedContacts: (contacts) => contacts.filter((c) => c.gdprConsent === true),
|
|
2538
|
+
marketingContacts: (contacts) => contacts.filter((c) => c.marketingOptIn === true)
|
|
1520
2539
|
}
|
|
1521
2540
|
});
|
|
1522
|
-
function
|
|
1523
|
-
const result =
|
|
2541
|
+
function useContacts(options = {}) {
|
|
2542
|
+
const result = useContactsInternal(options);
|
|
1524
2543
|
return {
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
2544
|
+
contacts: result.contacts,
|
|
2545
|
+
consentedContacts: result.consentedContacts,
|
|
2546
|
+
marketingContacts: result.marketingContacts,
|
|
1528
2547
|
loading: result.loading,
|
|
1529
2548
|
error: result.error,
|
|
1530
2549
|
refetch: result.refetch
|
|
@@ -1634,13 +2653,19 @@ function createSingleStore(shared, name, defaultValue) {
|
|
|
1634
2653
|
return shared(name, atom(defaultValue));
|
|
1635
2654
|
}
|
|
1636
2655
|
export {
|
|
2656
|
+
ACTIVE_FILTER,
|
|
2657
|
+
ContactValidationError,
|
|
1637
2658
|
DEFAULT_SOFT_DELETE_RETENTION_DAYS,
|
|
2659
|
+
DELETED_FILTER,
|
|
1638
2660
|
ReservationValidationError,
|
|
1639
2661
|
SYSTEM_SETTINGS_KEY,
|
|
1640
2662
|
checkRestoreEligibility,
|
|
1641
2663
|
createAccount,
|
|
1642
2664
|
createBrand,
|
|
2665
|
+
createContact,
|
|
2666
|
+
createContactSchema,
|
|
1643
2667
|
createDataHook,
|
|
2668
|
+
createPaginatedDataHook,
|
|
1644
2669
|
createProductInstance,
|
|
1645
2670
|
createReservation2 as createReservation,
|
|
1646
2671
|
createResourceStores,
|
|
@@ -1649,6 +2674,7 @@ export {
|
|
|
1649
2674
|
createUser,
|
|
1650
2675
|
deleteAccount,
|
|
1651
2676
|
deleteBrand,
|
|
2677
|
+
deleteContact,
|
|
1652
2678
|
deleteProductInstance,
|
|
1653
2679
|
deleteReservation2 as deleteReservation,
|
|
1654
2680
|
deleteUser,
|
|
@@ -1660,6 +2686,9 @@ export {
|
|
|
1660
2686
|
getAccountWithBrands,
|
|
1661
2687
|
getBrand,
|
|
1662
2688
|
getBrandWithProducts,
|
|
2689
|
+
getContact,
|
|
2690
|
+
getContactByEmail,
|
|
2691
|
+
getContactByPhone,
|
|
1663
2692
|
getErrorMessage,
|
|
1664
2693
|
getProduct,
|
|
1665
2694
|
getProductInstance,
|
|
@@ -1679,6 +2708,8 @@ export {
|
|
|
1679
2708
|
listActiveUsers,
|
|
1680
2709
|
listBrands,
|
|
1681
2710
|
listBrandsByAccount,
|
|
2711
|
+
listContacts,
|
|
2712
|
+
listContactsByBrand,
|
|
1682
2713
|
listEnabledProductInstancesByBrand,
|
|
1683
2714
|
listProductInstancesByAccount,
|
|
1684
2715
|
listProductInstancesByBrand,
|
|
@@ -1689,28 +2720,44 @@ export {
|
|
|
1689
2720
|
listReservationsByDateRange,
|
|
1690
2721
|
listUsers,
|
|
1691
2722
|
listUsersByAccount,
|
|
2723
|
+
mergeContacts,
|
|
2724
|
+
mergeContactsSchema,
|
|
1692
2725
|
mutate,
|
|
1693
2726
|
query,
|
|
1694
2727
|
resetClientInstance,
|
|
1695
2728
|
resetSharedClient,
|
|
1696
2729
|
restoreAccount,
|
|
1697
2730
|
restoreBrand,
|
|
2731
|
+
restoreContact,
|
|
1698
2732
|
restoreReservation2 as restoreReservation,
|
|
1699
2733
|
restoreUser,
|
|
2734
|
+
searchContacts,
|
|
1700
2735
|
softDeleteAccount,
|
|
1701
2736
|
softDeleteBrand,
|
|
2737
|
+
softDeleteContact,
|
|
1702
2738
|
softDeleteReservation2 as softDeleteReservation,
|
|
1703
2739
|
softDeleteUser,
|
|
1704
2740
|
toggleProductInstanceEnabled,
|
|
1705
2741
|
updateAccount,
|
|
1706
2742
|
updateBrand,
|
|
2743
|
+
updateContact,
|
|
2744
|
+
updateContactSchema,
|
|
1707
2745
|
updateProductInstance,
|
|
1708
2746
|
updateReservation2 as updateReservation,
|
|
1709
2747
|
updateReservationStatus2 as updateReservationStatus,
|
|
1710
2748
|
updateSystemSettings,
|
|
1711
2749
|
updateUser,
|
|
1712
2750
|
useAccounts,
|
|
2751
|
+
useActiveAccounts,
|
|
2752
|
+
useActiveBrands,
|
|
2753
|
+
useActiveReservations,
|
|
2754
|
+
useActiveUsers,
|
|
1713
2755
|
useBrands,
|
|
2756
|
+
useContacts,
|
|
2757
|
+
useDeletedAccounts,
|
|
2758
|
+
useDeletedBrands,
|
|
2759
|
+
useDeletedReservations,
|
|
2760
|
+
useDeletedUsers,
|
|
1714
2761
|
useProductInstances,
|
|
1715
2762
|
useProducts,
|
|
1716
2763
|
useReservations,
|