feat(nestjs): migrate to NestJS

This commit is contained in:
Ahmed Bouhuolia
2025-04-07 11:51:24 +02:00
parent f068218a16
commit 55fcc908ef
3779 changed files with 631 additions and 195332 deletions

View File

@@ -0,0 +1,62 @@
import { Injectable } from '@nestjs/common';
import { CreateRoleService } from './commands/CreateRole.service';
import { DeleteRoleService } from './commands/DeleteRole.service';
import { EditRoleService } from './commands/EditRole.service';
import { GetRoleService } from './queries/GetRole.service';
import { GetRolesService } from './queries/GetRoles.service';
@Injectable()
export class RolesApplication {
constructor(
private readonly createRoleService: CreateRoleService,
private readonly editRoleService: EditRoleService,
private readonly deleteRoleService: DeleteRoleService,
private readonly getRoleService: GetRoleService,
private readonly getRolesService: GetRolesService,
) {}
/**
* Creates a new role.
* @param createRoleDto The data for creating a new role.
* @returns The created role.
*/
async createRole(createRoleDto: any) {
return this.createRoleService.createRole(createRoleDto);
}
/**
* Edits an existing role.
* @param roleId The ID of the role to edit.
* @param editRoleDto The data for editing the role.
* @returns The edited role.
*/
async editRole(roleId: number, editRoleDto: any) {
return this.editRoleService.editRole(roleId, editRoleDto);
}
/**
* Deletes a role.
* @param roleId The ID of the role to delete.
* @returns The result of the deletion operation.
*/
async deleteRole(roleId: number) {
return this.deleteRoleService.deleteRole(roleId);
}
/**
* Gets a specific role by ID.
* @param roleId The ID of the role to retrieve.
* @returns The requested role.
*/
async getRole(roleId: number) {
return this.getRoleService.getRole(roleId);
}
/**
* Lists all roles.
* @returns A list of all roles.
*/
async getRoles() {
return this.getRolesService.getRoles();
}
}