mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 19:24:54 +00:00
Add project relationship to InviteUserEntity and invitedUsers to ProjectEntity
This commit is contained in:
@ -15,6 +15,7 @@ import { UserEntity } from '../../user/entities';
|
|||||||
import { SpaceEntity } from '../../space/entities';
|
import { SpaceEntity } from '../../space/entities';
|
||||||
import { RoleType } from '@app/common/constants/role.type.enum';
|
import { RoleType } from '@app/common/constants/role.type.enum';
|
||||||
import { InviteUserDto, InviteUserSpaceDto } from '../dtos';
|
import { InviteUserDto, InviteUserSpaceDto } from '../dtos';
|
||||||
|
import { ProjectEntity } from '../../project/entities';
|
||||||
|
|
||||||
@Entity({ name: 'invite-user' })
|
@Entity({ name: 'invite-user' })
|
||||||
@Unique(['email', 'invitationCode'])
|
@Unique(['email', 'invitationCode'])
|
||||||
@ -91,6 +92,13 @@ export class InviteUserEntity extends AbstractEntity<InviteUserDto> {
|
|||||||
(inviteUserSpace) => inviteUserSpace.inviteUser,
|
(inviteUserSpace) => inviteUserSpace.inviteUser,
|
||||||
)
|
)
|
||||||
spaces: InviteUserSpaceEntity[];
|
spaces: InviteUserSpaceEntity[];
|
||||||
|
|
||||||
|
@ManyToOne(() => ProjectEntity, (project) => project.invitedUsers, {
|
||||||
|
nullable: true,
|
||||||
|
})
|
||||||
|
@JoinColumn({ name: 'project_uuid' })
|
||||||
|
public project: ProjectEntity;
|
||||||
|
|
||||||
constructor(partial: Partial<InviteUserEntity>) {
|
constructor(partial: Partial<InviteUserEntity>) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { ProjectDto } from '../dtos';
|
|||||||
import { CommunityEntity } from '../../community/entities';
|
import { CommunityEntity } from '../../community/entities';
|
||||||
import { SpaceModelEntity } from '../../space-model';
|
import { SpaceModelEntity } from '../../space-model';
|
||||||
import { UserEntity } from '../../user/entities';
|
import { UserEntity } from '../../user/entities';
|
||||||
|
import { InviteUserEntity } from '../../Invite-user/entities';
|
||||||
|
|
||||||
@Entity({ name: 'project' })
|
@Entity({ name: 'project' })
|
||||||
@Unique(['name'])
|
@Unique(['name'])
|
||||||
@ -32,6 +33,9 @@ export class ProjectEntity extends AbstractEntity<ProjectDto> {
|
|||||||
@OneToMany(() => UserEntity, (user) => user.project)
|
@OneToMany(() => UserEntity, (user) => user.project)
|
||||||
public users: UserEntity[];
|
public users: UserEntity[];
|
||||||
|
|
||||||
|
@OneToMany(() => InviteUserEntity, (inviteUser) => inviteUser.project)
|
||||||
|
public invitedUsers: InviteUserEntity[];
|
||||||
|
|
||||||
constructor(partial: Partial<ProjectEntity>) {
|
constructor(partial: Partial<ProjectEntity>) {
|
||||||
super();
|
super();
|
||||||
Object.assign(this, partial);
|
Object.assign(this, partial);
|
||||||
|
|||||||
Reference in New Issue
Block a user