mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 03:24:53 +00:00
finshed get room by id api
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
import { RoomService } from '../services/room.service';
|
||||
import { Body, Controller, Get, Post, Param, UseGuards } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
UseGuards,
|
||||
Query,
|
||||
Param,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '../../../libs/common/src/guards/jwt.auth.guard';
|
||||
import { AddRoomDto } from '../dtos/add.room.dto';
|
||||
@ -14,15 +22,24 @@ export class RoomController {
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':homeId')
|
||||
async userList(@Param('homeId') homeId: string) {
|
||||
@Get()
|
||||
async getRoomsByHomeId(@Query('homeId') homeId: string) {
|
||||
try {
|
||||
return await this.roomService.getRoomsByHomeId(homeId);
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get(':roomId')
|
||||
async getRoomsByRoomId(@Param('roomId') roomId: string) {
|
||||
try {
|
||||
return await this.roomService.getRoomsByRoomId(roomId);
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post()
|
||||
|
||||
Reference in New Issue
Block a user