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