mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
Some entities changes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Entity, OneToOne, JoinColumn, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { User } from './user.entity';
|
||||
|
||||
@Entity()
|
||||
@@ -10,10 +10,10 @@ export class Admin {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id!: number;
|
||||
|
||||
@Column()
|
||||
user_id: string;
|
||||
@Column({ nullable: false })
|
||||
public user_id!: string;
|
||||
|
||||
@OneToOne(() => User)
|
||||
@OneToOne(() => User, (user) => user.id)
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user: User;
|
||||
public user!: User;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Entity, PrimaryColumn, Column, OneToOne, JoinColumn } from 'typeorm';
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm';
|
||||
import { Post } from './post.entity';
|
||||
|
||||
@Entity()
|
||||
@@ -8,17 +9,19 @@ export class Image {
|
||||
}
|
||||
|
||||
@PrimaryColumn()
|
||||
message_id: number;
|
||||
public message_id!: number;
|
||||
|
||||
@Column({ nullable: false })
|
||||
post_id: number;
|
||||
public file_id!: string;
|
||||
|
||||
@Column({ nullable: false })
|
||||
file_id: string;
|
||||
@Column({ default: false })
|
||||
has_spoiler: boolean;
|
||||
public has_spoiler!: boolean;
|
||||
|
||||
@OneToOne(() => Post)
|
||||
@JoinColumn({ name: 'post_id' })
|
||||
user: Post;
|
||||
@Column({ nullable: false })
|
||||
public post_uuid!: string;
|
||||
|
||||
@ApiProperty({})
|
||||
@ManyToOne(() => Post, (post) => post.uuid)
|
||||
@JoinColumn({ name: 'post_uuid' })
|
||||
public post!: Post;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Timestamp, OneToOne, JoinColumn } from 'typeorm';
|
||||
import { Column, Entity, JoinColumn, OneToMany, OneToOne, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { Admin } from './admin.entity';
|
||||
import { Image } from './image.entity';
|
||||
@Entity()
|
||||
export class Post {
|
||||
constructor(props?: Partial<Post>) {
|
||||
@@ -7,21 +8,27 @@ export class Post {
|
||||
}
|
||||
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
uuid: string;
|
||||
public uuid!: string;
|
||||
|
||||
@Column({ default: false })
|
||||
posted: boolean;
|
||||
public posted!: boolean;
|
||||
|
||||
@Column()
|
||||
public text: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
public media_group_id: string;
|
||||
|
||||
@Column({ type: 'timestamptz' })
|
||||
public timestamp!: Date;
|
||||
|
||||
@Column({ nullable: false })
|
||||
from_user_id: string;
|
||||
@Column()
|
||||
text: string;
|
||||
@Column()
|
||||
media_group_id: string;
|
||||
@Column({ type: 'timestamptz' })
|
||||
timestamps: Date;
|
||||
public from_user_id!: string;
|
||||
|
||||
@OneToOne(() => Admin)
|
||||
@OneToOne(() => Admin, (admin) => admin.user.id)
|
||||
@JoinColumn({ name: 'from_user_id' })
|
||||
user: Admin;
|
||||
public from_user!: Admin;
|
||||
|
||||
@OneToMany(() => Image, (image) => image.post)
|
||||
public images: Image[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user