join room dto
This commit is contained in:
@@ -2,6 +2,7 @@ import { Controller, UseGuards, HttpException, HttpStatus, Get, Post, Body, Req,
|
||||
import { AuthenticateGuard, TwoFactorGuard } from 'src/auth/42/guards/42guards';
|
||||
import { ChatService } from './chat.service';
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import { joinRoomDto } from './dto/joinRoom.dto';
|
||||
|
||||
@Controller('chat')
|
||||
export class ChatController {
|
||||
@@ -13,7 +14,7 @@ export class ChatController {
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
@Get('rooms')
|
||||
async get_rooms() {
|
||||
async getRooms() {
|
||||
const rooms = await this.chatService.getRooms();
|
||||
return { rooms };
|
||||
}
|
||||
@@ -21,11 +22,11 @@ export class ChatController {
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
@Post('join')
|
||||
async join_room(@Body() body, @Req() req, @Res() res) {
|
||||
async joinRoom(@Body() joinRoomDto: joinRoomDto, @Req() req, @Res() res) {
|
||||
console.log("------ create :");
|
||||
console.log(typeof body);
|
||||
console.log(body);
|
||||
console.log(body.room_name);
|
||||
console.log(typeof joinRoomDto);
|
||||
console.log(joinRoomDto);
|
||||
console.log(joinRoomDto.room_name);
|
||||
//const { room_name } = body;
|
||||
|
||||
//const user: User = req.user;
|
||||
@@ -36,7 +37,7 @@ export class ChatController {
|
||||
|
||||
//return { message: 'Successfully joined room.' };
|
||||
//return res.status(HttpStatus.BAD_REQUEST).json({message : 'You can\'t grant a ticket to another user'});
|
||||
return body;
|
||||
return joinRoomDto;
|
||||
}
|
||||
|
||||
@UseGuards(AuthenticateGuard)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { IsBoolean, IsEmpty, IsInt, IsNotEmpty, IsNumber, IsString } from "class-validator";
|
||||
import { IsNull } from "typeorm";
|
||||
|
||||
export class joinRoomDto {
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
room_name : string
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
room_type : string
|
||||
@IsString()
|
||||
room_password : string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user