From 9f0f361cbf2c747df1439edd1b6ba7f30ed17f2f Mon Sep 17 00:00:00 2001 From: rmagur1203 Date: Sat, 4 Mar 2023 17:32:35 +0900 Subject: [PATCH] fix: compare (#18) * fix: compare --- packages/server/src/club/club.service.ts | 2 +- packages/server/src/form/form.service.ts | 4 ++-- packages/server/src/project/project.service.ts | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/server/src/club/club.service.ts b/packages/server/src/club/club.service.ts index 8c80cba..ba7bda0 100644 --- a/packages/server/src/club/club.service.ts +++ b/packages/server/src/club/club.service.ts @@ -40,7 +40,7 @@ export class ClubService { async update(admin: Admin, id: number, updateClubDto: UpdateClubDto) { const item = await this.clubRepository.findOneBy({ id }); - if (admin.role !== 'admin' && compare(admin.role, item?.name)) { + if (admin.role !== 'admin' && !compare(admin.role, item?.name)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } return this.clubRepository.update(id, updateClubDto); diff --git a/packages/server/src/form/form.service.ts b/packages/server/src/form/form.service.ts index 3f9e6e2..e7e4f78 100644 --- a/packages/server/src/form/form.service.ts +++ b/packages/server/src/form/form.service.ts @@ -31,7 +31,7 @@ export class FormService { if (!club) { throw new HttpException('Club not found', HttpStatus.NOT_FOUND); } - if (admin.role !== 'admin' && compare(admin.role, club?.name)) { + if (admin.role !== 'admin' && !compare(admin.role, club?.name)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } const item = { @@ -48,7 +48,7 @@ export class FormService { if (!club) { throw new HttpException('Club not found', HttpStatus.NOT_FOUND); } - if (admin.role !== 'admin' && compare(admin.role, club?.name)) { + if (admin.role !== 'admin' && !compare(admin.role, club?.name)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } const item = { diff --git a/packages/server/src/project/project.service.ts b/packages/server/src/project/project.service.ts index 0ca864b..e383a6c 100644 --- a/packages/server/src/project/project.service.ts +++ b/packages/server/src/project/project.service.ts @@ -18,7 +18,7 @@ export class ProjectService { ) {} async create(admin: Admin, createProjectDto: CreateProjectDto) { - if (admin.role !== 'admin' && compare(admin.role, createProjectDto.club)) { + if (admin.role !== 'admin' && !compare(admin.role, createProjectDto.club)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } const project = this.projectRepository.create(createProjectDto); @@ -57,7 +57,7 @@ export class ProjectService { } async update(admin: Admin, id: number, updateProjectDto: UpdateProjectDto) { - if (admin.role !== 'admin' && compare(admin.role, updateProjectDto.club)) { + if (admin.role !== 'admin' && !compare(admin.role, updateProjectDto.club)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } if (admin.role !== 'admin') { @@ -72,7 +72,7 @@ export class ProjectService { async remove(admin: Admin, id: number) { const item = await this.projectRepository.findOneBy({ id }); - if (admin.role !== 'admin' && compare(admin.role, item?.club)) { + if (admin.role !== 'admin' && !compare(admin.role, item?.club)) { throw new HttpException('Not admin of club', HttpStatus.UNAUTHORIZED); } return this.projectRepository.delete(id);