From 9c7e21e1ad9d4efdedb1964e0d20e488cddafc9e Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 24 Jan 2026 22:31:12 +0530 Subject: [PATCH] fix --- prisma/seed.ts | 20 ++++++++++++++++++++ src/agents/agents.service.ts | 2 ++ 2 files changed, 22 insertions(+) diff --git a/prisma/seed.ts b/prisma/seed.ts index feb08d5..5f96949 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -319,7 +319,18 @@ async function main() { isActive: true, isGlobal: true, isSystem: true, + isRepeatable: true, // User can add multiple certifications fields: [ + { + name: 'Certification Entries', + slug: 'certification_entries', + fieldType: FieldType.REPEATER, + description: 'All certification entries stored as JSON array', + sortOrder: 0, + isActive: true, + isRequired: false, + isSearchableOnly: false, + }, { name: 'Certification Name', slug: 'certification_name', @@ -1119,6 +1130,15 @@ async function main() { if (existingSection) { console.log(` ⚠️ Section "${sectionInfo.name}" already exists`); + // Update section properties if they've changed (like isRepeatable) + if (sectionInfo.isRepeatable !== undefined && existingSection.isRepeatable !== sectionInfo.isRepeatable) { + await prisma.profileSection.update({ + where: { id: existingSection.id }, + data: { isRepeatable: sectionInfo.isRepeatable }, + }); + console.log(` ✅ Updated isRepeatable to ${sectionInfo.isRepeatable}`); + } + // Still check and create missing fields for (const fieldData of fields) { const existingField = await prisma.profileField.findFirst({ diff --git a/src/agents/agents.service.ts b/src/agents/agents.service.ts index 0fda9d9..b203415 100644 --- a/src/agents/agents.service.ts +++ b/src/agents/agents.service.ts @@ -554,6 +554,7 @@ export class AgentsService { case 'TAG_INPUT': case 'FILE': case 'FILE_UPLOAD': + case 'REPEATER': // Arrays and complex objects - store as JSON valueData.jsonValue = value as PrismaTypes.InputJsonValue; break; @@ -597,6 +598,7 @@ export class AgentsService { case 'TAG_INPUT': case 'FILE': case 'FILE_UPLOAD': + case 'REPEATER': return fieldValue.jsonValue; default: // Return first non-null value