You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
534 B
31 lines
534 B
import {
|
|
Column,
|
|
CreateDateColumn,
|
|
Entity,
|
|
JoinColumn,
|
|
JoinTable,
|
|
ManyToOne,
|
|
PrimaryGeneratedColumn
|
|
} from 'typeorm'
|
|
import User from 'src/users/entity/user.entity'
|
|
import Channel from './channel.entity'
|
|
|
|
@Entity()
|
|
export default class Message {
|
|
@PrimaryGeneratedColumn()
|
|
id: number
|
|
|
|
@Column()
|
|
text: string
|
|
|
|
@ManyToOne(() => User)
|
|
@JoinColumn()
|
|
author: User
|
|
|
|
@ManyToOne(() => Channel, (channel) => channel.messages)
|
|
@JoinTable()
|
|
channel: Channel
|
|
|
|
@CreateDateColumn()
|
|
created_at: Date
|
|
}
|
|
|