localhost_oa_based/src/modules/company/company.entity.ts

30 lines
984 B
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 { ApiHideProperty, ApiProperty } from '@nestjs/swagger';
import { Column, Entity, JoinTable, ManyToMany, Relation } from 'typeorm';
import { CommonEntity } from '~/common/entity/common.entity';
import { Storage } from '../tools/storage/storage.entity';
@Entity({ name: 'company' })
export class CompanyEntity extends CommonEntity {
@Column({
name: 'name',
type: 'varchar',
unique: true,
length: 255,
comment: '公司名称'
})
@ApiProperty({ description: '公司名称' })
name: string;
@Column({ name: 'is_delete', type: 'tinyint', default: 0, comment: '是否删除' })
@ApiProperty({ description: '删除状态0未删除1已删除' })
isDelete: number;
@ManyToMany(() => Storage, storage => storage.companys)
@JoinTable({
name: 'company_storage',
joinColumn: { name: 'company_id', referencedColumnName: 'id' },
inverseJoinColumn: { name: 'file_id', referencedColumnName: 'id' }
})
files: Relation<Storage[]>;
}