This commit is contained in:
Bastian Wagner
2026-06-09 09:45:33 +02:00
commit 537c7cbbee
124 changed files with 27283 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
import {
Column,
CreateDateColumn,
Entity,
Index,
OneToMany,
PrimaryColumn,
UpdateDateColumn,
} from 'typeorm';
import { ListTemplateEntity } from '../list-templates/list-template.entity';
import { UserListEntity } from '../lists/user-list.entity';
import { RefreshTokenEntity } from './refresh-token.entity';
@Entity('users')
export class UserEntity {
@PrimaryColumn({ type: 'varchar', length: 36 })
id!: string;
@Index({ unique: true })
@Column({ type: 'varchar', length: 320 })
email!: string;
@Column({ type: 'varchar', length: 160, nullable: true })
name?: string | null;
@Column({ type: 'varchar', length: 255 })
passwordHash!: string;
@Index({ unique: true })
@Column({ type: 'varchar', length: 128, nullable: true })
verificationToken?: string | null;
@Column({ type: 'boolean', default: false })
verified!: boolean;
@CreateDateColumn({
type: 'datetime',
precision: 3,
default: () => 'CURRENT_TIMESTAMP(3)',
})
createdAt!: Date;
@UpdateDateColumn({
type: 'datetime',
precision: 3,
default: () => 'CURRENT_TIMESTAMP(3)',
onUpdate: 'CURRENT_TIMESTAMP(3)',
})
updatedAt!: Date;
@OneToMany(() => RefreshTokenEntity, (refreshToken) => refreshToken.user)
refreshTokens?: RefreshTokenEntity[];
@OneToMany(() => ListTemplateEntity, (template) => template.owner)
templates?: ListTemplateEntity[];
@OneToMany(() => UserListEntity, (list) => list.owner)
lists?: UserListEntity[];
}