refactor: payment services to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-03-28 06:00:58 +02:00
parent 6251831741
commit f20f07a42f
15 changed files with 574 additions and 10 deletions

View File

@@ -1,11 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import {
ArrayMinSize,
IsArray,
IsBoolean,
IsNotEmpty,
IsNumber,
IsString,
Length,
MinLength,
ValidateNested,
} from 'class-validator';
@@ -34,7 +36,10 @@ export class CommandRolePermissionDto {
description: 'The value of the permission',
})
value: boolean;
}
export class CreateRolePermissionDto extends CommandRolePermissionDto {}
export class EditRolePermissionDto extends CommandRolePermissionDto {
@IsNumber()
@IsNotEmpty()
@ApiProperty({
@@ -60,17 +65,28 @@ class CommandRoleDto {
description: 'The description of the role',
})
roleDescription: string;
}
export class CreateRoleDto extends CommandRoleDto {
@IsArray()
@ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => CommandRolePermissionDto)
@MinLength(1)
@ApiProperty({
type: [CommandRolePermissionDto],
description: 'The permissions of the role',
})
permissions: Array<CommandRolePermissionDto>;
permissions: Array<CreateRolePermissionDto>;
}
export class CreateRoleDto extends CommandRoleDto {}
export class EditRoleDto extends CommandRoleDto {}
export class EditRoleDto extends CommandRoleDto {
@IsArray()
@ArrayMinSize(1)
@ValidateNested({ each: true })
@Type(() => CommandRolePermissionDto)
@ApiProperty({
type: [CommandRolePermissionDto],
description: 'The permissions of the role',
})
permissions: Array<EditRolePermissionDto>;
}