mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-14 18:05:48 +00:00
35 lines
789 B
TypeScript
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;
|
|
}
|