mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 19:37:54 +00:00
Refactor controllers to use userUuid as route param
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user