This commit is contained in:
pradeepkumar
2026-01-24 22:31:12 +05:30
parent 4397075715
commit 9c7e21e1ad
2 changed files with 22 additions and 0 deletions

View File

@@ -319,7 +319,18 @@ async function main() {
isActive: true, isActive: true,
isGlobal: true, isGlobal: true,
isSystem: true, isSystem: true,
isRepeatable: true, // User can add multiple certifications
fields: [ 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', name: 'Certification Name',
slug: 'certification_name', slug: 'certification_name',
@@ -1119,6 +1130,15 @@ async function main() {
if (existingSection) { if (existingSection) {
console.log(` ⚠️ Section "${sectionInfo.name}" already exists`); 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 // Still check and create missing fields
for (const fieldData of fields) { for (const fieldData of fields) {
const existingField = await prisma.profileField.findFirst({ const existingField = await prisma.profileField.findFirst({

View File

@@ -554,6 +554,7 @@ export class AgentsService {
case 'TAG_INPUT': case 'TAG_INPUT':
case 'FILE': case 'FILE':
case 'FILE_UPLOAD': case 'FILE_UPLOAD':
case 'REPEATER':
// Arrays and complex objects - store as JSON // Arrays and complex objects - store as JSON
valueData.jsonValue = value as PrismaTypes.InputJsonValue; valueData.jsonValue = value as PrismaTypes.InputJsonValue;
break; break;
@@ -597,6 +598,7 @@ export class AgentsService {
case 'TAG_INPUT': case 'TAG_INPUT':
case 'FILE': case 'FILE':
case 'FILE_UPLOAD': case 'FILE_UPLOAD':
case 'REPEATER':
return fieldValue.jsonValue; return fieldValue.jsonValue;
default: default:
// Return first non-null value // Return first non-null value