Refactor controllers to use userUuid as route param

This commit is contained in:
faris Aljohari
2024-04-16 16:11:43 +03:00
parent f30dd755a2
commit 74b7471106
9 changed files with 19 additions and 78 deletions
@@ -10,15 +10,11 @@ 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 {
GetCommunitiesByUserIdDto,
GetCommunityChildDto,
} from '../dtos/get.community.dto';
import { GetCommunityChildDto } from '../dtos/get.community.dto';
import { UpdateCommunityNameDto } from '../dtos/update.community.dto';
@ApiTags('Community Module')
@@ -83,12 +79,10 @@ export class CommunityController {
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get()
async getCommunitiesByUserId(
@Query(ValidationPipe) dto: GetCommunitiesByUserIdDto,
) {
@Get('user/:userUuid')
async getCommunitiesByUserId(@Param('userUuid') userUuid: string) {
try {
return await this.communityService.getCommunitiesByUserId(dto.userUuid);
return await this.communityService.getCommunitiesByUserId(userUuid);
} catch (error) {
throw new HttpException(
error.message || 'Internal server error',