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