mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-07-15 10:25:23 +00:00
Add UserSpaceEntity relation to SpaceEntity and UserEntity
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { Column, Entity } from 'typeorm';
|
||||
import { Column, Entity, OneToMany } from 'typeorm';
|
||||
import { UserDto } from '../dtos';
|
||||
import { AbstractEntity } from '../../abstract/entities/abstract.entity';
|
||||
import { UserSpaceEntity } from '../../user-space/entities';
|
||||
|
||||
@Entity({ name: 'user' })
|
||||
export class UserEntity extends AbstractEntity<UserDto> {
|
||||
@ -36,6 +37,9 @@ export class UserEntity extends AbstractEntity<UserDto> {
|
||||
})
|
||||
public isUserVerified: boolean;
|
||||
|
||||
@OneToMany(() => UserSpaceEntity, (userSpace) => userSpace.user)
|
||||
userSpaces: UserSpaceEntity[];
|
||||
|
||||
constructor(partial: Partial<UserEntity>) {
|
||||
super();
|
||||
Object.assign(this, partial);
|
||||
|
Reference in New Issue
Block a user