25 lines
589 B
TypeScript
25 lines
589 B
TypeScript
import { Entity, PrimaryColumn, Column, CreateDateColumn } from 'typeorm';
|
|
|
|
export type UserRole = 'admin' | 'player';
|
|
export type UserStatus = 'enabled' | 'disabled';
|
|
|
|
@Entity('user')
|
|
export class UserEntity {
|
|
@PrimaryColumn('text')
|
|
id!: string;
|
|
|
|
@Column('text', { unique: true })
|
|
username!: string;
|
|
|
|
@Column('text', { name: 'password_hash' })
|
|
passwordHash!: string;
|
|
|
|
@Column('text', { default: 'player' })
|
|
role!: UserRole;
|
|
|
|
@Column('text', { default: 'enabled' })
|
|
status!: UserStatus;
|
|
|
|
@CreateDateColumn({ type: 'text', name: 'created_at' })
|
|
createdAt!: string;
|
|
} |