import { BaseEntity, Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { DiscordRequest } from "./DiscordRequest";
import { User } from "./User";

@Entity()
export class DiscordAccount extends BaseEntity
{
	@PrimaryGeneratedColumn()
	id!: number;

	@Column({ length: 20 })
	discordId!: string;

	@ManyToOne(() => User, user => user.discordAccounts)
	user!: User;

	@OneToMany(() => DiscordRequest, request => request.account)
	requests!: DiscordRequest[];

	@CreateDateColumn()
	createdAt!: Date;
}
