Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-06-14 14:38:55 +07:00
commit 252ecdf6ee

View file

@ -78,9 +78,18 @@ export class AuthRoleController extends Controller {
@Post("govoment")
public async AddAuthRoleGovoment(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) {
const getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
let _NULL_ : any = null;
let getDetail
if(body.authRoleId == "") {
body.authRoleId = _NULL_
}
else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
}
const posMaster = await this.posMasterRepository.findOneBy({ id : body.posMasterId })
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
@ -93,8 +102,18 @@ export class AuthRoleController extends Controller {
@Post("employee")
public async AddAuthRoleEmployee(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) {
const getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
let _NULL_ : any = null;
let getDetail
if(body.authRoleId == "") {
body.authRoleId = _NULL_
}
else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
}
const posMaster = await this.employeePosMasterRepository.findOneBy({ id : body.posMasterId })
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");