mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 19:44:55 +00:00
Refactor space permission service
This commit is contained in:
@ -11,6 +11,7 @@ export class SpacePermissionService {
|
||||
userUuid: string,
|
||||
type: string,
|
||||
): Promise<void> {
|
||||
try {
|
||||
const spaceData = await this.spaceRepository.findOne({
|
||||
where: {
|
||||
uuid: spaceUuid,
|
||||
@ -31,5 +32,8 @@ export class SpacePermissionService {
|
||||
`You do not have permission to access this ${type}`,
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
throw new BadRequestException(err.message || 'Invalid UUID');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ export class CommunityController {
|
||||
}
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@UseGuards(JwtAuthGuard, CommunityPermissionGuard)
|
||||
@Put('rename/:communityUuid')
|
||||
async renameCommunityByUuid(
|
||||
@Param('communityUuid') communityUuid: string,
|
||||
|
||||
Reference in New Issue
Block a user