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

62 lines
2.0 KiB
TypeScript

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';
@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;
@ApiHideProperty()
@ManyToMany(() => ContractEntity, contract => contract.files)
contracts: Relation<ContractEntity[]>;
@ApiHideProperty()
@ManyToMany(() => CompanyEntity, company => company.files)
companys: Relation<CompanyEntity[]>;
@ApiHideProperty()
@ManyToMany(() => MaterialsInOutEntity, materialsInOut => materialsInOut.files)
materialsInOut: Relation<MaterialsInOutEntity[]>;
@ApiHideProperty()
@ManyToMany(() => ProductEntity, product => product.files)
products: Relation<ProductEntity[]>;
}