localhost_oa_based/src/modules/tools/storage/storage.entity.ts

62 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-03-01 15:23:28 +08:00
import { ApiHideProperty, ApiProperty } from '@nestjs/swagger';
import { Column, Entity, ManyToMany, Relation } from 'typeorm';
2024-02-28 08:32:35 +08:00
2024-02-28 17:02:46 +08:00
import { CommonEntity } from '~/common/entity/common.entity';
2024-03-04 16:34:54 +08:00
import { CompanyEntity } from '~/modules/company/company.entity';
2024-03-01 15:23:28 +08:00
import { ContractEntity } from '~/modules/contract/contract.entity';
2024-03-04 17:31:28 +08:00
import { MaterialsInOutEntity } from '~/modules/materials_inventory/in_out/materials_in_out.entity';
2024-03-04 16:34:54 +08:00
import { MaterialsInventoryEntity } from '~/modules/materials_inventory/materials_inventory.entity';
2024-03-04 17:31:28 +08:00
import { ProductEntity } from '~/modules/product/product.entity';
2024-02-28 08:32:35 +08:00
@Entity({ name: 'tool_storage' })
export class Storage extends CommonEntity {
@Column({ type: 'varchar', length: 200, comment: '文件名' })
@ApiProperty({ description: '文件名' })
2024-02-28 17:02:46 +08:00
name: string;
2024-02-28 08:32:35 +08:00
@Column({
type: 'varchar',
length: 200,
nullable: true,
2024-02-29 09:29:03 +08:00
comment: '真实文件名'
2024-02-28 08:32:35 +08:00
})
@ApiProperty({ description: '真实文件名' })
2024-02-28 17:02:46 +08:00
fileName: string;
2024-02-28 08:32:35 +08:00
@Column({ name: 'ext_name', type: 'varchar', nullable: true })
@ApiProperty({ description: '扩展名' })
2024-02-28 17:02:46 +08:00
extName: string;
2024-02-28 08:32:35 +08:00
@Column({ type: 'varchar' })
@ApiProperty({ description: '文件类型' })
2024-02-28 17:02:46 +08:00
path: string;
2024-02-28 08:32:35 +08:00
@Column({ type: 'varchar', nullable: true })
@ApiProperty({ description: '文件类型' })
2024-02-28 17:02:46 +08:00
type: string;
2024-02-28 08:32:35 +08:00
@Column({ type: 'varchar', nullable: true })
@ApiProperty({ description: '文件大小' })
2024-02-28 17:02:46 +08:00
size: string;
2024-02-28 08:32:35 +08:00
@Column({ nullable: true, name: 'user_id' })
@ApiProperty({ description: '用户ID' })
2024-02-28 17:02:46 +08:00
userId: number;
2024-03-01 15:23:28 +08:00
@ApiHideProperty()
@ManyToMany(() => ContractEntity, contract => contract.files)
contracts: Relation<ContractEntity[]>;
2024-03-04 16:34:54 +08:00
@ApiHideProperty()
@ManyToMany(() => CompanyEntity, company => company.files)
companys: Relation<CompanyEntity[]>;
@ApiHideProperty()
2024-03-04 17:31:28 +08:00
@ManyToMany(() => MaterialsInOutEntity, materialsInOut => materialsInOut.files)
materialsInOut: Relation<MaterialsInOutEntity[]>;
@ApiHideProperty()
@ManyToMany(() => ProductEntity, product => product.files)
products: Relation<ProductEntity[]>;
2024-02-28 08:32:35 +08:00
}