Files
37duAutomation/desktop/controlplane-next/server/src/modules/center/entity/account.ts
T
puddy f0a94bf523 build(desktop): 升级 electron-shell 版本至 1.6.3 并调整插件执行超时配置
- 插件执行超时默认延长至 6 小时,支持插件单独配置超时时间
- 新增插件根目录迁移逻辑,解决旧版权限问题
- 新增多个服务端实体、DTO、配置模块等基础代码
- 新增插件 UI 模板及相关静态资源
2026-10-15 11:38:45 +08:00

129 lines
4.5 KiB
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 { Column, Entity, Index, PrimaryColumn, PrimaryGeneratedColumn } from 'typeorm';
/**
* 统一账号(现网 accounts 表)
*/
@Entity('accounts')
export class AccountEntity {
@PrimaryGeneratedColumn({ name: 'id', type: 'int', unsigned: true, comment: '账号自增ID' })
id: number;
@Index({ unique: true })
@Column({ name: 'account', type: 'varchar', length: 64, comment: '登录账号(工号,唯一)' })
account: string;
@Column({ name: 'password_hash', type: 'varchar', length: 128, comment: '密码哈希(加盐)' })
passwordHash: string;
@Column({ name: 'salt', type: 'varchar', length: 64, comment: '密码盐值' })
salt: string;
@Column({ name: 'is_admin', type: 'tinyint', width: 1, default: 0, comment: '是否管理员' })
isAdmin: number;
@Index()
@Column({ name: 'dept', type: 'varchar', length: 64, default: '', comment: '所属部门' })
dept: string;
@Column({ name: 'nickname', type: 'varchar', length: 64, default: '', comment: '昵称/姓名' })
nickname: string;
@Column({ name: 'dingtalk_uid', type: 'varchar', length: 64, default: '', comment: '钉钉用户ID' })
dingtalkUid: string;
@Column({ name: 'must_change_pwd', type: 'tinyint', width: 1, default: 0, comment: '是否必须改密' })
mustChangePwd: number;
@Column({ name: 'avatar', type: 'varchar', length: 255, default: '', comment: '头像文件名' })
avatar: string;
@Column({ name: 'status', type: 'tinyint', width: 1, default: 1, comment: '1=启用 0=停用' })
status: number;
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '创建时间' })
createdAt: Date;
@Column({ name: 'updated_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
updatedAt: Date;
}
/**
* 云端会话令牌(现网 cloud_tokens 表,主键 token)
*/
@Entity('cloud_tokens')
export class CloudTokenEntity {
@PrimaryColumn({ name: 'token', type: 'varchar', length: 64, comment: '云端会话令牌' })
token: string;
@Column({ name: 'account', type: 'varchar', length: 64, comment: '所属账号(工号)' })
account: string;
@Column({ name: 'nickname', type: 'varchar', length: 64, default: '', comment: '昵称快照' })
nickname: string;
@Index()
@Column({ name: 'expires_at', type: 'datetime', comment: '过期时间' })
expiresAt: Date;
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '签发时间' })
createdAt: Date;
}
/**
* 执行机敏感凭证(现网 client_creds 表,主键 account)
*/
@Entity('client_creds')
export class ClientCredEntity {
@PrimaryColumn({ name: 'account', type: 'varchar', length: 64, comment: '执行机账号(工号)' })
account: string;
@Column({ name: 'pubkey_pem', type: 'text', comment: 'RSA 公钥 PEM' })
pubkeyPem: string;
@Column({ name: 'creds', type: 'mediumtext', comment: '敏感凭证密文 JSON' })
creds: string;
@Column({ name: 'updated_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
updatedAt: Date;
}
/**
* 一次性下载票据(现网 download_tickets 表,主键 nonce)
*/
@Entity('download_tickets')
export class DownloadTicketEntity {
@PrimaryColumn({ name: 'nonce', type: 'varchar', length: 32, comment: '一次性下载票据' })
nonce: string;
@Column({ name: 'filename', type: 'varchar', length: 255, comment: '插件包文件名' })
filename: string;
@Column({ name: 'sha256', type: 'char', length: 64, default: '', comment: 'sha256 校验值' })
sha256: string;
@Column({ name: 'used', type: 'tinyint', width: 1, default: 0, comment: '是否已兑换' })
used: number;
@Index()
@Column({ name: 'created_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', comment: '签发时间' })
createdAt: Date;
}
/**
* 登录防爆破计数(现网 auth_fail_counts 表,主键 account)
*/
@Entity('auth_fail_counts')
export class AuthFailCountEntity {
@PrimaryColumn({ name: 'account', type: 'varchar', length: 64, comment: '登录账号(工号)' })
account: string;
@Column({ name: 'fails', type: 'int', unsigned: true, default: 0, comment: '连续失败次数' })
fails: number;
@Column({ name: 'locked_until', type: 'datetime', nullable: true, comment: '锁定截止时间' })
lockedUntil: Date;
@Column({ name: 'updated_at', type: 'datetime', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
updatedAt: Date;
}