crud auth role
This commit is contained in:
parent
3874df5cea
commit
cbe54233ca
3 changed files with 203 additions and 7 deletions
|
|
@ -25,11 +25,7 @@ export class AuthSysController extends Controller {
|
|||
private authSysRepo = AppDataSource.getRepository(AuthSys);
|
||||
|
||||
@Get("list")
|
||||
public async listAuthSys(@Request() request: { user: Record<string, any> }) {
|
||||
const profile = await this.authSysRepo.findOneBy({ id: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
}
|
||||
public async listAuthSys() {
|
||||
const getList = await this.authSysRepo.find();
|
||||
if (!getList || getList.length === 0) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -84,8 +80,7 @@ export class AuthSysController extends Controller {
|
|||
}
|
||||
|
||||
@Delete("{systemId}")
|
||||
public async deleteProfileAbility(@Path() systemId: string) {
|
||||
|
||||
public async deleteAuthSys(@Path() systemId: string) {
|
||||
const result = await this.authSysRepo.delete({ id: systemId });
|
||||
|
||||
if (result.affected == undefined || result.affected <= 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue