chore: add invoice and subscription entities
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
import { Exclude } from "class-transformer";
|
||||
import { Column, Entity, JoinTable, ManyToMany, ManyToOne, OneToMany, OneToOne } from "typeorm";
|
||||
import { Column, Entity, ManyToMany, ManyToOne, OneToMany, OneToOne } from "typeorm";
|
||||
|
||||
import { Role } from "./role.entity";
|
||||
import { UserGroup } from "./user-group.entity";
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { UserAnnouncement } from "../../announcements/entities/user-announcement.entity";
|
||||
import { Criticism } from "../../criticisms/entities/criticism.entity";
|
||||
import { DanakService } from "../../danak-services/entities/danak-service.entity";
|
||||
import { Invoice } from "../../invoices/entities/invoice.entity";
|
||||
import { Notification } from "../../notifications/entities/notification.entity";
|
||||
import { Payment } from "../../payments/entities/payment.entity";
|
||||
import { UserSetting } from "../../settings/entities/user-setting.entity";
|
||||
import { UserSubscription } from "../../subscriptions/entities/user-subscription.entity";
|
||||
import { TicketMessage } from "../../tickets/entities/ticket-message.entity";
|
||||
import { Ticket } from "../../tickets/entities/ticket.entity";
|
||||
import { Wallet } from "../../wallets/entities/wallet.entity";
|
||||
@@ -41,6 +42,7 @@ export class User extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 100, unique: true, nullable: false })
|
||||
nationalCode: string;
|
||||
|
||||
//-----------------------------------------
|
||||
@ManyToOne(() => Role, { eager: true, onDelete: "RESTRICT", nullable: false })
|
||||
role: Role;
|
||||
|
||||
@@ -56,10 +58,6 @@ export class User extends BaseEntity {
|
||||
@OneToMany(() => Criticism, (criticism) => criticism.user)
|
||||
criticisms: Criticism[];
|
||||
|
||||
@ManyToMany(() => DanakService, (danakService) => danakService.users)
|
||||
@JoinTable()
|
||||
danakServices: DanakService[];
|
||||
|
||||
@OneToMany(() => UserAnnouncement, (userAnnouncement) => userAnnouncement.user)
|
||||
userAnnouncements: UserAnnouncement[];
|
||||
|
||||
@@ -74,4 +72,14 @@ export class User extends BaseEntity {
|
||||
|
||||
@OneToMany(() => Notification, (notification) => notification.recipient)
|
||||
notifications: Notification[];
|
||||
|
||||
@OneToMany(() => UserSubscription, (subscription) => subscription.user)
|
||||
subscriptions: UserSubscription[];
|
||||
|
||||
@OneToMany(() => Invoice, (invoice) => invoice.user)
|
||||
invoices: Invoice[];
|
||||
}
|
||||
|
||||
// @ManyToMany(() => DanakService, (danakService) => danakService.users)
|
||||
// @JoinTable()
|
||||
// danakServices: DanakService[];
|
||||
|
||||
Reference in New Issue
Block a user