feat: Introduce default profile sections and fields, updating schema with isSystem and isSearchableOnly properties.

This commit is contained in:
pradeepkumar
2026-01-24 12:49:25 +05:30
parent 710803a3ec
commit 43b422a81e
4 changed files with 145 additions and 2 deletions

View File

@@ -89,6 +89,11 @@ export class CreateFieldDto {
@IsBoolean()
isRequired?: boolean;
@ApiPropertyOptional({ description: 'Whether this field is for search only (hidden from public profile)', default: false })
@IsOptional()
@IsBoolean()
isSearchableOnly?: boolean;
@ApiPropertyOptional({ description: 'Validation rules (JSON object)' })
@IsOptional()
@IsObject()

View File

@@ -1,4 +1,4 @@
import { Injectable, NotFoundException, ConflictException } from '@nestjs/common';
import { Injectable, NotFoundException, ConflictException, ForbiddenException } from '@nestjs/common';
import { PrismaService } from '../prisma';
import { CreateSectionDto, UpdateSectionDto, AssignSectionDto, UpdateAssignmentDto } from './dto';
@@ -143,6 +143,13 @@ export class ProfileSectionsService {
async remove(id: string) {
const section = await this.findOne(id);
// Check if this is a system section
if (section.isSystem) {
throw new ForbiddenException(
'Cannot delete system sections. You can only deactivate them.',
);
}
// Check if section has any fields
if (section._count.fields > 0) {
throw new ConflictException(