validation

This commit is contained in:
AdisakKanthawilang 2024-06-11 16:09:12 +07:00
parent d78391e1ee
commit de27e1941b
3 changed files with 39 additions and 14 deletions

View file

@ -62,13 +62,13 @@ export class AuthRoleController extends Controller {
@Patch("{roleId}")
public async editAuthRole(
@Body() requestBody: UpdateAuthRole,
@Body() body: UpdateAuthRole,
@Request() req: RequestWithUser,
@Path() roleId: string,
) {
const record = await this.authRoleRepo.findOneBy({ id: roleId });
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
Object.assign(record, requestBody);
Object.assign(record, body);
record.lastUpdateFullName = req.user.name;
await Promise.all([this.authRoleRepo.save(record)]);