import { ApiHideProperty, ApiProperty } from '@nestjs/swagger'; import { Column, Entity, ManyToMany, Relation } from 'typeorm'; import { CommonEntity } from '~/common/entity/common.entity'; import { CompanyEntity } from '~/modules/company/company.entity'; import { ContractEntity } from '~/modules/contract/contract.entity'; import { MaterialsInOutEntity } from '~/modules/materials_inventory/in_out/materials_in_out.entity'; import { MaterialsInventoryEntity } from '~/modules/materials_inventory/materials_inventory.entity'; import { ProductEntity } from '~/modules/product/product.entity'; import { ProjectEntity } from '~/modules/project/project.entity'; import { VehicleUsageEntity } from '~/modules/vehicle_usage/vehicle_usage.entity'; @Entity({ name: 'tool_storage' }) export class Storage extends CommonEntity { @Column({ type: 'varchar', length: 200, comment: '文件名' }) @ApiProperty({ description: '文件名' }) name: string; @Column({ type: 'varchar', length: 200, nullable: true, comment: '真实文件名' }) @ApiProperty({ description: '真实文件名' }) fileName: string; @Column({ name: 'ext_name', type: 'varchar', nullable: true }) @ApiProperty({ description: '扩展名' }) extName: string; @Column({ type: 'varchar' }) @ApiProperty({ description: '文件类型' }) path: string; @Column({ type: 'varchar', nullable: true }) @ApiProperty({ description: '文件类型' }) type: string; @Column({ type: 'varchar', nullable: true }) @ApiProperty({ description: '文件大小' }) size: string; @Column({ nullable: true, name: 'user_id' }) @ApiProperty({ description: '用户ID' }) userId: number; @Column({ nullable: true, name: 'bussiness_module' }) @ApiProperty({ description: '文件上传的业务模块' }) bussinessModule: string; @Column({ nullable: true, name: 'bussiness_record_id' }) @ApiProperty({ description: '文件上传的业务记录ID' }) bussinessRecordId: number; @ApiHideProperty() @ManyToMany(() => ContractEntity, contract => contract.files) contracts: Relation; @ApiHideProperty() @ManyToMany(() => CompanyEntity, company => company.files) companys: Relation; @ApiHideProperty() @ManyToMany(() => MaterialsInOutEntity, materialsInOut => materialsInOut.files) materialsInOuts: Relation; @ApiHideProperty() @ManyToMany(() => ProductEntity, product => product.files) products: Relation; @ApiHideProperty() @ManyToMany(() => ProjectEntity, project => project.files) projects: Relation; @ApiHideProperty() @ManyToMany(() => VehicleUsageEntity, vu => vu.files) vehicleUsage: Relation; }