feat: Introduce default profile sections and fields, updating schema with isSystem and isSearchableOnly properties.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user