mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 00:14:54 +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);
|
return this.spaceService.getSpacesHierarchyForSpace(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
//should it be post?
|
|
||||||
@ApiBearerAuth()
|
@ApiBearerAuth()
|
||||||
@UseGuards(PermissionsGuard)
|
@UseGuards(PermissionsGuard)
|
||||||
@Permissions('SPACE_MEMBER_ADD')
|
@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 {
|
import {
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
HttpException,
|
HttpException,
|
||||||
@ -34,6 +37,7 @@ export class SpaceService {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly dataSource: DataSource,
|
private readonly dataSource: DataSource,
|
||||||
private readonly spaceRepository: SpaceRepository,
|
private readonly spaceRepository: SpaceRepository,
|
||||||
|
private readonly inviteSpaceRepository: InviteSpaceRepository,
|
||||||
private readonly spaceLinkService: SpaceLinkService,
|
private readonly spaceLinkService: SpaceLinkService,
|
||||||
private readonly subSpaceService: SubSpaceService,
|
private readonly subSpaceService: SubSpaceService,
|
||||||
private readonly validationService: ValidationService,
|
private readonly validationService: ValidationService,
|
||||||
@ -448,13 +452,18 @@ export class SpaceService {
|
|||||||
projectUuid,
|
projectUuid,
|
||||||
spaceUuid,
|
spaceUuid,
|
||||||
);
|
);
|
||||||
|
await this.inviteSpaceRepository.save({
|
||||||
space.invitationCode = invitationCode;
|
space: { uuid: spaceUuid },
|
||||||
await this.spaceRepository.save(space);
|
invitationCode,
|
||||||
|
});
|
||||||
|
|
||||||
return new SuccessResponseDto({
|
return new SuccessResponseDto({
|
||||||
message: `Invitation code has been successfuly added to the space`,
|
message: `Invitation code has been successfuly added to the space`,
|
||||||
data: space,
|
data: {
|
||||||
|
invitationCode,
|
||||||
|
spaceName: space.spaceName,
|
||||||
|
spaceUuid: space.uuid,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof BadRequestException) {
|
if (err instanceof BadRequestException) {
|
||||||
|
|||||||
Reference in New Issue
Block a user