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