fix(employees): changed email target to use dtos.
This commit is contained in:
parent
5b0e0ce869
commit
f19f981b43
|
|
@ -1,11 +1,11 @@
|
|||
import { Controller, Get, Query, Body, Post, Patch } from "@nestjs/common";
|
||||
import { Modules as ModulesEnum } from ".prisma/client";
|
||||
import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators";
|
||||
import { Access } from "src/common/decorators/module-access.decorators";
|
||||
import { Result } from "src/common/errors/result-error.factory";
|
||||
import { EmployeeDetailedDto } from "src/identity-and-account/employees/dtos/employee-detailed.dto";
|
||||
import { EmployeeDto } from "src/identity-and-account/employees/dtos/employee.dto";
|
||||
import { EmployeesGetService } from "src/identity-and-account/employees/services/employees-get.service";
|
||||
import { ModuleAccessAllowed } from "src/common/decorators/modules-guard.decorators";
|
||||
import { Modules as ModulesEnum } from ".prisma/client";
|
||||
import { EmployeesCreateService } from "src/identity-and-account/employees/services/employees-create.service";
|
||||
import { EmployeesUpdateService } from "src/identity-and-account/employees/services/employees-update.service";
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ export class EmployeesController {
|
|||
|
||||
@Patch('update')
|
||||
@ModuleAccessAllowed(ModulesEnum.employee_management)
|
||||
async updateEmployee(@Access('email') email:string, dto:EmployeeDetailedDto, employee_email?: string){
|
||||
return await this.updateService.updateEmployee(email, dto, employee_email);
|
||||
async updateEmployee(@Access('email') email: string, dto: EmployeeDetailedDto) {
|
||||
return await this.updateService.updateEmployee(email, dto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ export class EmployeesUpdateService {
|
|||
private readonly emailResolver: EmailToIdResolver,
|
||||
) { }
|
||||
|
||||
async updateEmployee(email: string, dto: EmployeeDetailedDto, employee_email?: string): Promise<Result<boolean, string>> {
|
||||
const account_email = employee_email ?? email;
|
||||
async updateEmployee(email: string, dto: EmployeeDetailedDto): Promise<Result<boolean, string>> {
|
||||
const account_email = dto.email ?? email;
|
||||
const user_id = await this.emailResolver.resolveUserIdWithEmail(account_email);
|
||||
if (!user_id.success) return { success: false, error: 'EMPLOYEE_NOT_FOUND' }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user