From 9d2a225e1bd2933e8c96a973dc82b05d01524886 Mon Sep 17 00:00:00 2001 From: medtaher Date: Wed, 19 Feb 2025 09:53:43 +0100 Subject: [PATCH 1/2] feat: delete invitation on role delete --- api/src/user/repositories/role.repository.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/src/user/repositories/role.repository.ts b/api/src/user/repositories/role.repository.ts index 3d6c3668..c3e9fa56 100644 --- a/api/src/user/repositories/role.repository.ts +++ b/api/src/user/repositories/role.repository.ts @@ -14,6 +14,7 @@ import { Model } from 'mongoose'; import { BaseRepository, DeleteResult } from '@/utils/generics/base-repository'; import { RoleDto } from '../dto/role.dto'; +import { Invitation } from '../schemas/invitation.schema'; import { Permission } from '../schemas/permission.schema'; import { Role, @@ -34,6 +35,8 @@ export class RoleRepository extends BaseRepository< @InjectModel(Role.name) readonly model: Model, @InjectModel(Permission.name) private readonly permissionModel: Model, + @InjectModel(Invitation.name) + private readonly invitationModel: Model, ) { super(eventEmitter, model, Role, ROLE_POPULATE, RoleFull); } @@ -49,6 +52,7 @@ export class RoleRepository extends BaseRepository< const result = await this.model.deleteOne({ _id: id }).exec(); if (result.deletedCount > 0) { await this.permissionModel.deleteMany({ role: id }); + await this.invitationModel.deleteMany({ roles: id }); } return result; } From 1707366d98cd7fb2d349dc797d7589522c9b81d0 Mon Sep 17 00:00:00 2001 From: medtaher Date: Wed, 19 Feb 2025 18:23:57 +0100 Subject: [PATCH 2/2] feat: delete invitation on role delete --- api/src/chat/controllers/block.controller.spec.ts | 4 ++++ api/src/chat/controllers/label.controller.spec.ts | 4 ++++ api/src/chat/controllers/message.controller.spec.ts | 4 ++++ .../chat/controllers/subscriber.controller.spec.ts | 4 ++++ api/src/chat/services/message.service.spec.ts | 4 ++++ api/src/chat/services/subscriber.service.spec.ts | 4 ++++ api/src/user/controllers/model.controller.spec.ts | 4 ++++ .../user/controllers/permission.controller.spec.ts | 10 +++++++++- api/src/user/controllers/role.controller.spec.ts | 4 ++++ .../user/repositories/permission.repository.spec.ts | 11 ++++++++++- api/src/user/repositories/role.repository.spec.ts | 10 +++++++++- api/src/user/repositories/user.repository.spec.ts | 5 +++++ api/src/user/services/auth.service.spec.ts | 4 ++++ api/src/user/services/passwordReset.service.spec.ts | 4 ++++ api/src/user/services/permission.service.spec.ts | 10 +++++++++- api/src/user/services/role.service.spec.ts | 10 +++++++++- api/src/user/services/user.service.spec.ts | 4 ++++ .../user/services/validate-account.service.spec.ts | 4 ++++ 18 files changed, 99 insertions(+), 5 deletions(-) diff --git a/api/src/chat/controllers/block.controller.spec.ts b/api/src/chat/controllers/block.controller.spec.ts index 6680c9fb..622c1547 100644 --- a/api/src/chat/controllers/block.controller.spec.ts +++ b/api/src/chat/controllers/block.controller.spec.ts @@ -25,9 +25,11 @@ import { LanguageService } from '@/i18n/services/language.service'; import { LoggerService } from '@/logger/logger.service'; import { PluginService } from '@/plugins/plugins.service'; import { SettingService } from '@/setting/services/setting.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { PermissionRepository } from '@/user/repositories/permission.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { UserModel } from '@/user/schemas/user.schema'; @@ -86,6 +88,7 @@ describe('BlockController', () => { LabelModel, CategoryModel, ContentModel, + InvitationModel, AttachmentModel, UserModel, RoleModel, @@ -102,6 +105,7 @@ describe('BlockController', () => { UserRepository, RoleRepository, PermissionRepository, + InvitationRepository, LanguageRepository, BlockService, LabelService, diff --git a/api/src/chat/controllers/label.controller.spec.ts b/api/src/chat/controllers/label.controller.spec.ts index 0c5fae41..5cf336fb 100644 --- a/api/src/chat/controllers/label.controller.spec.ts +++ b/api/src/chat/controllers/label.controller.spec.ts @@ -15,8 +15,10 @@ import { AttachmentRepository } from '@/attachment/repositories/attachment.repos import { AttachmentModel } from '@/attachment/schemas/attachment.schema'; import { AttachmentService } from '@/attachment/services/attachment.service'; import { LoggerService } from '@/logger/logger.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { UserModel } from '@/user/schemas/user.schema'; @@ -61,6 +63,7 @@ describe('LabelController', () => { RoleModel, PermissionModel, SubscriberModel, + InvitationModel, AttachmentModel, ]), ], @@ -73,6 +76,7 @@ describe('LabelController', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, SubscriberService, SubscriberRepository, EventEmitter2, diff --git a/api/src/chat/controllers/message.controller.spec.ts b/api/src/chat/controllers/message.controller.spec.ts index d2e9c2d3..fb506d9d 100644 --- a/api/src/chat/controllers/message.controller.spec.ts +++ b/api/src/chat/controllers/message.controller.spec.ts @@ -22,8 +22,10 @@ import { I18nService } from '@/i18n/services/i18n.service'; import { LoggerService } from '@/logger/logger.service'; import { NlpService } from '@/nlp/services/nlp.service'; import { SettingService } from '@/setting/services/setting.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { User, UserModel } from '@/user/schemas/user.schema'; @@ -71,6 +73,7 @@ describe('MessageController', () => { MessageModel, UserModel, RoleModel, + InvitationModel, PermissionModel, AttachmentModel, MenuModel, @@ -85,6 +88,7 @@ describe('MessageController', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, SubscriberRepository, ChannelService, AttachmentService, diff --git a/api/src/chat/controllers/subscriber.controller.spec.ts b/api/src/chat/controllers/subscriber.controller.spec.ts index 6e280f99..17d1020a 100644 --- a/api/src/chat/controllers/subscriber.controller.spec.ts +++ b/api/src/chat/controllers/subscriber.controller.spec.ts @@ -14,8 +14,10 @@ import { AttachmentRepository } from '@/attachment/repositories/attachment.repos import { AttachmentModel } from '@/attachment/schemas/attachment.schema'; import { AttachmentService } from '@/attachment/services/attachment.service'; import { LoggerService } from '@/logger/logger.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { User, UserModel } from '@/user/schemas/user.schema'; @@ -63,6 +65,7 @@ describe('SubscriberController', () => { LabelModel, UserModel, RoleModel, + InvitationModel, PermissionModel, AttachmentModel, ]), @@ -79,6 +82,7 @@ describe('SubscriberController', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, EventEmitter2, AttachmentService, AttachmentRepository, diff --git a/api/src/chat/services/message.service.spec.ts b/api/src/chat/services/message.service.spec.ts index 1e7899b8..fc48b8d1 100644 --- a/api/src/chat/services/message.service.spec.ts +++ b/api/src/chat/services/message.service.spec.ts @@ -14,8 +14,10 @@ import { AttachmentRepository } from '@/attachment/repositories/attachment.repos import { AttachmentModel } from '@/attachment/schemas/attachment.schema'; import { AttachmentService } from '@/attachment/services/attachment.service'; import { LoggerService } from '@/logger/logger.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { User, UserModel } from '@/user/schemas/user.schema'; @@ -62,6 +64,7 @@ describe('MessageService', () => { UserModel, RoleModel, PermissionModel, + InvitationModel, SubscriberModel, MessageModel, AttachmentModel, @@ -75,6 +78,7 @@ describe('MessageService', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, SubscriberService, SubscriberRepository, MessageService, diff --git a/api/src/chat/services/subscriber.service.spec.ts b/api/src/chat/services/subscriber.service.spec.ts index 9eec453c..69e38946 100644 --- a/api/src/chat/services/subscriber.service.spec.ts +++ b/api/src/chat/services/subscriber.service.spec.ts @@ -14,8 +14,10 @@ import { AttachmentRepository } from '@/attachment/repositories/attachment.repos import { AttachmentModel } from '@/attachment/schemas/attachment.schema'; import { AttachmentService } from '@/attachment/services/attachment.service'; import { LoggerService } from '@/logger/logger.service'; +import { InvitationRepository } from '@/user/repositories/invitation.repository'; import { RoleRepository } from '@/user/repositories/role.repository'; import { UserRepository } from '@/user/repositories/user.repository'; +import { InvitationModel } from '@/user/schemas/invitation.schema'; import { PermissionModel } from '@/user/schemas/permission.schema'; import { RoleModel } from '@/user/schemas/role.schema'; import { User, UserModel } from '@/user/schemas/user.schema'; @@ -55,6 +57,7 @@ describe('SubscriberService', () => { LabelModel, UserModel, RoleModel, + InvitationModel, PermissionModel, AttachmentModel, ]), @@ -68,6 +71,7 @@ describe('SubscriberService', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, LoggerService, EventEmitter2, AttachmentService, diff --git a/api/src/user/controllers/model.controller.spec.ts b/api/src/user/controllers/model.controller.spec.ts index dc221350..840adbcb 100644 --- a/api/src/user/controllers/model.controller.spec.ts +++ b/api/src/user/controllers/model.controller.spec.ts @@ -24,10 +24,12 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { ModelRepository } from '../repositories/model.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { ModelFull, ModelModel } from '../schemas/model.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { RoleModel } from '../schemas/role.schema'; @@ -53,6 +55,7 @@ describe('ModelController', () => { UserModel, RoleModel, PermissionModel, + InvitationModel, ModelModel, AttachmentModel, ]), @@ -68,6 +71,7 @@ describe('ModelController', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, { diff --git a/api/src/user/controllers/permission.controller.spec.ts b/api/src/user/controllers/permission.controller.spec.ts index d127c78f..4fcf1916 100644 --- a/api/src/user/controllers/permission.controller.spec.ts +++ b/api/src/user/controllers/permission.controller.spec.ts @@ -20,9 +20,11 @@ import { } from '@/utils/test/test'; import { PermissionCreateDto } from '../dto/permission.dto'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { ModelRepository } from '../repositories/model.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { Model, ModelModel } from '../schemas/model.schema'; import { Permission, @@ -53,7 +55,12 @@ describe('PermissionController', () => { controllers: [PermissionController], imports: [ rootMongooseTestModule(installPermissionFixtures), - MongooseModule.forFeature([PermissionModel, ModelModel, RoleModel]), + MongooseModule.forFeature([ + PermissionModel, + ModelModel, + RoleModel, + InvitationModel, + ]), ], providers: [ LoggerService, @@ -62,6 +69,7 @@ describe('PermissionController', () => { PermissionService, PermissionRepository, RoleRepository, + InvitationRepository, ModelRepository, EventEmitter2, { diff --git a/api/src/user/controllers/role.controller.spec.ts b/api/src/user/controllers/role.controller.spec.ts index 62073080..ae444686 100644 --- a/api/src/user/controllers/role.controller.spec.ts +++ b/api/src/user/controllers/role.controller.spec.ts @@ -26,9 +26,11 @@ import { } from '@/utils/test/test'; import { RoleCreateDto, RoleUpdateDto } from '../dto/role.dto'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { Role, RoleFull, RoleModel } from '../schemas/role.schema'; import { UserModel } from '../schemas/user.schema'; @@ -55,6 +57,7 @@ describe('RoleController', () => { RoleModel, PermissionModel, UserModel, + InvitationModel, AttachmentModel, ]), ], @@ -65,6 +68,7 @@ describe('RoleController', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, AttachmentService, diff --git a/api/src/user/repositories/permission.repository.spec.ts b/api/src/user/repositories/permission.repository.spec.ts index 6f25fc64..12da8738 100644 --- a/api/src/user/repositories/permission.repository.spec.ts +++ b/api/src/user/repositories/permission.repository.spec.ts @@ -23,6 +23,7 @@ import { import { ModelRepository } from '../repositories/model.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { ModelModel, Model as ModelSchema } from '../schemas/model.schema'; import { Permission, @@ -32,6 +33,8 @@ import { import { Role, RoleModel } from '../schemas/role.schema'; import { Action } from '../types/action.type'; +import { InvitationRepository } from './invitation.repository'; + describe('PermissionRepository', () => { let modelRepository: ModelRepository; let roleRepository: RoleRepository; @@ -44,12 +47,18 @@ describe('PermissionRepository', () => { const module: TestingModule = await Test.createTestingModule({ imports: [ rootMongooseTestModule(installPermissionFixtures), - MongooseModule.forFeature([ModelModel, PermissionModel, RoleModel]), + MongooseModule.forFeature([ + ModelModel, + PermissionModel, + RoleModel, + InvitationModel, + ]), ], providers: [ ModelRepository, RoleRepository, PermissionRepository, + InvitationRepository, EventEmitter2, ], }).compile(); diff --git a/api/src/user/repositories/role.repository.spec.ts b/api/src/user/repositories/role.repository.spec.ts index d3338eab..50728b48 100644 --- a/api/src/user/repositories/role.repository.spec.ts +++ b/api/src/user/repositories/role.repository.spec.ts @@ -21,11 +21,13 @@ import { import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { Role, RoleFull, RoleModel } from '../schemas/role.schema'; import { User, UserModel } from '../schemas/user.schema'; import { roleFixtures } from './../../utils/test/fixtures/role'; +import { InvitationRepository } from './invitation.repository'; describe('RoleRepository', () => { let roleRepository: RoleRepository; @@ -40,11 +42,17 @@ describe('RoleRepository', () => { const module: TestingModule = await Test.createTestingModule({ imports: [ rootMongooseTestModule(installPermissionFixtures), - MongooseModule.forFeature([UserModel, PermissionModel, RoleModel]), + MongooseModule.forFeature([ + UserModel, + PermissionModel, + RoleModel, + InvitationModel, + ]), ], providers: [ UserRepository, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, ], diff --git a/api/src/user/repositories/user.repository.spec.ts b/api/src/user/repositories/user.repository.spec.ts index 80a42de5..139a1a16 100644 --- a/api/src/user/repositories/user.repository.spec.ts +++ b/api/src/user/repositories/user.repository.spec.ts @@ -26,10 +26,13 @@ import { import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { Role, RoleModel } from '../schemas/role.schema'; import { User, UserFull, UserModel } from '../schemas/user.schema'; +import { InvitationRepository } from './invitation.repository'; + describe('UserRepository', () => { let roleRepository: RoleRepository; let userRepository: UserRepository; @@ -57,6 +60,7 @@ describe('UserRepository', () => { UserModel, PermissionModel, RoleModel, + InvitationModel, AttachmentModel, ]), ], @@ -64,6 +68,7 @@ describe('UserRepository', () => { LoggerService, UserRepository, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, { diff --git a/api/src/user/services/auth.service.spec.ts b/api/src/user/services/auth.service.spec.ts index a66fa8c9..b3f0dd59 100644 --- a/api/src/user/services/auth.service.spec.ts +++ b/api/src/user/services/auth.service.spec.ts @@ -21,8 +21,10 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { RoleModel } from '../schemas/role.schema'; import { UserModel } from '../schemas/user.schema'; @@ -43,6 +45,7 @@ describe('AuthService', () => { UserModel, RoleModel, PermissionModel, + InvitationModel, AttachmentModel, ]), ], @@ -53,6 +56,7 @@ describe('AuthService', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, JwtService, EventEmitter2, AttachmentService, diff --git a/api/src/user/services/passwordReset.service.spec.ts b/api/src/user/services/passwordReset.service.spec.ts index 136e52f8..c5f18c6b 100644 --- a/api/src/user/services/passwordReset.service.spec.ts +++ b/api/src/user/services/passwordReset.service.spec.ts @@ -32,8 +32,10 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { RoleModel } from '../schemas/role.schema'; import { User, UserModel } from '../schemas/user.schema'; @@ -60,6 +62,7 @@ describe('PasswordResetService', () => { PermissionModel, AttachmentModel, LanguageModel, + InvitationModel, ]), JwtModule, ], @@ -70,6 +73,7 @@ describe('PasswordResetService', () => { AttachmentService, AttachmentRepository, RoleRepository, + InvitationRepository, LanguageService, LanguageRepository, LoggerService, diff --git a/api/src/user/services/permission.service.spec.ts b/api/src/user/services/permission.service.spec.ts index 9b2947d3..1547acc1 100644 --- a/api/src/user/services/permission.service.spec.ts +++ b/api/src/user/services/permission.service.spec.ts @@ -21,9 +21,11 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { ModelRepository } from '../repositories/model.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { ModelModel, Model as ModelSchema } from '../schemas/model.schema'; import { Permission, @@ -46,12 +48,18 @@ describe('PermissionService', () => { const module: TestingModule = await Test.createTestingModule({ imports: [ rootMongooseTestModule(installPermissionFixtures), - MongooseModule.forFeature([ModelModel, PermissionModel, RoleModel]), + MongooseModule.forFeature([ + ModelModel, + PermissionModel, + RoleModel, + InvitationModel, + ]), ], providers: [ ModelRepository, PermissionService, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, { diff --git a/api/src/user/services/role.service.spec.ts b/api/src/user/services/role.service.spec.ts index f16f96fc..de6533a7 100644 --- a/api/src/user/services/role.service.spec.ts +++ b/api/src/user/services/role.service.spec.ts @@ -17,9 +17,11 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { Permission, PermissionModel } from '../schemas/permission.schema'; import { Role, RoleFull, RoleModel } from '../schemas/role.schema'; import { User, UserModel } from '../schemas/user.schema'; @@ -40,12 +42,18 @@ describe('RoleService', () => { const module: TestingModule = await Test.createTestingModule({ imports: [ rootMongooseTestModule(installPermissionFixtures), - MongooseModule.forFeature([UserModel, PermissionModel, RoleModel]), + MongooseModule.forFeature([ + UserModel, + PermissionModel, + RoleModel, + InvitationModel, + ]), ], providers: [ UserRepository, RoleService, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, ], diff --git a/api/src/user/services/user.service.spec.ts b/api/src/user/services/user.service.spec.ts index 7a122183..7b357984 100644 --- a/api/src/user/services/user.service.spec.ts +++ b/api/src/user/services/user.service.spec.ts @@ -24,9 +24,11 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { PermissionRepository } from '../repositories/permission.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { Role, RoleModel } from '../schemas/role.schema'; import { User, UserFull, UserModel } from '../schemas/user.schema'; @@ -61,6 +63,7 @@ describe('UserService', () => { UserModel, PermissionModel, RoleModel, + InvitationModel, AttachmentModel, ]), ], @@ -73,6 +76,7 @@ describe('UserService', () => { PermissionService, RoleService, RoleRepository, + InvitationRepository, PermissionRepository, EventEmitter2, { diff --git a/api/src/user/services/validate-account.service.spec.ts b/api/src/user/services/validate-account.service.spec.ts index ac3b2ae9..84bad094 100644 --- a/api/src/user/services/validate-account.service.spec.ts +++ b/api/src/user/services/validate-account.service.spec.ts @@ -29,8 +29,10 @@ import { rootMongooseTestModule, } from '@/utils/test/test'; +import { InvitationRepository } from '../repositories/invitation.repository'; import { RoleRepository } from '../repositories/role.repository'; import { UserRepository } from '../repositories/user.repository'; +import { InvitationModel } from '../schemas/invitation.schema'; import { PermissionModel } from '../schemas/permission.schema'; import { RoleModel } from '../schemas/role.schema'; import { UserModel } from '../schemas/user.schema'; @@ -53,6 +55,7 @@ describe('ValidateAccountService', () => { UserModel, RoleModel, PermissionModel, + InvitationModel, AttachmentModel, LanguageModel, ]), @@ -65,6 +68,7 @@ describe('ValidateAccountService', () => { UserRepository, RoleService, RoleRepository, + InvitationRepository, LanguageService, LanguageRepository, LoggerService,