Files
JGE-RS-SL-WEB/backend/src/entities/admin-user.entity.ts

35 lines
926 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, Index } from 'typeorm';
export enum AdminRole {
SUPER_ADMIN = 'super_admin',
OPERATOR = 'operator',
VIEWER = 'viewer',
}
@Entity('admin_users')
export class AdminUser {
@PrimaryGeneratedColumn({ type: 'bigint', comment: '用户ID' })
id: number;
@Column({ type: 'varchar', length: 50, unique: true, comment: '用户名' })
@Index()
username: string;
@Column({ type: 'char', length: 60, comment: '密码哈希(bcrypt)' })
passwordHash: string;
@Column({
type: 'enum',
enum: AdminRole,
default: AdminRole.VIEWER,
comment: '角色super_admin-超级管理员, operator-操作员, viewer-查看者',
})
role: AdminRole;
@CreateDateColumn({ type: 'datetime', comment: '创建时间' })
createdAt: Date;
@UpdateDateColumn({ type: 'datetime', comment: '更新时间' })
updatedAt: Date;
}