mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-15 13:09:43 +03:00
44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
|
|
import { Admin } from "./admin.entity";
|
|
import { Image } from "./image.entity";
|
|
@Entity()
|
|
export class Post {
|
|
constructor(props?: Partial<Post>) {
|
|
Object.assign(this, props);
|
|
}
|
|
|
|
@PrimaryGeneratedColumn("uuid")
|
|
public uuid!: string;
|
|
|
|
@Column({ default: false })
|
|
public posted!: boolean;
|
|
|
|
@Column({ nullable: true })
|
|
public text?: string;
|
|
|
|
@Column({ nullable: true })
|
|
public media_group_id: string;
|
|
|
|
@Column({ type: "timestamptz" })
|
|
public timestamp!: Date;
|
|
|
|
@Column({ type: "timestamptz", nullable: true })
|
|
public edit_timestamp?: Date;
|
|
|
|
@Column({ nullable: false })
|
|
public from_user_id!: string;
|
|
|
|
@ManyToOne(() => Admin, (admin) => admin.user.id)
|
|
@JoinColumn({ name: "from_user_id", referencedColumnName: "user_id" })
|
|
public from_user!: Admin;
|
|
|
|
@OneToMany(() => Image, (image) => image.post)
|
|
public images: Image[];
|
|
|
|
@Column({ nullable: true })
|
|
public message_entities?: string;
|
|
|
|
@Column({ default: false })
|
|
public deleted: boolean;
|
|
}
|