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-02-22 11:56:26 +00:00
|
|
|
@Unique(['ethAddress'])
|
2024-01-16 08:10:14 +00:00
|
|
|
export class User {
|
2024-02-06 13:41:53 +00:00
|
|
|
@PrimaryGeneratedColumn('uuid')
|
|
|
|
id!: string;
|
2024-01-16 08:10:14 +00:00
|
|
|
|
2024-02-22 11:56:26 +00:00
|
|
|
// TODO: Set ethAddress as ID
|
|
|
|
@Column()
|
|
|
|
ethAddress!: string;
|
|
|
|
|
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-05-06 19:36:33 +00:00
|
|
|
@Column()
|
|
|
|
subOrgId!: string;
|
|
|
|
|
|
|
|
@Column()
|
|
|
|
turnkeyWalletId!: string;
|
|
|
|
|
2024-02-22 05:45:17 +00:00
|
|
|
@OneToMany(() => ProjectMember, (projectMember) => projectMember.project, {
|
2024-02-01 10:04:17 +00:00
|
|
|
cascade: ['soft-remove']
|
|
|
|
})
|
2024-01-24 14:47:43 +00:00
|
|
|
projectMembers!: ProjectMember[];
|
2024-02-01 10:04:17 +00:00
|
|
|
|
2024-02-22 05:45:17 +00:00
|
|
|
@OneToMany(
|
|
|
|
() => UserOrganization,
|
|
|
|
(UserOrganization) => UserOrganization.member,
|
|
|
|
{
|
|
|
|
cascade: ['soft-remove']
|
|
|
|
}
|
|
|
|
)
|
2024-02-01 10:04:17 +00:00
|
|
|
userOrganizations!: UserOrganization[];
|
2024-01-16 08:10:14 +00:00
|
|
|
}
|