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 { @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; }