validation
This commit is contained in:
parent
d78391e1ee
commit
de27e1941b
3 changed files with 39 additions and 14 deletions
|
|
@ -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)]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue