2024-01-16 08:10:14 +00:00
|
|
|
import {
|
|
|
|
Entity,
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
Column,
|
2024-01-24 14:47:43 +00:00
|
|
|
CreateDateColumn,
|
2024-02-01 10:04:17 +00:00
|
|
|
OneToMany,
|
|
|
|
Unique
|
2024-01-16 08:10:14 +00:00
|
|
|
} from 'typeorm';
|
2024-02-01 10:04:17 +00:00
|
|
|
|
2024-01-24 14:47:43 +00:00
|
|
|
import { ProjectMember } from './ProjectMember';
|
2024-02-01 10:04:17 +00:00
|
|
|
import { UserOrganization } from './UserOrganization';
|
2024-01-16 08:10:14 +00:00
|
|
|
|
|
|
|
@Entity()
|
2024-02-01 10:04:17 +00:00
|
|
|
@Unique(['email'])
|
2024-01-16 08:10:14 +00:00
|
|
|
export class User {
|
|
|
|
@PrimaryGeneratedColumn()
|
|
|
|
id!: number;
|
|
|
|
|
2024-02-01 10:04:17 +00:00
|
|
|
@Column('varchar', { length: 255, nullable: true })
|
|
|
|
name!: string | null;
|
2024-01-16 08:10:14 +00:00
|
|
|
|
|
|
|
@Column()
|
|
|
|
email!: string;
|
|
|
|
|
2024-01-31 13:21:53 +00:00
|
|
|
@Column('varchar', { nullable: true })
|
|
|
|
gitHubToken!: string | null;
|
|
|
|
|
2024-02-01 10:04:17 +00:00
|
|
|
@Column('boolean', { default: false })
|
|
|
|
isVerified!: boolean;
|
|
|
|
|
2024-01-16 08:10:14 +00:00
|
|
|
@CreateDateColumn()
|
|
|
|
createdAt!: Date;
|
|
|
|
|
|
|
|
@CreateDateColumn()
|
|
|
|
updatedAt!: Date;
|
2024-01-24 14:47:43 +00:00
|
|
|
|
2024-02-01 10:04:17 +00:00
|
|
|
@OneToMany(() => ProjectMember, projectMember => projectMember.project, {
|
|
|
|
cascade: ['soft-remove']
|
|
|
|
})
|
2024-01-24 14:47:43 +00:00
|
|
|
projectMembers!: ProjectMember[];
|
2024-02-01 10:04:17 +00:00
|
|
|
|
|
|
|
@OneToMany(() => UserOrganization, UserOrganization => UserOrganization.member, {
|
|
|
|
cascade: ['soft-remove']
|
|
|
|
})
|
|
|
|
userOrganizations!: UserOrganization[];
|
2024-01-16 08:10:14 +00:00
|
|
|
}
|