mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
Add InviteSpaceRepository and update invitation code handling
This commit is contained in:
@ -112,7 +112,6 @@ export class SpaceController {
|
||||
return this.spaceService.getSpacesHierarchyForSpace(params);
|
||||
}
|
||||
|
||||
//should it be post?
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(PermissionsGuard)
|
||||
@Permissions('SPACE_MEMBER_ADD')
|
||||
|
@ -1,4 +1,7 @@
|
||||
import { SpaceRepository } from '@app/common/modules/space/repositories';
|
||||
import {
|
||||
InviteSpaceRepository,
|
||||
SpaceRepository,
|
||||
} from '@app/common/modules/space/repositories';
|
||||
import {
|
||||
BadRequestException,
|
||||
HttpException,
|
||||
@ -34,6 +37,7 @@ export class SpaceService {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly spaceRepository: SpaceRepository,
|
||||
private readonly inviteSpaceRepository: InviteSpaceRepository,
|
||||
private readonly spaceLinkService: SpaceLinkService,
|
||||
private readonly subSpaceService: SubSpaceService,
|
||||
private readonly validationService: ValidationService,
|
||||
@ -448,13 +452,18 @@ export class SpaceService {
|
||||
projectUuid,
|
||||
spaceUuid,
|
||||
);
|
||||
|
||||
space.invitationCode = invitationCode;
|
||||
await this.spaceRepository.save(space);
|
||||
await this.inviteSpaceRepository.save({
|
||||
space: { uuid: spaceUuid },
|
||||
invitationCode,
|
||||
});
|
||||
|
||||
return new SuccessResponseDto({
|
||||
message: `Invitation code has been successfuly added to the space`,
|
||||
data: space,
|
||||
data: {
|
||||
invitationCode,
|
||||
spaceName: space.spaceName,
|
||||
spaceUuid: space.uuid,
|
||||
},
|
||||
});
|
||||
} catch (err) {
|
||||
if (err instanceof BadRequestException) {
|
||||
|
Reference in New Issue
Block a user