mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-16 02:36:19 +00:00
community user relation
This commit is contained in:
@ -1,8 +1,16 @@
|
||||
import { Column, Entity, ManyToOne, OneToMany, Unique } from 'typeorm';
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
ManyToMany,
|
||||
ManyToOne,
|
||||
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';
|
||||
import { UserEntity } from '../../user/entities';
|
||||
|
||||
@Entity({ name: 'community' })
|
||||
@Unique(['name'])
|
||||
@ -31,4 +39,7 @@ export class CommunityEntity extends AbstractEntity<CommunityDto> {
|
||||
|
||||
@OneToMany(() => SpaceEntity, (space) => space.community)
|
||||
spaces: SpaceEntity[];
|
||||
|
||||
@ManyToMany(() => UserEntity, (user) => user.communities)
|
||||
users: UserEntity[];
|
||||
}
|
||||
|
Reference in New Issue
Block a user