refactor: subscriptions to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-03-24 23:38:43 +02:00
parent 4c42515613
commit ef22b9ddaf
87 changed files with 3949 additions and 92 deletions

View File

@@ -0,0 +1,46 @@
import { Type } from 'class-transformer';
import {
IsArray,
IsBoolean,
IsNotEmpty,
IsNumber,
IsString,
MinLength,
ValidateNested,
} from 'class-validator';
export class CommandRolePermissionDto {
@IsString()
@IsNotEmpty()
subject: string;
@IsString()
@IsNotEmpty()
ability: string;
@IsBoolean()
@IsNotEmpty()
value: boolean;
@IsNumber()
permissionId: number;
}
class CommandRoleDto {
@IsString()
@IsNotEmpty()
roleName: string;
@IsString()
@IsNotEmpty()
roleDescription: string;
@IsArray()
@ValidateNested({ each: true })
@Type(() => CommandRolePermissionDto)
@MinLength(1)
permissions: Array<CommandRolePermissionDto>;
}
export class CreateRoleDto extends CommandRoleDto {}
export class EditRoleDto extends CommandRoleDto {}