Merge branch 'dev' of https://github.com/SyncrowIOT/backend into feat/edit-space-model

This commit is contained in:
hannathkadher
2024-12-30 10:08:43 +04:00
14 changed files with 135 additions and 5 deletions

View File

@ -741,6 +741,10 @@ export class ControllerRoute {
public static readonly CREATE_USER_INVITATION_DESCRIPTION =
'This endpoint creates an invitation for a user to assign to role and spaces.';
public static readonly CHECK_EMAIL_SUMMARY = 'Check email';
public static readonly CHECK_EMAIL_DESCRIPTION =
'This endpoint checks if an email already exists and have a project in the system.';
};
};
static PERMISSION = class {

View File

@ -15,6 +15,7 @@ import { UserEntity } from '../../user/entities';
import { SpaceEntity } from '../../space/entities';
import { RoleType } from '@app/common/constants/role.type.enum';
import { InviteUserDto, InviteUserSpaceDto } from '../dtos';
import { ProjectEntity } from '../../project/entities';
@Entity({ name: 'invite-user' })
@Unique(['email', 'invitationCode'])
@ -91,6 +92,13 @@ export class InviteUserEntity extends AbstractEntity<InviteUserDto> {
(inviteUserSpace) => inviteUserSpace.inviteUser,
)
spaces: InviteUserSpaceEntity[];
@ManyToOne(() => ProjectEntity, (project) => project.invitedUsers, {
nullable: true,
})
@JoinColumn({ name: 'project_uuid' })
public project: ProjectEntity;
constructor(partial: Partial<InviteUserEntity>) {
super();
Object.assign(this, partial);

View File

@ -34,7 +34,7 @@ export class CommunityEntity extends AbstractEntity<CommunityDto> {
externalId: string;
@ManyToOne(() => ProjectEntity, (project) => project.communities, {
nullable: true,
nullable: false,
})
project: ProjectEntity;
}

View File

@ -4,6 +4,7 @@ import { ProjectDto } from '../dtos';
import { CommunityEntity } from '../../community/entities';
import { SpaceModelEntity } from '../../space-model';
import { UserEntity } from '../../user/entities';
import { InviteUserEntity } from '../../Invite-user/entities';
@Entity({ name: 'project' })
@Unique(['name'])
@ -32,6 +33,9 @@ export class ProjectEntity extends AbstractEntity<ProjectDto> {
@OneToMany(() => UserEntity, (user) => user.project)
public users: UserEntity[];
@OneToMany(() => InviteUserEntity, (inviteUser) => inviteUser.project)
public invitedUsers: InviteUserEntity[];
constructor(partial: Partial<ProjectEntity>) {
super();
Object.assign(this, partial);

View File

@ -117,7 +117,7 @@ export class UserEntity extends AbstractEntity<UserDto> {
public visitorPasswords: VisitorPasswordEntity[];
@ManyToOne(() => RoleTypeEntity, (roleType) => roleType.users, {
nullable: true,
nullable: false,
})
public roleType: RoleTypeEntity;
@OneToOne(() => InviteUserEntity, (inviteUser) => inviteUser.user, {