主要变更: 1. 代码风格统一 - 统一使用双引号替代单引号 - 保持项目代码风格一致性 - 涵盖所有模块、配置、实体和服务文件 2. 项目文档 - 新增 SECURITY_FIXES_SUMMARY.md - 安全修复总结文档 - 新增 项目问题评估报告.md - 项目问题评估文档 3. 包含修改的文件类别 - 配置文件:app, database, jwt, redis, cache, performance - 实体文件:所有 TypeORM 实体 - 模块文件:所有业务模块 - 公共模块:guards, decorators, interceptors, filters, utils - 测试文件:单元测试和 E2E 测试 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
61 lines
1.3 KiB
TypeScript
61 lines
1.3 KiB
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
CreateDateColumn,
|
|
UpdateDateColumn,
|
|
ManyToOne,
|
|
JoinColumn,
|
|
OneToMany,
|
|
} from "typeorm";
|
|
import { AssetType, AssetStatus } from "../common/enums";
|
|
import { Group } from "./group.entity";
|
|
import { AssetLog } from "./asset-log.entity";
|
|
|
|
@Entity("assets")
|
|
export class Asset {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
@Column()
|
|
groupId: string;
|
|
|
|
@ManyToOne(() => Group, { onDelete: "CASCADE" })
|
|
@JoinColumn({ name: "groupId" })
|
|
group: Group;
|
|
|
|
@Column({ type: "enum", enum: AssetType })
|
|
type: AssetType;
|
|
|
|
@Column({ length: 100 })
|
|
name: string;
|
|
|
|
@Column({ type: "text", nullable: true, comment: "描述" })
|
|
description: string;
|
|
|
|
@Column({ type: "text", nullable: true, comment: "加密的账号凭据" })
|
|
accountCredentials?: string | null;
|
|
|
|
@Column({ default: 1, comment: "数量(用于物品)" })
|
|
quantity: number;
|
|
|
|
@Column({
|
|
type: "enum",
|
|
enum: AssetStatus,
|
|
default: AssetStatus.AVAILABLE,
|
|
})
|
|
status: AssetStatus;
|
|
|
|
@Column({ type: "varchar", nullable: true, comment: "当前借用人ID" })
|
|
currentBorrowerId?: string | null;
|
|
|
|
@CreateDateColumn()
|
|
createdAt: Date;
|
|
|
|
@UpdateDateColumn()
|
|
updatedAt: Date;
|
|
|
|
@OneToMany(() => AssetLog, (log) => log.asset)
|
|
logs: AssetLog[];
|
|
}
|