From 35d771bff0fe16ef946314d39f47d6e8c8d3e3d2 Mon Sep 17 00:00:00 2001 From: Errormacr Date: Fri, 24 Nov 2023 11:06:55 +0300 Subject: [PATCH] start create entity for proxy --- backend/libs/database/proxy_user.entity.ts | 31 +++++++++++++++++++ .../libs/database/proxy_user_table.entity.ts | 31 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 backend/libs/database/proxy_user.entity.ts create mode 100644 backend/libs/database/proxy_user_table.entity.ts diff --git a/backend/libs/database/proxy_user.entity.ts b/backend/libs/database/proxy_user.entity.ts new file mode 100644 index 0000000..d89415a --- /dev/null +++ b/backend/libs/database/proxy_user.entity.ts @@ -0,0 +1,31 @@ +import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'; +import { User } from './user.entity'; + +@Entity() +export class ProxyUser { + constructor(props?: Partial) { + Object.assign(this, props); + } + + @PrimaryGeneratedColumn('uuid') + public uuid!: string; + + @Column({ nullable: true }) + public userName: string; + + @Column({ nullable: true }) + public description: string; + + @Column({ nullable: false }) + public link!: string; + + @Column({ nullable: false, type: 'timestamptz' }) + public connectDate!: Date; + + @Column({ nullable: true }) + public user_id!: string; + + @OneToOne(() => User, (user) => user.id, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: true }) + @JoinColumn({ name: 'user_id' }) + public user: User; +} diff --git a/backend/libs/database/proxy_user_table.entity.ts b/backend/libs/database/proxy_user_table.entity.ts new file mode 100644 index 0000000..afb6d52 --- /dev/null +++ b/backend/libs/database/proxy_user_table.entity.ts @@ -0,0 +1,31 @@ +import { Column, Entity, JoinColumn, OneToOne, PrimaryGeneratedColumn } from 'typeorm'; +import { User } from './user.entity'; + +@Entity() +export class Admin { + constructor(props?: Partial) { + Object.assign(this, props); + } + + @PrimaryGeneratedColumn('uuid') + public uuid!: string; + + @Column({ nullable: true }) + public userName: string; + + @Column({ nullable: true }) + public description: string; + + @Column({ nullable: false }) + public link!: string; + + @Column({ nullable: false, type: 'timestamptz' }) + public connectDate!: Date; + + @Column({ nullable: true }) + public user_id!: string; + + @OneToOne(() => User, (user) => user.id, { onDelete: 'CASCADE', onUpdate: 'CASCADE', nullable: true }) + @JoinColumn({ name: 'user_id' }) + public user: User; +}