feat: Introduce default profile sections and fields, updating schema with isSystem and isSearchableOnly properties.
This commit is contained in:
@@ -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