mirror of
https://github.com/MrSedan/neuro-reply-website.git
synced 2026-01-14 20:49:42 +03:00
This commit adds the Payment and ProxyUser entities to the database.
This commit is contained in:
31
backend/libs/database/ProxyUser.entity.ts
Normal file
31
backend/libs/database/ProxyUser.entity.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { Entity, OneToOne, JoinColumn, PrimaryGeneratedColumn, Column } from 'typeorm';
|
||||
import { User } from './user.entity';
|
||||
|
||||
@Entity()
|
||||
export class ProxyUser {
|
||||
constructor(props?: Partial<ProxyUser>) {
|
||||
Object.assign(this, props);
|
||||
}
|
||||
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
public id!: 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 })
|
||||
user_id: string;
|
||||
|
||||
@OneToOne(() => User)
|
||||
@JoinColumn({ name: 'user_id' })
|
||||
user: User;
|
||||
}
|
||||
22
backend/libs/database/payment.entity.ts
Normal file
22
backend/libs/database/payment.entity.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from 'typeorm';
|
||||
import { ProxyUser } from './ProxyUser.entity';
|
||||
|
||||
@Entity()
|
||||
export class Payment {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
public id!: string;
|
||||
|
||||
@Column()
|
||||
public uuidUser!: string;
|
||||
|
||||
@Column({ type: 'timestamptz' })
|
||||
public payTime!: Date;
|
||||
|
||||
@ManyToOne(() => ProxyUser, { onDelete: 'CASCADE' }) // Assuming you want to cascade delete when a user is deleted
|
||||
@JoinColumn({ name: 'uuidUser' })
|
||||
user: ProxyUser;
|
||||
|
||||
constructor(props?: Partial<Payment>) {
|
||||
Object.assign(this, props);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Entity, PrimaryGeneratedColumn, Column, Timestamp, OneToOne, JoinColumn } from 'typeorm';
|
||||
import { Entity, PrimaryGeneratedColumn, Column, OneToOne, JoinColumn } from 'typeorm';
|
||||
import { Admin } from './admin.entity';
|
||||
@Entity()
|
||||
export class Post {
|
||||
|
||||
@@ -4,8 +4,10 @@ import { User } from './database/user.entity';
|
||||
import { Admin } from './database/admin.entity';
|
||||
import { Post } from './database/post.entity';
|
||||
import { Image } from './database/image.entity';
|
||||
import { Payment } from './database/payment.entity';
|
||||
import { ProxyUser } from './database/ProxyUser.entity';
|
||||
@Module({
|
||||
imports: [TypeOrmModule.forFeature([User, Admin, Post, Image])],
|
||||
imports: [TypeOrmModule.forFeature([User, Admin, Post, Image, Payment, ProxyUser])],
|
||||
exports: [TypeOrmModule],
|
||||
})
|
||||
export class LibsModule {}
|
||||
|
||||
Reference in New Issue
Block a user