rooms creation ok in db
This commit is contained in:
@@ -38,7 +38,7 @@ export class ChatService {
|
||||
newChatroom.name = joinRoomDto.room_name;
|
||||
newChatroom.type = joinRoomDto.room_type;
|
||||
newChatroom.owner = user;
|
||||
const savedChatroom = this.chatroomRepository.save(newChatroom);
|
||||
const savedChatroom = await this.chatroomRepository.save(newChatroom);
|
||||
console.log(savedChatroom);
|
||||
|
||||
return "good room";
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
import { IsBoolean, IsEmpty, IsIn, IsInt, IsNotEmpty, IsNumber, IsString, IsOptional } from "class-validator";
|
||||
import { IsBoolean, IsEmpty, IsInt, IsNotEmpty, IsNumber, IsString, IsOptional } from "class-validator";
|
||||
import { IsNull } from "typeorm";
|
||||
|
||||
export class joinRoomDto {
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
room_name : string
|
||||
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@IsIn(['public', 'private', 'direct'])
|
||||
room_type : string
|
||||
room_type : 'public' | 'private' | 'direct';
|
||||
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
room_password : string
|
||||
|
||||
@@ -9,18 +9,16 @@ import { User } from 'src/users/entities/user.entity';
|
||||
@Entity('chatroom')
|
||||
export class Chatroom {
|
||||
@PrimaryGeneratedColumn()
|
||||
id: number;
|
||||
id: number;
|
||||
|
||||
@Column()
|
||||
name: string;
|
||||
name: string;
|
||||
|
||||
@Column()
|
||||
type: 'public' | 'private' | 'direct';
|
||||
|
||||
@Column({ nullable: true })
|
||||
protection: boolean;
|
||||
type: 'public' | 'private' | 'direct';
|
||||
|
||||
@ManyToOne(type => User, user => user.ownedRoom)
|
||||
owner: User;
|
||||
owner: User;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user