mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
Added Post and Image entities to the database.
This commit is contained in:
24
backend/libs/database/image.entity.ts
Normal file
24
backend/libs/database/image.entity.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Entity, PrimaryColumn, Column, OneToOne, JoinColumn } from 'typeorm';
|
||||
import { Post } from './post.entity';
|
||||
|
||||
@Entity()
|
||||
export class Image {
|
||||
constructor(props?: Partial<Image>) {
|
||||
Object.assign(this, props);
|
||||
}
|
||||
|
||||
@PrimaryColumn()
|
||||
message_id: number;
|
||||
|
||||
@Column({ nullable: false })
|
||||
post_id: number;
|
||||
|
||||
@Column({ nullable: false })
|
||||
file_id: string;
|
||||
@Column({ default: false })
|
||||
has_spoiler: boolean;
|
||||
|
||||
@OneToOne(() => Post)
|
||||
@JoinColumn({ name: 'post_id' })
|
||||
user: Post;
|
||||
}
|
||||
Reference in New Issue
Block a user