Compare commits

...

2 Commits

Author SHA1 Message Date
pandeymangg 9c0306c27b Merge branch 'main' into fix/bulk-contacts 2025-04-18 15:03:11 +05:30
pandeymangg 62960686a1 fix: bulk contacts refactors 2025-04-08 11:32:00 +05:30
2 changed files with 103 additions and 100 deletions
@@ -229,7 +229,8 @@ export const upsertBulkContacts = async (
try {
// Execute everything in ONE transaction
await prisma.$transaction(async (tx) => {
await prisma.$transaction(
async (tx) => {
const attributeKeyMap = existingAttributeKeys.reduce<Record<string, string>>((acc, keyObj) => {
acc[keyObj.key] = keyObj.id;
return acc;
@@ -382,7 +383,9 @@ export const upsertBulkContacts = async (
});
contactAttributeCache.revalidate({ environmentId });
});
},
{ timeout: 10 * 1000 } // 10 seconds timeout
);
return ok({
contactIdxWithConflictingUserIds,
@@ -126,7 +126,7 @@ export const ZContactBulkUploadRequest = z.object({
environmentId: z.string().cuid2(),
contacts: z
.array(ZContactBulkUploadContact)
.max(1000, { message: "Maximum 1000 contacts allowed at a time." })
.max(250, { message: "Maximum 250 contacts allowed at a time." })
.superRefine((contacts, ctx) => {
// Track all data in a single pass
const seenEmails = new Set<string>();