Added tuya space to community

This commit is contained in:
hannathkadher
2024-10-29 14:24:01 +04:00
parent 00ed2c5bbf
commit d6e6eb9b1f
8 changed files with 82 additions and 46 deletions

View File

@ -1,7 +1,6 @@
import { Column, Entity, ManyToOne, OneToMany, Unique } from 'typeorm';
import { Column, Entity, OneToMany, Unique } from 'typeorm';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { CommunityDto } from '../dtos';
import { RegionEntity } from '../../region/entities';
import { SpaceEntity } from '../../space/entities';
@Entity({ name: 'community' })
@ -23,12 +22,6 @@ export class CommunityEntity extends AbstractEntity<CommunityDto> {
@Column({ length: 255, nullable: true })
description: string;
@ManyToOne(() => RegionEntity, (region) => region.communities, {
nullable: false,
onDelete: 'CASCADE',
})
region: RegionEntity;
@OneToMany(() => SpaceEntity, (space) => space.community)
spaces: SpaceEntity[];

View File

@ -2,7 +2,6 @@ import { Column, Entity, OneToMany } from 'typeorm';
import { RegionDto } from '../dtos';
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
import { UserEntity } from '../../user/entities';
import { CommunityEntity } from '../../community/entities';
@Entity({ name: 'region' })
export class RegionEntity extends AbstractEntity<RegionDto> {
@ -14,9 +13,6 @@ export class RegionEntity extends AbstractEntity<RegionDto> {
@OneToMany(() => UserEntity, (user) => user.region)
users: UserEntity[];
@OneToMany(() => CommunityEntity, (community) => community.region)
communities: CommunityEntity[];
constructor(partial: Partial<RegionEntity>) {
super();
Object.assign(this, partial);