Files
backend/libs/common/src/modules/community/entities/community.entity.ts
2024-10-29 14:24:01 +04:00

35 lines
789 B
TypeScript

import { Column, Entity, OneToMany, Unique } from 'typeorm';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { CommunityDto } from '../dtos';
import { SpaceEntity } from '../../space/entities';
@Entity({ name: 'community' })
@Unique(['name'])
export class CommunityEntity extends AbstractEntity<CommunityDto> {
@Column({
type: 'uuid',
default: () => 'gen_random_uuid()',
nullable: false,
})
public uuid: string;
@Column({
length: 255,
nullable: false,
})
name: string;
@Column({ length: 255, nullable: true })
description: string;
@OneToMany(() => SpaceEntity, (space) => space.community)
spaces: SpaceEntity[];
@Column({
type: 'varchar',
length: 255,
nullable: true,
})
externalId: string;
}