2023-02-06 10:24:58 -06:00
|
|
|
import {
|
|
|
|
|
Column,
|
|
|
|
|
CreateDateColumn,
|
|
|
|
|
DeleteDateColumn,
|
|
|
|
|
Entity,
|
|
|
|
|
OneToMany,
|
|
|
|
|
PrimaryGeneratedColumn,
|
|
|
|
|
UpdateDateColumn,
|
|
|
|
|
} from 'typeorm';
|
2023-02-26 20:57:34 +01:00
|
|
|
import { AssetEntity } from './asset.entity';
|
2022-12-05 11:56:44 -06:00
|
|
|
import { TagEntity } from './tag.entity';
|
2022-02-03 10:06:44 -06:00
|
|
|
|
|
|
|
|
@Entity('users')
|
|
|
|
|
export class UserEntity {
|
|
|
|
|
@PrimaryGeneratedColumn('uuid')
|
2022-06-25 19:53:06 +02:00
|
|
|
id!: string;
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({ default: '' })
|
2022-06-25 19:53:06 +02:00
|
|
|
firstName!: string;
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({ default: '' })
|
2022-06-25 19:53:06 +02:00
|
|
|
lastName!: string;
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({ default: false })
|
2022-06-25 19:53:06 +02:00
|
|
|
isAdmin!: boolean;
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-12-09 22:16:25 -05:00
|
|
|
@Column({ unique: true })
|
2022-06-25 19:53:06 +02:00
|
|
|
email!: string;
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2023-05-21 23:18:10 -04:00
|
|
|
@Column({ type: 'varchar', unique: true, default: null })
|
|
|
|
|
storageLabel!: string | null;
|
|
|
|
|
|
2022-11-14 21:24:25 -05:00
|
|
|
@Column({ default: '', select: false })
|
2022-06-25 19:53:06 +02:00
|
|
|
password?: string;
|
2022-02-03 10:06:44 -06:00
|
|
|
|
2022-12-26 10:35:52 -05:00
|
|
|
@Column({ default: '' })
|
2022-12-03 22:59:24 -05:00
|
|
|
oauthId!: string;
|
|
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({ default: '' })
|
2022-06-25 19:53:06 +02:00
|
|
|
profileImagePath!: string;
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-07-04 20:20:43 +01:00
|
|
|
@Column({ default: true })
|
2022-06-27 15:13:07 -05:00
|
|
|
shouldChangePassword!: boolean;
|
2022-05-21 02:23:55 -05:00
|
|
|
|
2022-02-03 10:06:44 -06:00
|
|
|
@CreateDateColumn()
|
2022-06-25 19:53:06 +02:00
|
|
|
createdAt!: string;
|
2022-11-07 16:53:47 -05:00
|
|
|
|
|
|
|
|
@DeleteDateColumn()
|
|
|
|
|
deletedAt?: Date;
|
2022-12-05 11:56:44 -06:00
|
|
|
|
2023-02-06 10:24:58 -06:00
|
|
|
@UpdateDateColumn({ type: 'timestamptz' })
|
|
|
|
|
updatedAt!: string;
|
|
|
|
|
|
2022-12-05 11:56:44 -06:00
|
|
|
@OneToMany(() => TagEntity, (tag) => tag.user)
|
|
|
|
|
tags!: TagEntity[];
|
2023-02-26 20:57:34 +01:00
|
|
|
|
|
|
|
|
@OneToMany(() => AssetEntity, (asset) => asset.owner)
|
|
|
|
|
assets!: AssetEntity[];
|
2022-02-03 10:06:44 -06:00
|
|
|
}
|