chore: import DH V2 D5.6.4 production baseline
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { TimestampedEntity } from './timestamped.entity';
|
||||
|
||||
export enum UserStatus {
|
||||
ACTIVE = 'ACTIVE',
|
||||
INACTIVE = 'INACTIVE',
|
||||
}
|
||||
|
||||
@Entity({ name: 'users' })
|
||||
@Index('idx_users_status', ['status'])
|
||||
@Index('idx_users_locked_until', ['lockedUntil'])
|
||||
export class User extends TimestampedEntity {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 80 })
|
||||
username!: string;
|
||||
|
||||
@Column({ type: 'varchar', length: 320, nullable: true })
|
||||
email!: string | null;
|
||||
|
||||
@Column({ name: 'password_hash', type: 'text', select: false })
|
||||
passwordHash!: string;
|
||||
|
||||
@Column({ name: 'first_name', type: 'varchar', length: 120 })
|
||||
firstName!: string;
|
||||
|
||||
@Column({ name: 'last_name', type: 'varchar', length: 120 })
|
||||
lastName!: string;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: UserStatus,
|
||||
enumName: 'user_status',
|
||||
default: UserStatus.ACTIVE,
|
||||
})
|
||||
status!: UserStatus;
|
||||
|
||||
@Column({ name: 'must_change_password', type: 'boolean', default: true })
|
||||
mustChangePassword!: boolean;
|
||||
|
||||
@Column({ name: 'failed_login_attempts', type: 'integer', default: 0 })
|
||||
failedLoginAttempts!: number;
|
||||
|
||||
@Column({ name: 'locked_until', type: 'timestamptz', nullable: true })
|
||||
lockedUntil!: Date | null;
|
||||
|
||||
@Column({ name: 'last_login_at', type: 'timestamptz', nullable: true })
|
||||
lastLoginAt!: Date | null;
|
||||
|
||||
@Column({ name: 'password_changed_at', type: 'timestamptz', nullable: true })
|
||||
passwordChangedAt!: Date | null;
|
||||
|
||||
@Column({ name: 'created_by', type: 'uuid', nullable: true })
|
||||
createdBy!: string | null;
|
||||
|
||||
@Column({ name: 'updated_by', type: 'uuid', nullable: true })
|
||||
updatedBy!: string | null;
|
||||
}
|
||||
Reference in New Issue
Block a user