fix
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user