ปรับให้แก้ไขสิทธิ์ได้
This commit is contained in:
parent
bed7dbb896
commit
892a615c35
1 changed files with 23 additions and 4 deletions
|
|
@ -78,8 +78,17 @@ export class AuthRoleController extends Controller {
|
||||||
|
|
||||||
@Post("govoment")
|
@Post("govoment")
|
||||||
public async AddAuthRoleGovoment(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) {
|
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 })
|
const posMaster = await this.posMasterRepository.findOneBy({ id : body.posMasterId })
|
||||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
|
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
|
||||||
|
|
@ -93,8 +102,18 @@ export class AuthRoleController extends Controller {
|
||||||
|
|
||||||
@Post("employee")
|
@Post("employee")
|
||||||
public async AddAuthRoleEmployee(@Request() req: RequestWithUser, @Body() body: CreateAddAuthRole) {
|
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 })
|
const posMaster = await this.employeePosMasterRepository.findOneBy({ id : body.posMasterId })
|
||||||
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
|
if (!posMaster) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue