finished add room api

This commit is contained in:
faris Aljohari
2024-03-11 10:31:47 +03:00
parent 35feab71bb
commit b2e835c805
8 changed files with 138 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
export * from './room.controller';
+36
View File
@@ -0,0 +1,36 @@
import { RoomService } from '../services/room.service';
import { Body, Controller, Get, Post, Param, UseGuards } 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';
@ApiTags('Room Module')
@Controller({
version: '1',
path: 'room',
})
export class RoomController {
constructor(private readonly roomService: RoomService) {}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get(':userUuid')
async userList(@Param('userUuid') userUuid: string) {
try {
return await this.roomService.getHomesByUserId(userUuid);
} catch (err) {
throw new Error(err);
}
}
// @ApiBearerAuth()
// @UseGuards(JwtAuthGuard)
@Post()
async addRoom(@Body() addRoomDto: AddRoomDto) {
try {
return await this.roomService.addRoom(addRoomDto);
} catch (err) {
throw new Error(err);
}
}
}