mirror of
https://github.com/SyncrowIOT/backend.git
synced 2026-10-25 02:47:54 +00:00
added community space
This commit is contained in:
@@ -1,8 +1,16 @@
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
Unique,
|
||||
} from 'typeorm';
|
||||
import { SpaceDto, SpaceTypeDto } from '../dtos';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { UserSpaceEntity } from '../../user/entities';
|
||||
import { DeviceEntity } from '../../device/entities';
|
||||
import { CommunityEntity } from '../../community/entities';
|
||||
|
||||
@Entity({ name: 'space-type' })
|
||||
export class SpaceTypeEntity extends AbstractEntity<SpaceTypeDto> {
|
||||
@@ -45,6 +53,13 @@ export class SpaceEntity extends AbstractEntity<SpaceDto> {
|
||||
})
|
||||
public spaceName: string;
|
||||
|
||||
@ManyToOne(() => CommunityEntity, (community) => community.spaces, {
|
||||
nullable: false,
|
||||
onDelete: 'CASCADE',
|
||||
})
|
||||
@JoinColumn({ name: 'community_id' })
|
||||
community: CommunityEntity;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user