mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 08:17:54 +00:00
Refactor controllers to use userUuid as route param
This commit is contained in:
@@ -10,12 +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 { AddFloorDto } from '../dtos/add.floor.dto';
|
||||
import { GetFloorByUserIdDto, GetFloorChildDto } from '../dtos/get.floor.dto';
|
||||
import { GetFloorChildDto } from '../dtos/get.floor.dto';
|
||||
import { UpdateFloorNameDto } from '../dtos/update.floor.dto';
|
||||
import { CheckBuildingTypeGuard } from 'src/guards/building.type.guard';
|
||||
|
||||
@@ -94,10 +93,10 @@ export class FloorController {
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
async getFloorsByUserId(@Query(ValidationPipe) dto: GetFloorByUserIdDto) {
|
||||
@Get('user/:userUuid')
|
||||
async getFloorsByUserId(@Param('userUuid') userUuid: string) {
|
||||
try {
|
||||
return await this.floorService.getFloorsByUserId(dto.userUuid);
|
||||
return await this.floorService.getFloorsByUserId(userUuid);
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
error.message || 'Internal server error',
|
||||
|
||||
Reference in New Issue
Block a user