mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-26 12:34:54 +00:00
Add UserSpaceRepositoryModule and UserSpaceRepository to BuildingModule
This commit is contained in:
@ -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 { AddBuildingDto } from '../dtos/add.building.dto';
|
||||
import { GetBuildingChildDto } from '../dtos/get.building.dto';
|
||||
import {
|
||||
GetBuildingByUserIdDto,
|
||||
GetBuildingChildDto,
|
||||
} from '../dtos/get.building.dto';
|
||||
import { UpdateBuildingNameDto } from '../dtos/update.building.dto';
|
||||
import { CheckCommunityTypeGuard } from 'src/guards/community.type.guard';
|
||||
|
||||
@ -92,6 +96,23 @@ export class BuildingController {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get()
|
||||
async getBuildingsByUserId(
|
||||
@Query(ValidationPipe) dto: GetBuildingByUserIdDto,
|
||||
) {
|
||||
try {
|
||||
return await this.buildingService.getBuildingsByUserId(dto.userUuid);
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
error.message || 'Internal server error',
|
||||
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Put('rename/:buildingUuid')
|
||||
|
||||
Reference in New Issue
Block a user