Add UserSpaceRepositoryModule and UserSpaceRepository to CommunityModule

This commit is contained in:
faris Aljohari
2024-04-16 15:33:37 +03:00
parent c12b11b81d
commit 230ed4eac1
5 changed files with 88 additions and 3 deletions
@@ -10,11 +10,15 @@ import {
Put,
Query,
UseGuards,
ValidationPipe,
} from '@nestjs/common';
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
import { AddCommunityDto } from '../dtos/add.community.dto';
import { GetCommunityChildDto } from '../dtos/get.community.dto';
import {
GetCommunitiesByUserIdDto,
GetCommunityChildDto,
} from '../dtos/get.community.dto';
import { UpdateCommunityNameDto } from '../dtos/update.community.dto';
@ApiTags('Community Module')
@@ -77,6 +81,22 @@ export class CommunityController {
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get()
async getCommunitiesByUserId(
@Query(ValidationPipe) dto: GetCommunitiesByUserIdDto,
) {
try {
return await this.communityService.getCommunitiesByUserId(dto.userUuid);
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Put('rename/:communityUuid')