From c90c1961a867dc7c91b1d113ea188fbfe9ae95d0 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 10:41:55 +0200 Subject: [PATCH 01/29] Rename SchoolService --- .../src/modules/oauth/service/oauth.service.spec.ts | 10 +++++----- apps/server/src/modules/oauth/service/oauth.service.ts | 4 ++-- apps/server/src/modules/oauth/uc/oauth.uc.spec.ts | 6 +++--- apps/server/src/modules/oauth/uc/oauth.uc.ts | 4 ++-- .../provisioning/strategy/iserv/iserv.strategy.spec.ts | 10 +++++----- .../provisioning/strategy/iserv/iserv.strategy.ts | 4 ++-- .../oidc/service/oidc-provisioning.service.spec.ts | 10 +++++----- .../strategy/oidc/service/oidc-provisioning.service.ts | 4 ++-- apps/server/src/modules/school/school.module.ts | 6 +++--- .../src/modules/school/service/school.service.spec.ts | 10 +++++----- .../src/modules/school/service/school.service.ts | 2 +- apps/server/src/modules/school/uc/school.uc.spec.ts | 10 +++++----- apps/server/src/modules/school/uc/school.uc.ts | 4 ++-- .../modules/tool/common/uc/tool-permission-helper.ts | 4 ++-- .../tool/common/uc/tool-permissions-helper.spec.ts | 10 +++++----- .../service/strategy/abstract-launch.strategy.spec.ts | 10 +++++----- .../service/strategy/abstract-launch.strategy.ts | 4 ++-- .../strategy/basic-tool-launch.strategy.spec.ts | 6 +++--- .../strategy/lti11-tool-launch.strategy.spec.ts | 6 +++--- .../service/strategy/lti11-tool-launch.strategy.ts | 4 ++-- .../strategy/oauth2-tool-launch.strategy.spec.ts | 6 +++--- .../controller/import-user.controller.spec.ts | 4 ++-- .../src/modules/user-import/uc/user-import.uc.spec.ts | 10 +++++----- .../src/modules/user-import/uc/user-import.uc.ts | 4 ++-- .../service/migration-check.service.spec.ts | 10 +++++----- .../service/migration-check.service.ts | 4 ++-- .../service/school-migration.service.spec.ts | 10 +++++----- .../service/school-migration.service.ts | 4 ++-- .../user-login-migration-revert.service.spec.ts | 10 +++++----- .../service/user-login-migration-revert.service.ts | 4 ++-- .../service/user-login-migration.service.spec.ts | 10 +++++----- .../service/user-login-migration.service.ts | 4 ++-- .../service/user-migration.service.spec.ts | 10 +++++----- .../service/user-migration.service.ts | 4 ++-- .../uc/restart-user-login-migration.uc.spec.ts | 10 +++++----- .../uc/restart-user-login-migration.uc.ts | 4 ++-- .../uc/start-user-login-migration.uc.spec.ts | 10 +++++----- .../uc/start-user-login-migration.uc.ts | 4 ++-- .../uc/toggle-user-login-migration.uc.spec.ts | 10 +++++----- .../uc/toggle-user-login-migration.uc.ts | 4 ++-- .../uc/user-login-migration.uc.spec.ts | 6 +++--- .../service/video-conference.service.spec.ts | 10 +++++----- .../service/video-conference.service.ts | 4 ++-- .../uc/video-conference-deprecated.uc.spec.ts | 10 +++++----- .../uc/video-conference-deprecated.uc.ts | 4 ++-- 45 files changed, 149 insertions(+), 149 deletions(-) diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index c092987b153..5da1c3a21a0 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -12,7 +12,7 @@ import { systemFactory } from '@shared/testing/factory/system.factory'; import { LegacyLogger } from '@src/core/logger'; import { ProvisioningDto, ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { OauthConfigDto } from '@src/modules/system/service'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; import { SystemService } from '@src/modules/system/service/system.service'; @@ -51,7 +51,7 @@ describe('OAuthService', () => { let userMigrationService: DeepMocked; let oauthAdapterService: DeepMocked; let migrationCheckService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let testSystem: System; let testOauthConfig: OauthConfig; @@ -69,8 +69,8 @@ describe('OAuthService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: DefaultEncryptionService, @@ -111,7 +111,7 @@ describe('OAuthService', () => { userMigrationService = module.get(UserMigrationService); oauthAdapterService = module.get(OauthAdapterService); migrationCheckService = module.get(MigrationCheckService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); }); afterAll(async () => { diff --git a/apps/server/src/modules/oauth/service/oauth.service.ts b/apps/server/src/modules/oauth/service/oauth.service.ts index bb989486986..2dcb5eaa0aa 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.ts @@ -8,7 +8,7 @@ import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encr import { LegacyLogger } from '@src/core/logger'; import { ProvisioningService } from '@src/modules/provisioning'; import { OauthDataDto } from '@src/modules/provisioning/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; @@ -31,7 +31,7 @@ export class OAuthService { private readonly systemService: SystemService, private readonly userMigrationService: UserMigrationService, private readonly migrationCheckService: MigrationCheckService, - private readonly schoolService: SchoolService + private readonly schoolService: LegacySchoolService ) { this.logger.setContext(OAuthService.name); } diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index 80025f40ed3..df5676e7ad6 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -13,7 +13,7 @@ import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { OauthUc } from '@src/modules/oauth/uc/oauth.uc'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto, SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; @@ -77,8 +77,8 @@ describe('OAuthUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: UserMigrationService, diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.ts b/apps/server/src/modules/oauth/uc/oauth.uc.ts index 9f805ea5209..271c8220904 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.ts @@ -8,7 +8,7 @@ import { ICurrentUser } from '@src/modules/authentication'; import { AuthenticationService } from '@src/modules/authentication/services/authentication.service'; import { ProvisioningService } from '@src/modules/provisioning'; import { OauthDataDto } from '@src/modules/provisioning/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; import { UserService } from '@src/modules/user'; @@ -32,7 +32,7 @@ export class OauthUc { private readonly authenticationService: AuthenticationService, private readonly systemService: SystemService, private readonly provisioningService: ProvisioningService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly userService: UserService, private readonly userMigrationService: UserMigrationService, private readonly schoolMigrationService: SchoolMigrationService, diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index e39e489dd56..a81a16e6b66 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -8,7 +8,7 @@ import { SystemProvisioningStrategy } from '@shared/domain/interface/system-prov import { schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import jwt from 'jsonwebtoken'; import { RoleDto } from '../../../role/service/dto/role.dto'; @@ -28,7 +28,7 @@ describe('IservProvisioningStrategy', () => { let module: TestingModule; let strategy: IservProvisioningStrategy; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let userService: DeepMocked; beforeAll(async () => { @@ -41,14 +41,14 @@ describe('IservProvisioningStrategy', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, ], }).compile(); strategy = module.get(IservProvisioningStrategy); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); userService = module.get(UserService); }); diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts index 647d03fb92a..1d83c4dbe81 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts @@ -5,7 +5,7 @@ import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import jwt, { JwtPayload } from 'jsonwebtoken'; import { @@ -20,7 +20,7 @@ import { IservMapper } from './iserv-do.mapper'; @Injectable() export class IservProvisioningStrategy extends ProvisioningStrategy { - constructor(private readonly schoolService: SchoolService, private readonly userService: UserService) { + constructor(private readonly schoolService: LegacySchoolService, private readonly userService: UserService) { super(); } diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index 0c452f8b27d..d65b82128d4 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -10,7 +10,7 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, SchoolService, SchoolYearService } from '@src/modules/school'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; @@ -23,7 +23,7 @@ describe('OidcProvisioningService', () => { let service: OidcProvisioningService; let userService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let roleService: DeepMocked; let accountService: DeepMocked; let schoolYearService: DeepMocked; @@ -38,8 +38,8 @@ describe('OidcProvisioningService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: RoleService, @@ -62,7 +62,7 @@ describe('OidcProvisioningService', () => { service = module.get(OidcProvisioningService); userService = module.get(UserService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); roleService = module.get(RoleService); accountService = module.get(AccountService); schoolYearService = module.get(SchoolYearService); diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts index 0172d36d27e..c225ccc1da3 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts @@ -7,7 +7,7 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, SchoolService, SchoolYearService } from '@src/modules/school'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school'; import { FederalStateNames } from '@src/modules/school/types'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; @@ -17,7 +17,7 @@ import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; export class OidcProvisioningService { constructor( private readonly userService: UserService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly roleService: RoleService, private readonly accountService: AccountService, private readonly schoolYearService: SchoolYearService, diff --git a/apps/server/src/modules/school/school.module.ts b/apps/server/src/modules/school/school.module.ts index f09ddbff769..afff50155dd 100644 --- a/apps/server/src/modules/school/school.module.ts +++ b/apps/server/src/modules/school/school.module.ts @@ -2,19 +2,19 @@ import { Module } from '@nestjs/common'; import { FederalStateRepo, SchoolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { SchoolYearRepo } from './repo'; -import { FederalStateService, SchoolService, SchoolValidationService, SchoolYearService } from './service'; +import { FederalStateService, LegacySchoolService, SchoolValidationService, SchoolYearService } from './service'; @Module({ imports: [LoggerModule], providers: [ SchoolRepo, - SchoolService, + LegacySchoolService, SchoolYearService, SchoolYearRepo, FederalStateService, FederalStateRepo, SchoolValidationService, ], - exports: [SchoolService, SchoolYearService, FederalStateService], + exports: [LegacySchoolService, SchoolYearService, FederalStateService], }) export class SchoolModule {} diff --git a/apps/server/src/modules/school/service/school.service.spec.ts b/apps/server/src/modules/school/service/school.service.spec.ts index 8d303aa0e5b..3c54c838a77 100644 --- a/apps/server/src/modules/school/service/school.service.spec.ts +++ b/apps/server/src/modules/school/service/school.service.spec.ts @@ -4,12 +4,12 @@ import { SchoolFeatures } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { SchoolRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities } from '@shared/testing'; -import { SchoolService } from './school.service'; +import { LegacySchoolService } from './school.service'; import { SchoolValidationService } from './validation/school-validation.service'; -describe('SchoolService', () => { +describe('LegacySchoolService', () => { let module: TestingModule; - let schoolService: SchoolService; + let schoolService: LegacySchoolService; let schoolRepo: DeepMocked; let schoolValidationService: DeepMocked; @@ -17,7 +17,7 @@ describe('SchoolService', () => { beforeAll(async () => { module = await Test.createTestingModule({ providers: [ - SchoolService, + LegacySchoolService, { provide: SchoolRepo, useValue: createMock(), @@ -30,7 +30,7 @@ describe('SchoolService', () => { }).compile(); schoolRepo = module.get(SchoolRepo); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); schoolValidationService = module.get(SchoolValidationService); await setupEntities(); diff --git a/apps/server/src/modules/school/service/school.service.ts b/apps/server/src/modules/school/service/school.service.ts index becf7d58eeb..23f9a2e8530 100644 --- a/apps/server/src/modules/school/service/school.service.ts +++ b/apps/server/src/modules/school/service/school.service.ts @@ -5,7 +5,7 @@ import { SchoolRepo } from '@shared/repo'; import { SchoolValidationService } from './validation'; @Injectable() -export class SchoolService { +export class LegacySchoolService { constructor( private readonly schoolRepo: SchoolRepo, private readonly schoolValidationService: SchoolValidationService diff --git a/apps/server/src/modules/school/uc/school.uc.spec.ts b/apps/server/src/modules/school/uc/school.uc.spec.ts index e293af1d869..3ed7f229c54 100644 --- a/apps/server/src/modules/school/uc/school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/school.uc.spec.ts @@ -5,7 +5,7 @@ import { UserLoginMigrationDO } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school/service/school.service'; +import { LegacySchoolService } from '@src/modules/school/service/school.service'; import { SchoolUc } from '@src/modules/school/uc/school.uc'; import { SchoolMigrationService, @@ -18,7 +18,7 @@ describe('SchoolUc', () => { let module: TestingModule; let schoolUc: SchoolUc; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let authService: DeepMocked; let schoolMigrationService: DeepMocked; let userLoginMigrationService: DeepMocked; @@ -29,8 +29,8 @@ describe('SchoolUc', () => { providers: [ SchoolUc, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: AuthorizationService, @@ -51,7 +51,7 @@ describe('SchoolUc', () => { ], }).compile(); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); authService = module.get(AuthorizationService); schoolUc = module.get(SchoolUc); schoolMigrationService = module.get(SchoolMigrationService); diff --git a/apps/server/src/modules/school/uc/school.uc.ts b/apps/server/src/modules/school/uc/school.uc.ts index 0fc424938a2..7a68718b66b 100644 --- a/apps/server/src/modules/school/uc/school.uc.ts +++ b/apps/server/src/modules/school/uc/school.uc.ts @@ -6,13 +6,13 @@ import { UserLoginMigrationRevertService, UserLoginMigrationService, } from '@src/modules/user-login-migration'; -import { SchoolService } from '../service'; +import { LegacySchoolService } from '../service'; import { OauthMigrationDto } from './dto/oauth-migration.dto'; @Injectable() export class SchoolUc { constructor( - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly authService: AuthorizationService, private readonly schoolMigrationService: SchoolMigrationService, private readonly userLoginMigrationService: UserLoginMigrationService, diff --git a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts index 6e47f6db97c..6c592a04842 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts @@ -1,7 +1,7 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { EntityId, SchoolDO, User } from '@shared/domain'; import { AuthorizableReferenceType, AuthorizationContext, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { SchoolExternalTool } from '../../school-external-tool/domain'; import { ContextTypeMapper } from '../mapper'; @@ -10,7 +10,7 @@ import { ContextTypeMapper } from '../mapper'; export class ToolPermissionHelper { constructor( @Inject(forwardRef(() => AuthorizationService)) private authorizationService: AuthorizationService, - private readonly schoolService: SchoolService + private readonly schoolService: LegacySchoolService ) {} // TODO build interface to get contextDO by contextType diff --git a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts index a42c1c5cbde..880bba1753a 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts @@ -3,7 +3,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { contextExternalToolFactory, schoolDOFactory, schoolExternalToolFactory, setupEntities } from '@shared/testing'; import { Permission, SchoolDO } from '@shared/domain'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { ToolPermissionHelper } from './tool-permission-helper'; import { SchoolExternalTool } from '../../school-external-tool/domain'; @@ -13,7 +13,7 @@ describe('ToolPermissionHelper', () => { let helper: ToolPermissionHelper; let authorizationService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; beforeAll(async () => { await setupEntities(); @@ -25,15 +25,15 @@ describe('ToolPermissionHelper', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, ], }).compile(); helper = module.get(ToolPermissionHelper); authorizationService = module.get(AuthorizationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); }); afterAll(async () => { diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts index 10f0e19e639..6aa83d5d82c 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts @@ -13,7 +13,7 @@ import { schoolExternalToolFactory, setupEntities, } from '@shared/testing'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { MissingToolParameterValueLoggableException, ParameterTypeNotImplementedLoggableException } from '../../error'; import { LaunchRequestMethod, @@ -73,7 +73,7 @@ describe('AbstractLaunchStrategy', () => { let module: TestingModule; let launchStrategy: TestLaunchStrategy; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let courseRepo: DeepMocked; beforeAll(async () => { @@ -83,8 +83,8 @@ describe('AbstractLaunchStrategy', () => { providers: [ TestLaunchStrategy, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: CourseRepo, @@ -94,7 +94,7 @@ describe('AbstractLaunchStrategy', () => { }).compile(); launchStrategy = module.get(TestLaunchStrategy); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); courseRepo = module.get(CourseRepo); }); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts index b2fe6f94446..7e5b1783ffb 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { Course, EntityId, SchoolDO } from '@shared/domain'; import { CourseRepo } from '@shared/repo'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { URLSearchParams } from 'url'; import { CustomParameterLocation, @@ -21,7 +21,7 @@ import { ExternalTool } from '../../../external-tool/domain'; @Injectable() export abstract class AbstractLaunchStrategy implements IToolLaunchStrategy { - constructor(private readonly schoolService: SchoolService, private readonly courseRepo: CourseRepo) {} + constructor(private readonly schoolService: LegacySchoolService, private readonly courseRepo: CourseRepo) {} public async createLaunchData(userId: EntityId, data: IToolLaunchParams): Promise { const launchData: ToolLaunchData = this.buildToolLaunchDataFromExternalTool(data.externalTool); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts index 4aa1314ce41..3c9ba5d47e2 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { LaunchRequestMethod, PropertyData, PropertyLocation } from '../../types'; import { BasicToolLaunchStrategy } from './basic-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; @@ -19,8 +19,8 @@ describe('BasicToolLaunchStrategy', () => { providers: [ BasicToolLaunchStrategy, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: CourseRepo, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts index 2ce7d5a2444..1b9c19b7aa9 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts @@ -11,7 +11,7 @@ import { } from '@shared/testing'; import { pseudonymFactory } from '@shared/testing/factory/domainobject/pseudonym.factory'; import { PseudonymService } from '@src/modules/pseudonym/service'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { ObjectId } from 'bson'; import { Authorization } from 'oauth-1.0a'; @@ -49,8 +49,8 @@ describe('Lti11ToolLaunchStrategy', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: CourseRepo, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts index 7038765f06b..af97d2ba7c2 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts @@ -3,7 +3,7 @@ import { EntityId, LtiPrivacyPermission, Pseudonym, RoleName, UserDO } from '@sh import { RoleReference } from '@shared/domain/domainobject'; import { CourseRepo } from '@shared/repo'; import { PseudonymService } from '@src/modules/pseudonym'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { Authorization } from 'oauth-1.0a'; import { LtiRole } from '../../../common/enum'; @@ -20,7 +20,7 @@ export class Lti11ToolLaunchStrategy extends AbstractLaunchStrategy { private readonly userService: UserService, private readonly pseudonymService: PseudonymService, private readonly lti11EncryptionService: Lti11EncryptionService, - schoolService: SchoolService, + schoolService: LegacySchoolService, courseRepo: CourseRepo ) { super(schoolService, courseRepo); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts index 021e9c93ba3..488ac87c444 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { LaunchRequestMethod, PropertyData } from '../../types'; import { OAuth2ToolLaunchStrategy } from './oauth2-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; @@ -19,8 +19,8 @@ describe('OAuth2ToolLaunchStrategy', () => { providers: [ OAuth2ToolLaunchStrategy, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: CourseRepo, diff --git a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts index 386a2e874b8..d6358d314ae 100644 --- a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts +++ b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { LoggerModule } from '@src/core/logger'; import { ConfigModule } from '@nestjs/config'; import { UserImportUc } from '../uc/user-import.uc'; @@ -34,7 +34,7 @@ describe('ImportUserController', () => { useValue: {}, }, { - provide: SchoolService, + provide: LegacySchoolService, useValue: {}, }, { diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index 66ce2c32fef..c4a547d7483 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -23,7 +23,7 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { ConfigModule } from '@nestjs/config'; -import { SchoolService } from '../../school'; +import { LegacySchoolService } from '../../school'; import { LdapAlreadyPersistedException, MigrationAlreadyActivatedException, @@ -37,7 +37,7 @@ describe('[ImportUserModule]', () => { let uc: UserImportUc; let accountService: DeepMocked; let importUserRepo: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let systemRepo: DeepMocked; let userRepo: DeepMocked; let authorizationService: DeepMocked; @@ -61,8 +61,8 @@ describe('[ImportUserModule]', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: SystemRepo, @@ -81,7 +81,7 @@ describe('[ImportUserModule]', () => { uc = module.get(UserImportUc); // TODO UserRepo not available in UserUc?! accountService = module.get(AccountService); importUserRepo = module.get(ImportUserRepo); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); systemRepo = module.get(SystemRepo); userRepo = module.get(UserRepo); authorizationService = module.get(AuthorizationService); diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.ts b/apps/server/src/modules/user-import/uc/user-import.uc.ts index 25c002601ef..5381c62fd9d 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.ts @@ -23,7 +23,7 @@ import { Logger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto/account.dto'; import { AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { MigrationMayBeCompleted, MigrationMayNotBeCompleted, @@ -49,7 +49,7 @@ export class UserImportUc { private readonly accountService: AccountService, private readonly importUserRepo: ImportUserRepo, private readonly authorizationService: AuthorizationService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly systemRepo: SystemRepo, private readonly userRepo: UserRepo, private readonly logger: Logger diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts index c5092c9d393..85ea4d2a164 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts @@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { SchoolDO, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { schoolDOFactory, userDoFactory } from '@shared/testing'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { MigrationCheckService } from './migration-check.service'; @@ -12,7 +12,7 @@ describe('MigrationCheckService', () => { let service: MigrationCheckService; let userService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let userLoginMigrationRepo: DeepMocked; beforeAll(async () => { @@ -24,8 +24,8 @@ describe('MigrationCheckService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: UserLoginMigrationRepo, @@ -36,7 +36,7 @@ describe('MigrationCheckService', () => { service = module.get(MigrationCheckService); userService = module.get(UserService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); userLoginMigrationRepo = module.get(UserLoginMigrationRepo); }); diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts index d2bfc6cc065..66806b2e04e 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts @@ -3,14 +3,14 @@ import { EntityId, UserLoginMigrationDO } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; @Injectable() export class MigrationCheckService { constructor( private readonly userService: UserService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly userLoginMigrationRepo: UserLoginMigrationRepo ) {} diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index df40d7ff6bb..3295d8952a0 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -12,7 +12,7 @@ import { setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shar import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { OAuthMigrationError } from '@src/modules/user-login-migration/error/oauth-migration.error'; import { SchoolMigrationService } from './school-migration.service'; @@ -22,7 +22,7 @@ describe('SchoolMigrationService', () => { let service: SchoolMigrationService; let userService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let userLoginMigrationRepo: DeepMocked; beforeAll(async () => { @@ -32,8 +32,8 @@ describe('SchoolMigrationService', () => { providers: [ SchoolMigrationService, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: UserService, @@ -51,7 +51,7 @@ describe('SchoolMigrationService', () => { }).compile(); service = module.get(SchoolMigrationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); userService = module.get(UserService); userLoginMigrationRepo = module.get(UserLoginMigrationRepo); diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts index 2636e35c86c..4464ed4b1ca 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts @@ -3,7 +3,7 @@ import { ValidationError } from '@shared/common'; import { Page, SchoolDO, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacyLogger } from '@src/core/logger'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { performance } from 'perf_hooks'; import { OAuthMigrationError } from '../error'; @@ -11,7 +11,7 @@ import { OAuthMigrationError } from '../error'; @Injectable() export class SchoolMigrationService { constructor( - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly logger: LegacyLogger, private readonly userService: UserService, private readonly userLoginMigrationRepo: UserLoginMigrationRepo diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts index 66b13122d13..cf680799ca1 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { SchoolFeatures } from '@shared/domain'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { setupEntities, userLoginMigrationDOFactory } from '@shared/testing'; import { UserLoginMigrationRevertService } from './user-login-migration-revert.service'; import { UserLoginMigrationService } from './user-login-migration.service'; @@ -10,7 +10,7 @@ describe('UserLoginMigrationRevertService', () => { let module: TestingModule; let service: UserLoginMigrationRevertService; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let userLoginMigrationService: DeepMocked; beforeAll(async () => { @@ -24,14 +24,14 @@ describe('UserLoginMigrationRevertService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, ], }).compile(); service = module.get(UserLoginMigrationRevertService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); userLoginMigrationService = module.get(UserLoginMigrationService); }); diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts index 105f546fc0c..41d4234bc70 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts @@ -1,13 +1,13 @@ import { Injectable } from '@nestjs/common'; import { SchoolFeatures, UserLoginMigrationDO } from '@shared/domain'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserLoginMigrationService } from './user-login-migration.service'; @Injectable() export class UserLoginMigrationRevertService { constructor( private readonly userLoginMigrationService: UserLoginMigrationService, - private readonly schoolService: SchoolService + private readonly schoolService: LegacySchoolService ) {} async revertUserLoginMigration(userLoginMigration: UserLoginMigrationDO): Promise { diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts index 167c49a6599..23b70efc372 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts @@ -6,7 +6,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { EntityId, SchoolDO, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { schoolDOFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; @@ -19,7 +19,7 @@ describe('UserLoginMigrationService', () => { let service: UserLoginMigrationService; let userService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let systemService: DeepMocked; let userLoginMigrationRepo: DeepMocked; let schoolMigrationService: DeepMocked; @@ -41,8 +41,8 @@ describe('UserLoginMigrationService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: SystemService, @@ -61,7 +61,7 @@ describe('UserLoginMigrationService', () => { service = module.get(UserLoginMigrationService); userService = module.get(UserService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); systemService = module.get(SystemService); userLoginMigrationRepo = module.get(UserLoginMigrationRepo); schoolMigrationService = module.get(SchoolMigrationService); diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts index 66cbbab680a..49f27b53f13 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts @@ -2,7 +2,7 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { Injectable, InternalServerErrorException, UnprocessableEntityException } from '@nestjs/common'; import { EntityId, SchoolDO, SchoolFeatures, SystemTypeEnum, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemDto, SystemService } from '@src/modules/system'; import { UserService } from '@src/modules/user'; import { UserLoginMigrationNotFoundLoggableException } from '../error'; @@ -13,7 +13,7 @@ export class UserLoginMigrationService { constructor( private readonly userService: UserService, private readonly userLoginMigrationRepo: UserLoginMigrationRepo, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly systemService: SystemService, private readonly schoolMigrationService: SchoolMigrationService ) {} diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts index 2dab1b1116e..a051ba30729 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts @@ -15,7 +15,7 @@ import { schoolDOFactory, setupEntities, userDoFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto, AccountSaveDto } from '@src/modules/account/services/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto } from '@src/modules/system/service/dto/oauth-config.dto'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; @@ -30,7 +30,7 @@ describe('UserMigrationService', () => { let configBefore: IConfig; let logger: LegacyLogger; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let systemService: DeepMocked; let userService: DeepMocked; let accountService: DeepMocked; @@ -50,8 +50,8 @@ describe('UserMigrationService', () => { providers: [ UserMigrationService, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: SystemService, @@ -77,7 +77,7 @@ describe('UserMigrationService', () => { }).compile(); service = module.get(UserMigrationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); systemService = module.get(SystemService); userService = module.get(UserService); accountService = module.get(AccountService); diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts index eeae6fa9572..5a858b4595d 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts @@ -13,7 +13,7 @@ import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-log import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SystemDto, SystemService } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; import { EntityId, SystemTypeEnum } from '@src/shared/domain/types'; @@ -37,7 +37,7 @@ export class UserMigrationService { private readonly loginUrl: string = '/login'; constructor( - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly systemService: SystemService, private readonly userService: UserService, private readonly logger: LegacyLogger, diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts index 74111af89d7..30d07c8048f 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, @@ -19,7 +19,7 @@ describe('RestartUserLoginMigrationUc', () => { let userLoginMigrationService: DeepMocked; let authorizationService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; beforeAll(async () => { module = await Test.createTestingModule({ @@ -34,8 +34,8 @@ describe('RestartUserLoginMigrationUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: Logger, @@ -47,7 +47,7 @@ describe('RestartUserLoginMigrationUc', () => { uc = module.get(RestartUserLoginMigrationUc); userLoginMigrationService = module.get(UserLoginMigrationService); authorizationService = module.get(AuthorizationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); await setupEntities(); }); diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts index a515755830a..7da19246a12 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, @@ -15,7 +15,7 @@ export class RestartUserLoginMigrationUc { constructor( private readonly userLoginMigrationService: UserLoginMigrationService, private readonly authorizationService: AuthorizationService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly logger: Logger ) { this.logger.setContext(RestartUserLoginMigrationUc.name); diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts index 24207e57370..1241c149614 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationService } from '../service'; import { StartUserLoginMigrationUc } from './start-user-login-migration.uc'; @@ -16,7 +16,7 @@ describe('StartUserLoginMigrationUc', () => { let userLoginMigrationService: DeepMocked; let authorizationService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; beforeAll(async () => { module = await Test.createTestingModule({ @@ -31,8 +31,8 @@ describe('StartUserLoginMigrationUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: Logger, @@ -44,7 +44,7 @@ describe('StartUserLoginMigrationUc', () => { uc = module.get(StartUserLoginMigrationUc); userLoginMigrationService = module.get(UserLoginMigrationService); authorizationService = module.get(AuthorizationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); await setupEntities(); }); diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts index d97fe1d0ff8..e039c668c2d 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationStartLoggable } from '../loggable'; import { UserLoginMigrationService } from '../service'; @@ -12,7 +12,7 @@ export class StartUserLoginMigrationUc { constructor( private readonly userLoginMigrationService: UserLoginMigrationService, private readonly authorizationService: AuthorizationService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly logger: Logger ) { this.logger.setContext(StartUserLoginMigrationUc.name); diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts index 99cd16eeeba..dcb884b7dbc 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, @@ -20,7 +20,7 @@ describe('ToggleUserLoginMigrationUc', () => { let userLoginMigrationService: DeepMocked; let authorizationService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; beforeAll(async () => { module = await Test.createTestingModule({ @@ -35,8 +35,8 @@ describe('ToggleUserLoginMigrationUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: Logger, @@ -48,7 +48,7 @@ describe('ToggleUserLoginMigrationUc', () => { uc = module.get(ToggleUserLoginMigrationUc); userLoginMigrationService = module.get(UserLoginMigrationService); authorizationService = module.get(AuthorizationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); await setupEntities(); }); diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts index d54db5c3ff1..260d7b2a64b 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, @@ -16,7 +16,7 @@ export class ToggleUserLoginMigrationUc { constructor( private readonly userLoginMigrationService: UserLoginMigrationService, private readonly authorizationService: AuthorizationService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly logger: Logger ) {} diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts index 2ca93a14c1f..67e94b25507 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts @@ -18,7 +18,7 @@ import { OAuthTokenDto } from '@src/modules/oauth'; import { OAuthService } from '@src/modules/oauth/service/oauth.service'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { Oauth2MigrationParams } from '../controller/dto/oauth2-migration.params'; import { OAuthMigrationError, SchoolMigrationError, UserLoginMigrationError } from '../error'; import { PageTypes } from '../interface/page-types.enum'; @@ -74,8 +74,8 @@ describe('UserLoginMigrationUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: LegacyLogger, diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts index d0bbf42a995..6b5bf23b716 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts @@ -19,7 +19,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { courseFactory, roleFactory, setupEntities, userDoFactory } from '@shared/testing'; import { videoConferenceDOFactory } from '@shared/testing/factory/video-conference.do.factory'; @@ -39,7 +39,7 @@ describe('VideoConferenceService', () => { let courseService: DeepMocked; let calendarService: DeepMocked; let authorizationService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; let teamsRepo: DeepMocked; let userService: DeepMocked; let videoConferenceRepo: DeepMocked; @@ -68,8 +68,8 @@ describe('VideoConferenceService', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, { provide: TeamsRepo, @@ -90,7 +90,7 @@ describe('VideoConferenceService', () => { courseService = module.get(CourseService); calendarService = module.get(CalendarService); authorizationService = module.get(AuthorizationService); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); teamsRepo = module.get(TeamsRepo); userService = module.get(UserService); videoConferenceRepo = module.get(VideoConferenceRepo); diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.ts b/apps/server/src/modules/video-conference/service/video-conference.service.ts index 94a0491119e..22232ade6a6 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.ts @@ -22,7 +22,7 @@ import { AuthorizationService, } from '@src/modules/authorization'; import { CourseService } from '@src/modules/learnroom/service/course.service'; -import { SchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { BBBRole } from '../bbb'; import { ErrorStatus } from '../error/error-status.enum'; @@ -37,7 +37,7 @@ export class VideoConferenceService { private readonly courseService: CourseService, private readonly calendarService: CalendarService, private readonly authorizationService: AuthorizationService, - private readonly schoolService: SchoolService, + private readonly schoolService: LegacySchoolService, private readonly teamsRepo: TeamsRepo, private readonly userService: UserService, private readonly videoConferenceRepo: VideoConferenceRepo diff --git a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.spec.ts b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.spec.ts index 060ae475d1b..408245ec34f 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.spec.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.spec.ts @@ -19,7 +19,7 @@ import { CalendarEventDto } from '@shared/infra/calendar/dto/calendar-event.dto' import { TeamsRepo, VideoConferenceRepo } from '@shared/repo'; import { roleFactory, setupEntities, userDoFactory } from '@shared/testing'; import { teamFactory } from '@shared/testing/factory/team.factory'; -import { AuthorizationService, SchoolService, UserService } from '@src/modules'; +import { AuthorizationService, LegacySchoolService, UserService } from '@src/modules'; import { ICurrentUser } from '@src/modules/authentication'; import { CourseService } from '@src/modules/learnroom/service/course.service'; import { IScopeInfo, VideoConference, VideoConferenceJoin, VideoConferenceState } from './dto'; @@ -69,7 +69,7 @@ describe('VideoConferenceUc', () => { let courseService: DeepMocked; let userService: DeepMocked; let calendarService: DeepMocked; - let schoolService: DeepMocked; + let schoolService: DeepMocked; const hostUrl = 'https://localhost:4000'; const course: Course = { id: 'courseId', name: 'courseName' } as Course; @@ -142,13 +142,13 @@ describe('VideoConferenceUc', () => { useValue: createMock(), }, { - provide: SchoolService, - useValue: createMock(), + provide: LegacySchoolService, + useValue: createMock(), }, ], }).compile(); useCase = module.get(VideoConferenceDeprecatedUcSpec); - schoolService = module.get(SchoolService); + schoolService = module.get(LegacySchoolService); authorizationService = module.get(AuthorizationService); courseService = module.get(CourseService); calendarService = module.get(CalendarService); diff --git a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts index c9234fd34c7..2e9df4143bb 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts @@ -24,7 +24,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { SchoolService } from '@src/modules/school/service/school.service'; +import { LegacySchoolService } from '@src/modules/school/service/school.service'; import { CourseService } from '@src/modules/learnroom/service/course.service'; import { UserService } from '@src/modules/user'; import { IScopeInfo, VideoConference, VideoConferenceInfo, VideoConferenceJoin, VideoConferenceState } from './dto'; @@ -68,7 +68,7 @@ export class VideoConferenceDeprecatedUc { private readonly courseService: CourseService, private readonly userService: UserService, private readonly calendarService: CalendarService, - private readonly schoolService: SchoolService + private readonly schoolService: LegacySchoolService ) { this.hostURL = Configuration.get('HOST') as string; } From a84a9ebaf13b79e6ea6c9c80662b08d0a38d1be9 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 10:46:27 +0200 Subject: [PATCH 02/29] Rename school service files --- apps/server/src/modules/school/service/index.ts | 2 +- .../{school.service.spec.ts => legacy-school.service.spec.ts} | 2 +- .../service/{school.service.ts => legacy-school.service.ts} | 0 apps/server/src/modules/school/uc/school.uc.spec.ts | 2 +- .../video-conference/uc/video-conference-deprecated.uc.ts | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename apps/server/src/modules/school/service/{school.service.spec.ts => legacy-school.service.spec.ts} (99%) rename apps/server/src/modules/school/service/{school.service.ts => legacy-school.service.ts} (100%) diff --git a/apps/server/src/modules/school/service/index.ts b/apps/server/src/modules/school/service/index.ts index f216df3e8e8..09f01c98215 100644 --- a/apps/server/src/modules/school/service/index.ts +++ b/apps/server/src/modules/school/service/index.ts @@ -1,4 +1,4 @@ -export * from './school.service'; +export * from './legacy-school.service'; export * from './school-year.service'; export * from './federal-state.service'; export * from './validation'; diff --git a/apps/server/src/modules/school/service/school.service.spec.ts b/apps/server/src/modules/school/service/legacy-school.service.spec.ts similarity index 99% rename from apps/server/src/modules/school/service/school.service.spec.ts rename to apps/server/src/modules/school/service/legacy-school.service.spec.ts index 3c54c838a77..15554d6d754 100644 --- a/apps/server/src/modules/school/service/school.service.spec.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.spec.ts @@ -4,7 +4,7 @@ import { SchoolFeatures } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { SchoolRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities } from '@shared/testing'; -import { LegacySchoolService } from './school.service'; +import { LegacySchoolService } from './legacy-school.service'; import { SchoolValidationService } from './validation/school-validation.service'; describe('LegacySchoolService', () => { diff --git a/apps/server/src/modules/school/service/school.service.ts b/apps/server/src/modules/school/service/legacy-school.service.ts similarity index 100% rename from apps/server/src/modules/school/service/school.service.ts rename to apps/server/src/modules/school/service/legacy-school.service.ts diff --git a/apps/server/src/modules/school/uc/school.uc.spec.ts b/apps/server/src/modules/school/uc/school.uc.spec.ts index 3ed7f229c54..27574d86916 100644 --- a/apps/server/src/modules/school/uc/school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/school.uc.spec.ts @@ -5,7 +5,7 @@ import { UserLoginMigrationDO } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school/service/school.service'; +import { LegacySchoolService } from '@src/modules/school/service'; import { SchoolUc } from '@src/modules/school/uc/school.uc'; import { SchoolMigrationService, diff --git a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts index 2e9df4143bb..4e4499aec51 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts @@ -24,7 +24,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school/service/school.service'; +import { LegacySchoolService } from '@src/modules/school'; import { CourseService } from '@src/modules/learnroom/service/course.service'; import { UserService } from '@src/modules/user'; import { IScopeInfo, VideoConference, VideoConferenceInfo, VideoConferenceJoin, VideoConferenceState } from './dto'; From f7a0e96895f9a905b2dcb810b7253a22564c0b6d Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 10:50:19 +0200 Subject: [PATCH 03/29] Rename SchoolUc --- .../school/controller/school.controller.spec.ts | 10 +++++----- .../src/modules/school/controller/school.controller.ts | 4 ++-- apps/server/src/modules/school/school-api.module.ts | 4 ++-- apps/server/src/modules/school/uc/school.uc.spec.ts | 10 +++++----- apps/server/src/modules/school/uc/school.uc.ts | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/server/src/modules/school/controller/school.controller.spec.ts b/apps/server/src/modules/school/controller/school.controller.spec.ts index cd41a61edf0..bb06d175d4a 100644 --- a/apps/server/src/modules/school/controller/school.controller.spec.ts +++ b/apps/server/src/modules/school/controller/school.controller.spec.ts @@ -4,14 +4,14 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ICurrentUser } from '@src/modules/authentication'; import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; -import { SchoolUc } from '../uc/school.uc'; +import { LegacySchoolUc } from '../uc/school.uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; import { SchoolController } from './school.controller'; describe('School Controller', () => { let module: TestingModule; let controller: SchoolController; - let schoolUc: DeepMocked; + let schoolUc: DeepMocked; let mapper: DeepMocked; beforeAll(async () => { @@ -19,8 +19,8 @@ describe('School Controller', () => { controllers: [SchoolController], providers: [ { - provide: SchoolUc, - useValue: createMock(), + provide: LegacySchoolUc, + useValue: createMock(), }, { provide: MigrationMapper, @@ -29,7 +29,7 @@ describe('School Controller', () => { ], }).compile(); controller = module.get(SchoolController); - schoolUc = module.get(SchoolUc); + schoolUc = module.get(LegacySchoolUc); mapper = module.get(MigrationMapper); }); diff --git a/apps/server/src/modules/school/controller/school.controller.ts b/apps/server/src/modules/school/controller/school.controller.ts index e4d3c8c3a7a..4b7d9248dcb 100644 --- a/apps/server/src/modules/school/controller/school.controller.ts +++ b/apps/server/src/modules/school/controller/school.controller.ts @@ -10,14 +10,14 @@ import { ICurrentUser } from '@src/modules/authentication'; import { Authenticate, CurrentUser } from '@src/modules/authentication/decorator/auth.decorator'; import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; -import { SchoolUc } from '../uc/school.uc'; +import { LegacySchoolUc } from '../uc/school.uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; @ApiTags('School') @Authenticate('jwt') @Controller('school') export class SchoolController { - constructor(private readonly schoolUc: SchoolUc, private readonly migrationMapper: MigrationMapper) {} + constructor(private readonly schoolUc: LegacySchoolUc, private readonly migrationMapper: MigrationMapper) {} @Put(':schoolId/migration') @Authenticate('jwt') diff --git a/apps/server/src/modules/school/school-api.module.ts b/apps/server/src/modules/school/school-api.module.ts index 48917e254e2..c78bc43e860 100644 --- a/apps/server/src/modules/school/school-api.module.ts +++ b/apps/server/src/modules/school/school-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; -import { SchoolUc } from './uc/school.uc'; +import { LegacySchoolUc } from './uc/school.uc'; import { SchoolModule } from './school.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; @@ -10,6 +10,6 @@ import { MigrationMapper } from './mapper/migration.mapper'; @Module({ imports: [SchoolModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], controllers: [SchoolController], - providers: [SchoolUc, MigrationMapper], + providers: [LegacySchoolUc, MigrationMapper], }) export class SchoolApiModule {} diff --git a/apps/server/src/modules/school/uc/school.uc.spec.ts b/apps/server/src/modules/school/uc/school.uc.spec.ts index 27574d86916..8bf5dea189a 100644 --- a/apps/server/src/modules/school/uc/school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/school.uc.spec.ts @@ -6,7 +6,7 @@ import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school/service'; -import { SchoolUc } from '@src/modules/school/uc/school.uc'; +import { LegacySchoolUc } from '@src/modules/school/uc/school.uc'; import { SchoolMigrationService, UserLoginMigrationRevertService, @@ -14,9 +14,9 @@ import { } from '@src/modules/user-login-migration'; import { OauthMigrationDto } from './dto/oauth-migration.dto'; -describe('SchoolUc', () => { +describe('LegacySchoolUc', () => { let module: TestingModule; - let schoolUc: SchoolUc; + let schoolUc: LegacySchoolUc; let schoolService: DeepMocked; let authService: DeepMocked; @@ -27,7 +27,7 @@ describe('SchoolUc', () => { beforeAll(async () => { module = await Test.createTestingModule({ providers: [ - SchoolUc, + LegacySchoolUc, { provide: LegacySchoolService, useValue: createMock(), @@ -53,7 +53,7 @@ describe('SchoolUc', () => { schoolService = module.get(LegacySchoolService); authService = module.get(AuthorizationService); - schoolUc = module.get(SchoolUc); + schoolUc = module.get(LegacySchoolUc); schoolMigrationService = module.get(SchoolMigrationService); userLoginMigrationService = module.get(UserLoginMigrationService); userLoginMigrationRevertService = module.get(UserLoginMigrationRevertService); diff --git a/apps/server/src/modules/school/uc/school.uc.ts b/apps/server/src/modules/school/uc/school.uc.ts index 7a68718b66b..56d7463c03e 100644 --- a/apps/server/src/modules/school/uc/school.uc.ts +++ b/apps/server/src/modules/school/uc/school.uc.ts @@ -10,7 +10,7 @@ import { LegacySchoolService } from '../service'; import { OauthMigrationDto } from './dto/oauth-migration.dto'; @Injectable() -export class SchoolUc { +export class LegacySchoolUc { constructor( private readonly schoolService: LegacySchoolService, private readonly authService: AuthorizationService, From d8dc1c17045a3b8304acc8fae5ef55848ad50a2b Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 10:59:40 +0200 Subject: [PATCH 04/29] Rename school uc files --- .../src/modules/school/controller/school.controller.spec.ts | 2 +- apps/server/src/modules/school/controller/school.controller.ts | 2 +- apps/server/src/modules/school/school-api.module.ts | 2 +- apps/server/src/modules/school/uc/index.ts | 1 + .../school/uc/{school.uc.spec.ts => legacy-school.uc.spec.ts} | 2 +- .../src/modules/school/uc/{school.uc.ts => legacy-school.uc.ts} | 0 6 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 apps/server/src/modules/school/uc/index.ts rename apps/server/src/modules/school/uc/{school.uc.spec.ts => legacy-school.uc.spec.ts} (99%) rename apps/server/src/modules/school/uc/{school.uc.ts => legacy-school.uc.ts} (100%) diff --git a/apps/server/src/modules/school/controller/school.controller.spec.ts b/apps/server/src/modules/school/controller/school.controller.spec.ts index bb06d175d4a..1f6be74df84 100644 --- a/apps/server/src/modules/school/controller/school.controller.spec.ts +++ b/apps/server/src/modules/school/controller/school.controller.spec.ts @@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ICurrentUser } from '@src/modules/authentication'; import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; -import { LegacySchoolUc } from '../uc/school.uc'; +import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; import { SchoolController } from './school.controller'; diff --git a/apps/server/src/modules/school/controller/school.controller.ts b/apps/server/src/modules/school/controller/school.controller.ts index 4b7d9248dcb..7db8b370437 100644 --- a/apps/server/src/modules/school/controller/school.controller.ts +++ b/apps/server/src/modules/school/controller/school.controller.ts @@ -10,7 +10,7 @@ import { ICurrentUser } from '@src/modules/authentication'; import { Authenticate, CurrentUser } from '@src/modules/authentication/decorator/auth.decorator'; import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; -import { LegacySchoolUc } from '../uc/school.uc'; +import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; @ApiTags('School') diff --git a/apps/server/src/modules/school/school-api.module.ts b/apps/server/src/modules/school/school-api.module.ts index c78bc43e860..e4acf39aa9e 100644 --- a/apps/server/src/modules/school/school-api.module.ts +++ b/apps/server/src/modules/school/school-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; -import { LegacySchoolUc } from './uc/school.uc'; +import { LegacySchoolUc } from './uc'; import { SchoolModule } from './school.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; diff --git a/apps/server/src/modules/school/uc/index.ts b/apps/server/src/modules/school/uc/index.ts new file mode 100644 index 00000000000..97a341c0458 --- /dev/null +++ b/apps/server/src/modules/school/uc/index.ts @@ -0,0 +1 @@ +export * from './legacy-school.uc'; diff --git a/apps/server/src/modules/school/uc/school.uc.spec.ts b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts similarity index 99% rename from apps/server/src/modules/school/uc/school.uc.spec.ts rename to apps/server/src/modules/school/uc/legacy-school.uc.spec.ts index 8bf5dea189a..73ce888e997 100644 --- a/apps/server/src/modules/school/uc/school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts @@ -6,7 +6,7 @@ import { SchoolDO } from '@shared/domain/domainobject/school.do'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school/service'; -import { LegacySchoolUc } from '@src/modules/school/uc/school.uc'; +import { LegacySchoolUc } from '@src/modules/school/uc'; import { SchoolMigrationService, UserLoginMigrationRevertService, diff --git a/apps/server/src/modules/school/uc/school.uc.ts b/apps/server/src/modules/school/uc/legacy-school.uc.ts similarity index 100% rename from apps/server/src/modules/school/uc/school.uc.ts rename to apps/server/src/modules/school/uc/legacy-school.uc.ts From 85040e70bc7cebef39b17cf8146e49f8113f2d08 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 11:01:40 +0200 Subject: [PATCH 05/29] Rename SchoolRepo --- .../modules/authentication/authentication.module.ts | 4 ++-- .../authentication/strategy/ldap.strategy.spec.ts | 10 +++++----- .../modules/authentication/strategy/ldap.strategy.ts | 4 ++-- .../src/modules/authorization/authorization.module.ts | 4 ++-- .../src/modules/authorization/reference.loader.spec.ts | 10 +++++----- .../src/modules/authorization/reference.loader.ts | 6 +++--- apps/server/src/modules/school/school.module.ts | 4 ++-- .../school/service/legacy-school.service.spec.ts | 10 +++++----- .../modules/school/service/legacy-school.service.ts | 4 ++-- .../validation/school-validation.service.spec.ts | 10 +++++----- .../service/validation/school-validation.service.ts | 4 ++-- .../src/modules/user-import/user-import.module.ts | 4 ++-- .../shared/repo/school/school.repo.integration.spec.ts | 10 +++++----- apps/server/src/shared/repo/school/school.repo.ts | 2 +- 14 files changed, 43 insertions(+), 43 deletions(-) diff --git a/apps/server/src/modules/authentication/authentication.module.ts b/apps/server/src/modules/authentication/authentication.module.ts index e0fb4570dcd..1cfdca45fde 100644 --- a/apps/server/src/modules/authentication/authentication.module.ts +++ b/apps/server/src/modules/authentication/authentication.module.ts @@ -3,7 +3,7 @@ import { JwtModule, JwtModuleOptions } from '@nestjs/jwt'; import { PassportModule } from '@nestjs/passport'; import { CacheWrapperModule } from '@shared/infra/cache'; import { IdentityManagementModule } from '@shared/infra/identity-management'; -import { SchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; +import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { OauthModule } from '@src/modules/oauth/oauth.module'; @@ -70,7 +70,7 @@ const jwtModuleOptions: JwtModuleOptions = { JwtValidationAdapter, UserRepo, SystemRepo, - SchoolRepo, + LegacySchoolRepo, LocalStrategy, AuthenticationService, LdapService, diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts index 44403b0adaf..e47208cfb01 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -4,7 +4,7 @@ import { PassportModule } from '@nestjs/passport'; import { Test, TestingModule } from '@nestjs/testing'; import { RoleName, System, User } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; -import { SchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; +import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { accountDtoFactory, defaultTestPassword, @@ -28,7 +28,7 @@ describe('LdapStrategy', () => { let strategy: LdapStrategy; let userRepoMock: DeepMocked; - let schoolRepoMock: DeepMocked; + let schoolRepoMock: DeepMocked; let authenticationServiceMock: DeepMocked; let ldapServiceMock: DeepMocked; let systemRepo: DeepMocked; @@ -53,8 +53,8 @@ describe('LdapStrategy', () => { useValue: createMock(), }, { - provide: SchoolRepo, - useValue: createMock(), + provide: LegacySchoolRepo, + useValue: createMock(), }, { provide: SystemRepo, @@ -69,7 +69,7 @@ describe('LdapStrategy', () => { strategy = module.get(LdapStrategy); authenticationServiceMock = module.get(AuthenticationService); - schoolRepoMock = module.get(SchoolRepo); + schoolRepoMock = module.get(LegacySchoolRepo); userRepoMock = module.get(UserRepo); ldapServiceMock = module.get(LdapService); systemRepo = module.get(SystemRepo); diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts index 3e5327c62aa..d5f79ff86d7 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts @@ -2,7 +2,7 @@ import { Injectable, UnauthorizedException } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { System, User } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; -import { SchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; +import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { ErrorLoggable } from '@src/core/error/loggable/error.loggable'; import { Logger } from '@src/core/logger'; import { AccountDto } from '@src/modules/account/services/dto'; @@ -17,7 +17,7 @@ import { LdapService } from '../services/ldap.service'; export class LdapStrategy extends PassportStrategy(Strategy, 'ldap') { constructor( private readonly systemRepo: SystemRepo, - private readonly schoolRepo: SchoolRepo, + private readonly schoolRepo: LegacySchoolRepo, private readonly ldapService: LdapService, private readonly authenticationService: AuthenticationService, private readonly userRepo: UserRepo, diff --git a/apps/server/src/modules/authorization/authorization.module.ts b/apps/server/src/modules/authorization/authorization.module.ts index fbb33c0c4ea..a77bb82444c 100644 --- a/apps/server/src/modules/authorization/authorization.module.ts +++ b/apps/server/src/modules/authorization/authorization.module.ts @@ -6,7 +6,7 @@ import { CourseRepo, LessonRepo, SchoolExternalToolRepo, - SchoolRepo, + LegacySchoolRepo, SubmissionRepo, TaskRepo, TeamsRepo, @@ -35,7 +35,7 @@ import { RuleManager } from './rule-manager'; CourseRepo, CourseGroupRepo, TaskRepo, - SchoolRepo, + LegacySchoolRepo, LessonRepo, TeamsRepo, SubmissionRepo, diff --git a/apps/server/src/modules/authorization/reference.loader.spec.ts b/apps/server/src/modules/authorization/reference.loader.spec.ts index 76501434a4e..9bba78b1880 100644 --- a/apps/server/src/modules/authorization/reference.loader.spec.ts +++ b/apps/server/src/modules/authorization/reference.loader.spec.ts @@ -8,7 +8,7 @@ import { CourseRepo, LessonRepo, SchoolExternalToolRepo, - SchoolRepo, + LegacySchoolRepo, SubmissionRepo, TaskRepo, TeamsRepo, @@ -26,7 +26,7 @@ describe('reference.loader', () => { let courseRepo: DeepMocked; let courseGroupRepo: DeepMocked; let taskRepo: DeepMocked; - let schoolRepo: DeepMocked; + let schoolRepo: DeepMocked; let lessonRepo: DeepMocked; let teamsRepo: DeepMocked; let submissionRepo: DeepMocked; @@ -58,8 +58,8 @@ describe('reference.loader', () => { useValue: createMock(), }, { - provide: SchoolRepo, - useValue: createMock(), + provide: LegacySchoolRepo, + useValue: createMock(), }, { provide: LessonRepo, @@ -93,7 +93,7 @@ describe('reference.loader', () => { courseRepo = await module.get(CourseRepo); courseGroupRepo = await module.get(CourseGroupRepo); taskRepo = await module.get(TaskRepo); - schoolRepo = await module.get(SchoolRepo); + schoolRepo = await module.get(LegacySchoolRepo); lessonRepo = await module.get(LessonRepo); teamsRepo = await module.get(TeamsRepo); submissionRepo = await module.get(SubmissionRepo); diff --git a/apps/server/src/modules/authorization/reference.loader.ts b/apps/server/src/modules/authorization/reference.loader.ts index 550f1f02762..9afe013fd24 100644 --- a/apps/server/src/modules/authorization/reference.loader.ts +++ b/apps/server/src/modules/authorization/reference.loader.ts @@ -6,7 +6,7 @@ import { CourseRepo, LessonRepo, SchoolExternalToolRepo, - SchoolRepo, + LegacySchoolRepo, SubmissionRepo, TaskRepo, TeamsRepo, @@ -21,7 +21,7 @@ type RepoType = | TaskRepo | CourseRepo | UserRepo - | SchoolRepo + | LegacySchoolRepo | LessonRepo | TeamsRepo | CourseGroupRepo @@ -44,7 +44,7 @@ export class ReferenceLoader { private readonly courseRepo: CourseRepo, private readonly courseGroupRepo: CourseGroupRepo, private readonly taskRepo: TaskRepo, - private readonly schoolRepo: SchoolRepo, + private readonly schoolRepo: LegacySchoolRepo, private readonly lessonRepo: LessonRepo, private readonly teamsRepo: TeamsRepo, private readonly submissionRepo: SubmissionRepo, diff --git a/apps/server/src/modules/school/school.module.ts b/apps/server/src/modules/school/school.module.ts index afff50155dd..5afc3087beb 100644 --- a/apps/server/src/modules/school/school.module.ts +++ b/apps/server/src/modules/school/school.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { FederalStateRepo, SchoolRepo } from '@shared/repo'; +import { FederalStateRepo, LegacySchoolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { SchoolYearRepo } from './repo'; import { FederalStateService, LegacySchoolService, SchoolValidationService, SchoolYearService } from './service'; @@ -7,7 +7,7 @@ import { FederalStateService, LegacySchoolService, SchoolValidationService, Scho @Module({ imports: [LoggerModule], providers: [ - SchoolRepo, + LegacySchoolRepo, LegacySchoolService, SchoolYearService, SchoolYearRepo, diff --git a/apps/server/src/modules/school/service/legacy-school.service.spec.ts b/apps/server/src/modules/school/service/legacy-school.service.spec.ts index 15554d6d754..cbead0a57cb 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.spec.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { SchoolFeatures } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; -import { SchoolRepo } from '@shared/repo'; +import { LegacySchoolRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities } from '@shared/testing'; import { LegacySchoolService } from './legacy-school.service'; import { SchoolValidationService } from './validation/school-validation.service'; @@ -11,7 +11,7 @@ describe('LegacySchoolService', () => { let module: TestingModule; let schoolService: LegacySchoolService; - let schoolRepo: DeepMocked; + let schoolRepo: DeepMocked; let schoolValidationService: DeepMocked; beforeAll(async () => { @@ -19,8 +19,8 @@ describe('LegacySchoolService', () => { providers: [ LegacySchoolService, { - provide: SchoolRepo, - useValue: createMock(), + provide: LegacySchoolRepo, + useValue: createMock(), }, { provide: SchoolValidationService, @@ -29,7 +29,7 @@ describe('LegacySchoolService', () => { ], }).compile(); - schoolRepo = module.get(SchoolRepo); + schoolRepo = module.get(LegacySchoolRepo); schoolService = module.get(LegacySchoolService); schoolValidationService = module.get(SchoolValidationService); diff --git a/apps/server/src/modules/school/service/legacy-school.service.ts b/apps/server/src/modules/school/service/legacy-school.service.ts index 23f9a2e8530..cc0dda72a8c 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.ts @@ -1,13 +1,13 @@ import { Injectable } from '@nestjs/common'; import { EntityId, SchoolFeatures } from '@shared/domain'; import { SchoolDO } from '@shared/domain/domainobject/school.do'; -import { SchoolRepo } from '@shared/repo'; +import { LegacySchoolRepo } from '@shared/repo'; import { SchoolValidationService } from './validation'; @Injectable() export class LegacySchoolService { constructor( - private readonly schoolRepo: SchoolRepo, + private readonly schoolRepo: LegacySchoolRepo, private readonly schoolValidationService: SchoolValidationService ) {} diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts index 6a283e11374..c8d071bdaad 100644 --- a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts +++ b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { SchoolDO } from '@shared/domain'; -import { SchoolRepo } from '@shared/repo'; +import { LegacySchoolRepo } from '@shared/repo'; import { schoolDOFactory } from '@shared/testing'; import { SchoolNumberDuplicateLoggableException } from '../../error'; import { SchoolValidationService } from './school-validation.service'; @@ -10,21 +10,21 @@ describe('SchoolValidationService', () => { let module: TestingModule; let service: SchoolValidationService; - let schoolRepo: DeepMocked; + let schoolRepo: DeepMocked; beforeAll(async () => { module = await Test.createTestingModule({ providers: [ SchoolValidationService, { - provide: SchoolRepo, - useValue: createMock(), + provide: LegacySchoolRepo, + useValue: createMock(), }, ], }).compile(); service = module.get(SchoolValidationService); - schoolRepo = module.get(SchoolRepo); + schoolRepo = module.get(LegacySchoolRepo); }); afterAll(async () => { diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.ts b/apps/server/src/modules/school/service/validation/school-validation.service.ts index a1dc1a7396d..14f9241a4e8 100644 --- a/apps/server/src/modules/school/service/validation/school-validation.service.ts +++ b/apps/server/src/modules/school/service/validation/school-validation.service.ts @@ -1,11 +1,11 @@ import { Injectable } from '@nestjs/common'; import { SchoolDO } from '@shared/domain'; -import { SchoolRepo } from '@shared/repo'; +import { LegacySchoolRepo } from '@shared/repo'; import { SchoolNumberDuplicateLoggableException } from '../../error'; @Injectable() export class SchoolValidationService { - constructor(private readonly schoolRepo: SchoolRepo) {} + constructor(private readonly schoolRepo: LegacySchoolRepo) {} public async validate(school: SchoolDO): Promise { if (!(await this.isSchoolNumberUnique(school))) { diff --git a/apps/server/src/modules/user-import/user-import.module.ts b/apps/server/src/modules/user-import/user-import.module.ts index af5e4e89fa3..ca2bae05883 100644 --- a/apps/server/src/modules/user-import/user-import.module.ts +++ b/apps/server/src/modules/user-import/user-import.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { ImportUserRepo, SchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; +import { ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '../account'; import { AuthorizationModule } from '../authorization'; @@ -10,7 +10,7 @@ import { UserImportUc } from './uc/user-import.uc'; @Module({ imports: [LoggerModule, AccountModule, SchoolModule, AuthorizationModule], controllers: [ImportUserController], - providers: [UserImportUc, ImportUserRepo, SchoolRepo, SystemRepo, UserRepo], + providers: [UserImportUc, ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo], exports: [], }) /** diff --git a/apps/server/src/shared/repo/school/school.repo.integration.spec.ts b/apps/server/src/shared/repo/school/school.repo.integration.spec.ts index ab4fd5e1f17..a45f76a425f 100644 --- a/apps/server/src/shared/repo/school/school.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/school/school.repo.integration.spec.ts @@ -19,25 +19,25 @@ import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.fac import { schoolYearFactory } from '@shared/testing/factory/schoolyear.factory'; import { LegacyLogger } from '@src/core/logger'; import { userLoginMigrationFactory } from '@shared/testing/factory/user-login-migration.factory'; -import { SchoolRepo } from '..'; +import { LegacySchoolRepo } from '..'; -describe('SchoolRepo', () => { +describe('LegacySchoolRepo', () => { let module: TestingModule; - let repo: SchoolRepo; + let repo: LegacySchoolRepo; let em: EntityManager; beforeAll(async () => { module = await Test.createTestingModule({ imports: [MongoMemoryDatabaseModule.forRoot()], providers: [ - SchoolRepo, + LegacySchoolRepo, { provide: LegacyLogger, useValue: createMock(), }, ], }).compile(); - repo = module.get(SchoolRepo); + repo = module.get(LegacySchoolRepo); em = module.get(EntityManager); }); diff --git a/apps/server/src/shared/repo/school/school.repo.ts b/apps/server/src/shared/repo/school/school.repo.ts index 485c8551dd6..f314b803d23 100644 --- a/apps/server/src/shared/repo/school/school.repo.ts +++ b/apps/server/src/shared/repo/school/school.repo.ts @@ -7,7 +7,7 @@ import { LegacyLogger } from '@src/core/logger'; import { BaseDORepo } from '../base.do.repo'; @Injectable() -export class SchoolRepo extends BaseDORepo { +export class LegacySchoolRepo extends BaseDORepo { constructor(protected readonly _em: EntityManager, protected readonly logger: LegacyLogger) { super(_em, logger); } From 8afc7b14c96bba1361cc4f0a7be3665217ccc643 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 11:02:44 +0200 Subject: [PATCH 06/29] Rename school repo files --- apps/server/src/shared/repo/school/index.ts | 2 +- ...tegration.spec.ts => legacy-school.repo.integration.spec.ts} | 0 .../repo/school/{school.repo.ts => legacy-school.repo.ts} | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename apps/server/src/shared/repo/school/{school.repo.integration.spec.ts => legacy-school.repo.integration.spec.ts} (100%) rename apps/server/src/shared/repo/school/{school.repo.ts => legacy-school.repo.ts} (100%) diff --git a/apps/server/src/shared/repo/school/index.ts b/apps/server/src/shared/repo/school/index.ts index 89e46f27b72..602b003d013 100644 --- a/apps/server/src/shared/repo/school/index.ts +++ b/apps/server/src/shared/repo/school/index.ts @@ -1 +1 @@ -export * from './school.repo'; +export * from './legacy-school.repo'; diff --git a/apps/server/src/shared/repo/school/school.repo.integration.spec.ts b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts similarity index 100% rename from apps/server/src/shared/repo/school/school.repo.integration.spec.ts rename to apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts diff --git a/apps/server/src/shared/repo/school/school.repo.ts b/apps/server/src/shared/repo/school/legacy-school.repo.ts similarity index 100% rename from apps/server/src/shared/repo/school/school.repo.ts rename to apps/server/src/shared/repo/school/legacy-school.repo.ts From cc76a0ba0855c680b1ff1e5d53b570708eab9492 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 11:04:16 +0200 Subject: [PATCH 07/29] Rename SchoolDO --- .../strategy/ldap.strategy.spec.ts | 18 ++++----- .../authentication/strategy/ldap.strategy.ts | 6 +-- .../oauth/service/oauth.service.spec.ts | 10 +++-- .../modules/oauth/service/oauth.service.ts | 4 +- .../src/modules/oauth/uc/oauth.uc.spec.ts | 4 +- apps/server/src/modules/oauth/uc/oauth.uc.ts | 4 +- .../strategy/iserv/iserv-do.mapper.ts | 4 +- .../strategy/iserv/iserv.strategy.spec.ts | 4 +- .../strategy/iserv/iserv.strategy.ts | 4 +- .../strategy/oidc/oidc.strategy.spec.ts | 4 +- .../strategy/oidc/oidc.strategy.ts | 4 +- .../service/oidc-provisioning.service.spec.ts | 6 +-- .../oidc/service/oidc-provisioning.service.ts | 12 +++--- .../service/legacy-school.service.spec.ts | 39 +++++++++--------- .../school/service/legacy-school.service.ts | 22 +++++----- .../school-validation.service.spec.ts | 12 +++--- .../validation/school-validation.service.ts | 8 ++-- .../school/uc/legacy-school.uc.spec.ts | 16 ++++---- .../src/modules/school/uc/legacy-school.uc.ts | 6 +-- .../tool/common/uc/tool-permission-helper.ts | 4 +- .../common/uc/tool-permissions-helper.spec.ts | 4 +- .../strategy/abstract-launch.strategy.spec.ts | 6 +-- .../strategy/abstract-launch.strategy.ts | 4 +- .../user-import/uc/user-import.uc.spec.ts | 12 +++--- .../modules/user-import/uc/user-import.uc.ts | 33 ++++++++------- .../service/migration-check.service.spec.ts | 10 ++--- .../service/migration-check.service.ts | 4 +- .../service/school-migration.service.spec.ts | 24 +++++------ .../service/school-migration.service.ts | 20 +++++----- .../user-login-migration.service.spec.ts | 40 +++++++++---------- .../service/user-login-migration.service.ts | 10 ++--- .../service/user-migration.service.spec.ts | 4 +- .../service/user-migration.service.ts | 4 +- .../restart-user-login-migration.uc.spec.ts | 12 +++--- .../uc/restart-user-login-migration.uc.ts | 4 +- .../uc/start-user-login-migration.uc.spec.ts | 12 +++--- .../uc/start-user-login-migration.uc.ts | 4 +- .../uc/toggle-user-login-migration.uc.spec.ts | 14 +++---- .../uc/toggle-user-login-migration.uc.ts | 4 +- .../uc/user-login-migration.uc.spec.ts | 10 ++--- .../uc/user-login-migration.uc.ts | 6 +-- .../shared/domain/domainobject/school.do.ts | 4 +- .../shared/domain/rules/school.rule.spec.ts | 4 +- .../src/shared/domain/rules/school.rule.ts | 8 ++-- .../legacy-school.repo.integration.spec.ts | 22 +++++----- .../shared/repo/school/legacy-school.repo.ts | 18 ++++----- .../factory/domainobject/school.factory.ts | 6 +-- 47 files changed, 253 insertions(+), 241 deletions(-) diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts index e47208cfb01..4f93c9447d4 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -3,7 +3,7 @@ import { UnauthorizedException } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; import { Test, TestingModule } from '@nestjs/testing'; import { RoleName, System, User } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { accountDtoFactory, @@ -92,7 +92,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: undefined }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -139,7 +139,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [] }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -186,7 +186,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: undefined }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: undefined }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -233,7 +233,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -280,7 +280,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -332,7 +332,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -389,7 +389,7 @@ describe('LdapStrategy', () => { .withRoleByName(RoleName.STUDENT) .buildWithId({ ldapDn: 'mockLdapDn', school: schoolFactory.buildWithId() }); - const school: SchoolDO = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = schoolDOFactory.buildWithId( { systems: [system.id], previousExternalId: undefined }, user.school.id ); @@ -451,7 +451,7 @@ describe('LdapStrategy', () => { .withRoleByName(RoleName.STUDENT) .buildWithId({ ldapDn: 'mockLdapDn', school: schoolFactory.buildWithId() }); - const school: SchoolDO = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = schoolDOFactory.buildWithId( { systems: [system.id], previousExternalId: 'previousExternalId' }, user.school.id ); diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts index d5f79ff86d7..b8a47229ab5 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts @@ -1,7 +1,7 @@ import { Injectable, UnauthorizedException } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; import { System, User } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { ErrorLoggable } from '@src/core/error/loggable/error.loggable'; import { Logger } from '@src/core/logger'; @@ -31,7 +31,7 @@ export class LdapStrategy extends PassportStrategy(Strategy, 'ldap') { const system: System = await this.systemRepo.findById(systemId); - const school: SchoolDO = await this.schoolRepo.findById(schoolId); + const school: LegacySchoolDo = await this.schoolRepo.findById(schoolId); if (!school.systems || !school.systems.includes(systemId)) { throw new UnauthorizedException(`School ${schoolId} does not have the selected system ${systemId}`); @@ -84,7 +84,7 @@ export class LdapStrategy extends PassportStrategy(Strategy, 'ldap') { } } - private async loadAccount(username: string, systemId: string, school: SchoolDO): Promise { + private async loadAccount(username: string, systemId: string, school: LegacySchoolDo): Promise { const externalSchoolId = this.checkValue(school.externalId); let account: AccountDto; diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index 5da1c3a21a0..c16c25cb37a 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Configuration } from '@hpi-schul-cloud/commons'; import { Test, TestingModule } from '@nestjs/testing'; import { OauthConfig, SchoolFeatures, System } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { DefaultEncryptionService, IEncryptionService, SymetricKeyEncryptionService } from '@shared/infra/encryption'; @@ -427,7 +427,9 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: SchoolDO = schoolDOFactory.buildWithId({ features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED] }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ + features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED], + }); provisioningService.getData.mockResolvedValue(oauthData); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); @@ -467,7 +469,7 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: SchoolDO = schoolDOFactory.buildWithId({ features: [] }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [] }); provisioningService.getData.mockResolvedValue(oauthData); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); @@ -513,7 +515,7 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: SchoolDO = schoolDOFactory.buildWithId({ features: [] }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [] }); provisioningService.getData.mockResolvedValue(oauthData); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); diff --git a/apps/server/src/modules/oauth/service/oauth.service.ts b/apps/server/src/modules/oauth/service/oauth.service.ts index 2dcb5eaa0aa..144aa691156 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.ts @@ -2,7 +2,7 @@ import { Configuration } from '@hpi-schul-cloud/commons'; import { Inject } from '@nestjs/common'; import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator'; import { EntityId, OauthConfig, SchoolFeatures } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encryption'; import { LegacyLogger } from '@src/core/logger'; @@ -132,7 +132,7 @@ export class OAuthService { } async isOauthProvisioningEnabledForSchool(officialSchoolNumber: string): Promise { - const school: SchoolDO | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); + const school: LegacySchoolDo | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); if (!school) { return true; diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index df5676e7ad6..0eb0841ce7c 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnauthorizedException, UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { ISession } from '@shared/domain/types/session'; @@ -621,7 +621,7 @@ describe('OAuthUc', () => { oauthService.requestToken.mockResolvedValue(tokenDto); provisioningService.getData.mockResolvedValue(oauthData); - const schoolToMigrate: SchoolDO | void = schoolDOFactory.build({ name: 'mockName' }); + const schoolToMigrate: LegacySchoolDo | void = schoolDOFactory.build({ name: 'mockName' }); oauthService.authenticateUser.mockResolvedValue(tokenDto); schoolMigrationService.schoolToMigrate.mockResolvedValue(schoolToMigrate); userMigrationService.migrateUser.mockResolvedValue(userMigrationDto); diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.ts b/apps/server/src/modules/oauth/uc/oauth.uc.ts index 271c8220904..2b728e35bba 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.ts @@ -1,6 +1,6 @@ import { Injectable, UnauthorizedException, UnprocessableEntityException } from '@nestjs/common'; import { EntityId } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { ISession } from '@shared/domain/types/session'; import { LegacyLogger } from '@src/core/logger'; @@ -122,7 +122,7 @@ export class OauthUc { const data: OauthDataDto = await this.provisioningService.getData(systemId, tokenDto.idToken, tokenDto.accessToken); if (data.externalSchool) { - const schoolToMigrate: SchoolDO | null = await this.schoolMigrationService.schoolToMigrate( + const schoolToMigrate: LegacySchoolDo | null = await this.schoolMigrationService.schoolToMigrate( currentUserId, data.externalSchool.externalId, data.externalSchool.officialSchoolNumber diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts index 63803ac1577..7004bd24534 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts @@ -1,10 +1,10 @@ import { RoleName } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { ExternalSchoolDto, ExternalUserDto } from '../../dto'; export class IservMapper { - static mapToExternalSchoolDto(schoolDO: SchoolDO): ExternalSchoolDto { + static mapToExternalSchoolDto(schoolDO: LegacySchoolDo): ExternalSchoolDto { return new ExternalSchoolDto({ name: schoolDO.name, externalId: schoolDO.externalId || '', diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index a81a16e6b66..0d7100a8845 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ObjectId } from '@mikro-orm/mongodb'; import { Test, TestingModule } from '@nestjs/testing'; import { RoleName, User } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; @@ -92,7 +92,7 @@ describe('IservProvisioningStrategy', () => { const user: UserDO = userDoFactory.withRoles([{ id: 'roleId', name: RoleName.STUDENT }]).buildWithId({ externalId: userUUID, }); - const school: SchoolDO = schoolDOFactory.buildWithId({ externalId: 'schoolExternalId' }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ externalId: 'schoolExternalId' }); const roleDto: RoleDto = new RoleDto({ name: RoleName.STUDENT, }); diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts index 1d83c4dbe81..3922a2e7eed 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { RoleName, User } from '@shared/domain'; import { RoleReference } from '@shared/domain/domainobject'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; @@ -47,7 +47,7 @@ export class IservProvisioningStrategy extends ProvisioningStrategy { ); } - const ldapSchool: SchoolDO = await this.schoolService.getSchoolById(ldapUser.schoolId); + const ldapSchool: LegacySchoolDo = await this.schoolService.getSchoolById(ldapUser.schoolId); const roleNames: RoleName[] = ldapUser.roles.map((roleRef: RoleReference): RoleName => roleRef.name); const externalUser: ExternalUserDto = IservMapper.mapToExternalUserDto(ldapUser, roleNames); diff --git a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts index 85d70550b03..e8750cdab37 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { NotImplementedException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { RoleName } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { userDoFactory, schoolDOFactory } from '@shared/testing'; @@ -78,7 +78,7 @@ describe('OidcStrategy', () => { schoolId: 'schoolId', externalId: externalUserId, }); - const school: SchoolDO = schoolDOFactory.build({ + const school: LegacySchoolDo = schoolDOFactory.build({ id: schoolId, name: 'schoolName', externalId: externalSchoolId, diff --git a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts index 7fc7b038a68..553f9a70e2b 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { OauthDataDto, ProvisioningDto } from '../../dto'; import { ProvisioningStrategy } from '../base.strategy'; @@ -12,7 +12,7 @@ export abstract class OidcProvisioningStrategy extends ProvisioningStrategy { } override async apply(data: OauthDataDto): Promise { - let school: SchoolDO | undefined; + let school: LegacySchoolDo | undefined; if (data.externalSchool) { school = await this.oidcProvisioningService.provisionExternalSchool(data.externalSchool, data.system.systemId); } diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index d65b82128d4..7dc79b5ab79 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { RoleName, SchoolFeatures } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { federalStateFactory, schoolDOFactory, userDoFactory } from '@shared/testing'; import { schoolYearFactory } from '@shared/testing/factory/schoolyear.factory'; @@ -119,7 +119,7 @@ describe('OidcProvisioningService', () => { it('should save the new school', async () => { const { systemId, externalSchoolDto, savedSchoolDO } = setup(); - const result: SchoolDO = await service.provisionExternalSchool(externalSchoolDto, systemId); + const result: LegacySchoolDo = await service.provisionExternalSchool(externalSchoolDto, systemId); expect(result).toEqual(savedSchoolDO); }); @@ -131,7 +131,7 @@ describe('OidcProvisioningService', () => { schoolService.getSchoolByExternalId.mockResolvedValue(existingSchoolDO); - const result: SchoolDO = await service.provisionExternalSchool(externalSchoolDto, systemId); + const result: LegacySchoolDo = await service.provisionExternalSchool(externalSchoolDto, systemId); expect(result).toEqual(savedSchoolDO); }); diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts index c225ccc1da3..987280b0998 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts @@ -1,7 +1,7 @@ import { Injectable, UnprocessableEntityException } from '@nestjs/common'; import { EntityId, FederalState, SchoolFeatures, SchoolYear } from '@shared/domain'; import { RoleReference } from '@shared/domain/domainobject'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; @@ -24,12 +24,12 @@ export class OidcProvisioningService { private readonly federalStateService: FederalStateService ) {} - async provisionExternalSchool(externalSchool: ExternalSchoolDto, systemId: EntityId): Promise { - const existingSchool: SchoolDO | null = await this.schoolService.getSchoolByExternalId( + async provisionExternalSchool(externalSchool: ExternalSchoolDto, systemId: EntityId): Promise { + const existingSchool: LegacySchoolDo | null = await this.schoolService.getSchoolByExternalId( externalSchool.externalId, systemId ); - let school: SchoolDO; + let school: LegacySchoolDo; if (existingSchool) { school = existingSchool; school.name = externalSchool.name; @@ -45,7 +45,7 @@ export class OidcProvisioningService { FederalStateNames.NIEDERSACHEN ); - school = new SchoolDO({ + school = new LegacySchoolDo({ externalId: externalSchool.externalId, name: externalSchool.name, officialSchoolNumber: externalSchool.officialSchoolNumber, @@ -57,7 +57,7 @@ export class OidcProvisioningService { }); } - const savedSchool: SchoolDO = await this.schoolService.save(school, true); + const savedSchool: LegacySchoolDo = await this.schoolService.save(school, true); return savedSchool; } diff --git a/apps/server/src/modules/school/service/legacy-school.service.spec.ts b/apps/server/src/modules/school/service/legacy-school.service.spec.ts index cbead0a57cb..ab4ce387777 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.spec.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { SchoolFeatures } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { LegacySchoolRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities } from '@shared/testing'; import { LegacySchoolService } from './legacy-school.service'; @@ -42,7 +42,7 @@ describe('LegacySchoolService', () => { const setupOld = () => { const systems: string[] = ['systemId']; - const schoolSaved: SchoolDO = schoolDOFactory.build({ + const schoolSaved: LegacySchoolDo = schoolDOFactory.build({ id: 'testId', name: 'schoolName', externalId: 'externalId', @@ -50,7 +50,7 @@ describe('LegacySchoolService', () => { systems, features: [SchoolFeatures.VIDEOCONFERENCE], }); - const schoolUnsaved: SchoolDO = schoolDOFactory.build({ name: 'school #2}', systems: [] }); + const schoolUnsaved: LegacySchoolDo = schoolDOFactory.build({ name: 'school #2}', systems: [] }); schoolRepo.findById.mockResolvedValue(schoolSaved); schoolRepo.findByExternalId.mockResolvedValue(schoolSaved); schoolRepo.findBySchoolNumber.mockResolvedValue(schoolSaved); @@ -110,7 +110,7 @@ describe('LegacySchoolService', () => { describe('removeFeature', () => { describe('when given schoolFeature exists on school', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [SchoolFeatures.VIDEOCONFERENCE, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); @@ -132,7 +132,7 @@ describe('LegacySchoolService', () => { describe('when school has a feature which should be removed', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [SchoolFeatures.VIDEOCONFERENCE, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); @@ -170,9 +170,9 @@ describe('LegacySchoolService', () => { it('should return a do', async () => { const { schoolSavedId } = setupOld(); - const schoolDO: SchoolDO = await schoolService.getSchoolById(schoolSavedId); + const schoolDO: LegacySchoolDo = await schoolService.getSchoolById(schoolSavedId); - expect(schoolDO).toBeInstanceOf(SchoolDO); + expect(schoolDO).toBeInstanceOf(LegacySchoolDo); }); }); }); @@ -189,16 +189,19 @@ describe('LegacySchoolService', () => { it('should return a do', async () => { const { schoolSavedExternalId, systems } = setupOld(); - const schoolDO: SchoolDO | null = await schoolService.getSchoolByExternalId(schoolSavedExternalId, systems[0]); + const schoolDO: LegacySchoolDo | null = await schoolService.getSchoolByExternalId( + schoolSavedExternalId, + systems[0] + ); - expect(schoolDO).toBeInstanceOf(SchoolDO); + expect(schoolDO).toBeInstanceOf(LegacySchoolDo); }); it('should return null', async () => { const { systems } = setupOld(); schoolRepo.findByExternalId.mockResolvedValue(null); - const schoolDO: SchoolDO | null = await schoolService.getSchoolByExternalId('null', systems[0]); + const schoolDO: LegacySchoolDo | null = await schoolService.getSchoolByExternalId('null', systems[0]); expect(schoolDO).toBeNull(); }); @@ -216,14 +219,14 @@ describe('LegacySchoolService', () => { it('should return a do', async () => { const { schoolSavedNumber } = setupOld(); - const schoolDO: SchoolDO | null = await schoolService.getSchoolBySchoolNumber(schoolSavedNumber); + const schoolDO: LegacySchoolDo | null = await schoolService.getSchoolBySchoolNumber(schoolSavedNumber); - expect(schoolDO).toBeInstanceOf(SchoolDO); + expect(schoolDO).toBeInstanceOf(LegacySchoolDo); }); it('should return null', async () => { schoolRepo.findBySchoolNumber.mockResolvedValue(null); - const schoolDO: SchoolDO | null = await schoolService.getSchoolBySchoolNumber('null'); + const schoolDO: LegacySchoolDo | null = await schoolService.getSchoolBySchoolNumber('null'); expect(schoolDO).toBeNull(); }); @@ -232,7 +235,7 @@ describe('LegacySchoolService', () => { describe('save is called', () => { describe('when validation is deactivated', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.build(); + const school: LegacySchoolDo = schoolDOFactory.build(); schoolRepo.save.mockResolvedValue(school); @@ -252,7 +255,7 @@ describe('LegacySchoolService', () => { it('should return a do', async () => { const { school } = setup(); - const schoolDO: SchoolDO = await schoolService.save(school); + const schoolDO: LegacySchoolDo = await schoolService.save(school); expect(schoolDO).toBeDefined(); }); @@ -269,7 +272,7 @@ describe('LegacySchoolService', () => { describe('when validation is active', () => { describe('when the validation fails', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.build(); + const school: LegacySchoolDo = schoolDOFactory.build(); schoolRepo.save.mockResolvedValueOnce(school); schoolValidationService.validate.mockRejectedValueOnce(new Error()); @@ -306,7 +309,7 @@ describe('LegacySchoolService', () => { describe('when the validation succeeds', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.build(); + const school: LegacySchoolDo = schoolDOFactory.build(); schoolRepo.save.mockResolvedValueOnce(school); @@ -326,7 +329,7 @@ describe('LegacySchoolService', () => { it('should return a do', async () => { const { school } = setup(); - const schoolDO: SchoolDO = await schoolService.save(school, true); + const schoolDO: LegacySchoolDo = await schoolService.save(school, true); expect(schoolDO).toBeDefined(); }); diff --git a/apps/server/src/modules/school/service/legacy-school.service.ts b/apps/server/src/modules/school/service/legacy-school.service.ts index cc0dda72a8c..e0de637d310 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { EntityId, SchoolFeatures } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { LegacySchoolRepo } from '@shared/repo'; import { SchoolValidationService } from './validation'; @@ -12,42 +12,42 @@ export class LegacySchoolService { ) {} async hasFeature(schoolId: EntityId, feature: SchoolFeatures): Promise { - const entity: SchoolDO = await this.schoolRepo.findById(schoolId); + const entity: LegacySchoolDo = await this.schoolRepo.findById(schoolId); return entity.features ? entity.features.includes(feature) : false; } async removeFeature(schoolId: EntityId, feature: SchoolFeatures): Promise { - const school: SchoolDO = await this.schoolRepo.findById(schoolId); + const school: LegacySchoolDo = await this.schoolRepo.findById(schoolId); if (school.features && school.features.includes(feature)) { school.features = school.features.filter((f: SchoolFeatures) => f !== feature); await this.schoolRepo.save(school); } } - async getSchoolById(id: string): Promise { - const schoolDO: SchoolDO = await this.schoolRepo.findById(id); + async getSchoolById(id: string): Promise { + const schoolDO: LegacySchoolDo = await this.schoolRepo.findById(id); return schoolDO; } - async getSchoolByExternalId(externalId: string, systemId: string): Promise { - const schoolDO: SchoolDO | null = await this.schoolRepo.findByExternalId(externalId, systemId); + async getSchoolByExternalId(externalId: string, systemId: string): Promise { + const schoolDO: LegacySchoolDo | null = await this.schoolRepo.findByExternalId(externalId, systemId); return schoolDO; } - async getSchoolBySchoolNumber(schoolNumber: string): Promise { - const schoolDO: SchoolDO | null = await this.schoolRepo.findBySchoolNumber(schoolNumber); + async getSchoolBySchoolNumber(schoolNumber: string): Promise { + const schoolDO: LegacySchoolDo | null = await this.schoolRepo.findBySchoolNumber(schoolNumber); return schoolDO; } - async save(school: SchoolDO, validate = false): Promise { + async save(school: LegacySchoolDo, validate = false): Promise { if (validate) { await this.schoolValidationService.validate(school); } - const ret: SchoolDO = await this.schoolRepo.save(school); + const ret: LegacySchoolDo = await this.schoolRepo.save(school); return ret; } diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts index c8d071bdaad..818010807ac 100644 --- a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts +++ b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; -import { SchoolDO } from '@shared/domain'; +import { LegacySchoolDo } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; import { schoolDOFactory } from '@shared/testing'; import { SchoolNumberDuplicateLoggableException } from '../../error'; @@ -35,7 +35,7 @@ describe('SchoolValidationService', () => { describe('isSchoolNumberUnique', () => { describe('when a school has no official school number', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); return { school, @@ -51,7 +51,7 @@ describe('SchoolValidationService', () => { describe('when a new school is created and the school number is unique', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(null); @@ -69,7 +69,7 @@ describe('SchoolValidationService', () => { describe('when an existing school is updated and the school number is unique', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(school); @@ -87,8 +87,8 @@ describe('SchoolValidationService', () => { describe('when the school number already exists on another school', () => { const setup = () => { - const newSchool: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); - const existingSchool: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const newSchool: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const existingSchool: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(existingSchool); diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.ts b/apps/server/src/modules/school/service/validation/school-validation.service.ts index 14f9241a4e8..044e0473ef3 100644 --- a/apps/server/src/modules/school/service/validation/school-validation.service.ts +++ b/apps/server/src/modules/school/service/validation/school-validation.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { SchoolDO } from '@shared/domain'; +import { LegacySchoolDo } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; import { SchoolNumberDuplicateLoggableException } from '../../error'; @@ -7,18 +7,18 @@ import { SchoolNumberDuplicateLoggableException } from '../../error'; export class SchoolValidationService { constructor(private readonly schoolRepo: LegacySchoolRepo) {} - public async validate(school: SchoolDO): Promise { + public async validate(school: LegacySchoolDo): Promise { if (!(await this.isSchoolNumberUnique(school))) { throw new SchoolNumberDuplicateLoggableException(school.officialSchoolNumber as string); } } - private async isSchoolNumberUnique(school: SchoolDO): Promise { + private async isSchoolNumberUnique(school: LegacySchoolDo): Promise { if (!school.officialSchoolNumber) { return true; } - const foundSchool: SchoolDO | null = await this.schoolRepo.findBySchoolNumber(school.officialSchoolNumber); + const foundSchool: LegacySchoolDo | null = await this.schoolRepo.findBySchoolNumber(school.officialSchoolNumber); return foundSchool === null || foundSchool.id === school.id; } diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts index 73ce888e997..0b5ff4be07a 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { UserLoginMigrationDO } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school/service'; @@ -70,7 +70,7 @@ describe('LegacySchoolUc', () => { describe('setMigration is called', () => { describe('when first starting the migration', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -98,7 +98,7 @@ describe('LegacySchoolUc', () => { describe('when closing a migration', () => { describe('when there were migrated users', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = userLoginMigrationDOFactory.build({ closedAt: undefined, }); @@ -129,7 +129,7 @@ describe('LegacySchoolUc', () => { describe('when there were no users migrated', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = userLoginMigrationDOFactory.build({ closedAt: undefined, }); @@ -163,7 +163,7 @@ describe('LegacySchoolUc', () => { describe('when restarting a migration', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -194,7 +194,7 @@ describe('LegacySchoolUc', () => { describe('when trying to start a finished migration after the grace period', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -230,7 +230,7 @@ describe('LegacySchoolUc', () => { describe('getMigration is called', () => { describe('when the school has a migration', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -262,7 +262,7 @@ describe('LegacySchoolUc', () => { describe('when the school has no migration', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); userLoginMigrationService.findMigrationBySchool.mockResolvedValue(null); schoolService.getSchoolById.mockResolvedValue(school); diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.ts b/apps/server/src/modules/school/uc/legacy-school.uc.ts index 56d7463c03e..43174c40a6e 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { Permission, SchoolDO, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; import { Action, AuthorizableReferenceType, AuthorizationService } from '@src/modules/authorization'; import { SchoolMigrationService, @@ -58,7 +58,7 @@ export class LegacySchoolUc { await this.schoolMigrationService.unmarkOutdatedUsers(schoolId); } - const school: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const migrationDto: OauthMigrationDto = new OauthMigrationDto({ oauthMigrationPossible: !updatedUserLoginMigration.closedAt ? updatedUserLoginMigration.startedAt : undefined, @@ -81,7 +81,7 @@ export class LegacySchoolUc { schoolId ); - const school: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const migrationDto: OauthMigrationDto = new OauthMigrationDto({ oauthMigrationPossible: diff --git a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts index 6c592a04842..d869ce08d50 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts @@ -1,5 +1,5 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'; -import { EntityId, SchoolDO, User } from '@shared/domain'; +import { EntityId, LegacySchoolDo, User } from '@shared/domain'; import { AuthorizableReferenceType, AuthorizationContext, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; import { ContextExternalTool } from '../../context-external-tool/domain'; @@ -42,7 +42,7 @@ export class ToolPermissionHelper { context: AuthorizationContext ): Promise { const user: User = await this.authorizationService.getUserWithPermissions(userId); - const school: SchoolDO = await this.schoolService.getSchoolById(schoolExternalTool.schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolExternalTool.schoolId); this.authorizationService.checkPermission(user, school, context); } } diff --git a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts index 880bba1753a..3e30e1126ee 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { contextExternalToolFactory, schoolDOFactory, schoolExternalToolFactory, setupEntities } from '@shared/testing'; -import { Permission, SchoolDO } from '@shared/domain'; +import { Permission, LegacySchoolDo } from '@shared/domain'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; import { ContextExternalTool } from '../../context-external-tool/domain'; @@ -79,7 +79,7 @@ describe('ToolPermissionHelper', () => { const userId = 'userId'; const schoolExternalTool: SchoolExternalTool = schoolExternalToolFactory.buildWithId(); const context: AuthorizationContext = AuthorizationContextBuilder.read([Permission.SCHOOL_TOOL_ADMIN]); - const school: SchoolDO = schoolDOFactory.build({ id: schoolExternalTool.schoolId }); + const school: LegacySchoolDo = schoolDOFactory.build({ id: schoolExternalTool.schoolId }); schoolService.getSchoolById.mockResolvedValue(school); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts index 6aa83d5d82c..6daab5f8488 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ObjectId } from '@mikro-orm/mongodb'; import { Injectable } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { Course, EntityId, SchoolDO } from '@shared/domain'; +import { Course, EntityId, LegacySchoolDo } from '@shared/domain'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, @@ -184,7 +184,7 @@ describe('AbstractLaunchStrategy', () => { }); // Other - const school: SchoolDO = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = schoolDOFactory.buildWithId( { officialSchoolNumber: '1234', }, @@ -369,7 +369,7 @@ describe('AbstractLaunchStrategy', () => { parameters: [], }); - const school: SchoolDO = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined, }); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts index 7e5b1783ffb..2b85ab53922 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { Course, EntityId, SchoolDO } from '@shared/domain'; +import { Course, EntityId, LegacySchoolDo } from '@shared/domain'; import { CourseRepo } from '@shared/repo'; import { LegacySchoolService } from '@src/modules/school'; import { URLSearchParams } from 'url'; @@ -226,7 +226,7 @@ export abstract class AbstractLaunchStrategy implements IToolLaunchStrategy { ); } case CustomParameterType.AUTO_SCHOOLNUMBER: { - const school: SchoolDO = await this.schoolService.getSchoolById(schoolExternalTool.schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolExternalTool.schoolId); return school.officialSchoolNumber; } diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index c4a547d7483..2e46b9d0c11 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -14,7 +14,7 @@ import { System, User, } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { MongoMemoryDatabaseModule } from '@shared/infra/database'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { federalStateFactory, importUserFactory, schoolFactory, userFactory } from '@shared/testing'; @@ -114,7 +114,7 @@ describe('[ImportUserModule]', () => { }); }; - const createMockSchoolDo = (school?: School): SchoolDO => { + const createMockSchoolDo = (school?: School): LegacySchoolDo => { const name = school ? school.name : 'testSchool'; const id = school ? school.id : 'someId'; const features = school ? school.features ?? [SchoolFeatures.LDAP_UNIVENTION_MIGRATION] : []; @@ -126,7 +126,7 @@ describe('[ImportUserModule]', () => { school && school.systems.isInitialized() ? school.systems.getItems().map((system: System) => system.id) : []; const federalState = school ? school.federalState : federalStateFactory.build(); - return new SchoolDO({ + return new LegacySchoolDo({ id, name, features, @@ -635,9 +635,11 @@ describe('[ImportUserModule]', () => { }); it('Should save school params', async () => { schoolServiceSaveSpy.mockRestore(); - schoolServiceSaveSpy = schoolService.save.mockImplementation((schoolDo: SchoolDO) => Promise.resolve(schoolDo)); + schoolServiceSaveSpy = schoolService.save.mockImplementation((schoolDo: LegacySchoolDo) => + Promise.resolve(schoolDo) + ); await uc.startSchoolInUserMigration(currentUser.id); - const schoolParams: SchoolDO = { ...createMockSchoolDo(school) }; + const schoolParams: LegacySchoolDo = { ...createMockSchoolDo(school) }; schoolParams.inUserMigration = true; schoolParams.externalId = 'foo'; schoolParams.inMaintenanceSince = currentDate; diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.ts b/apps/server/src/modules/user-import/uc/user-import.uc.ts index 5381c62fd9d..b09d21e2542 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.ts @@ -17,7 +17,7 @@ import { } from '@shared/domain'; import { Configuration } from '@hpi-schul-cloud/commons'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { Logger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; @@ -57,7 +57,7 @@ export class UserImportUc { this.logger.setContext(UserImportUc.name); } - private checkFeatureEnabled(school: SchoolDO): void | never { + private checkFeatureEnabled(school: LegacySchoolDo): void | never { const enabled = Configuration.get('FEATURE_USER_MIGRATION_ENABLED') as boolean; const isLdapPilotSchool = school.features && school.features.includes(SchoolFeatures.LDAP_UNIVENTION_MIGRATION); if (!enabled && !isLdapPilotSchool) { @@ -79,7 +79,7 @@ export class UserImportUc { options?: IFindOptions ): Promise> { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_VIEW); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); // TODO Change ImportUserRepo to DO to fix this workaround const countedImportUsers = await this.importUserRepo.findImportUsers(currentUser.school, query, options); @@ -95,7 +95,7 @@ export class UserImportUc { */ async setMatch(currentUserId: EntityId, importUserId: EntityId, userMatchId: EntityId): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_UPDATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); const importUser = await this.importUserRepo.findById(importUserId); const userMatch = await this.userRepo.findById(userMatchId, true); @@ -120,7 +120,7 @@ export class UserImportUc { async removeMatch(currentUserId: EntityId, importUserId: EntityId): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_UPDATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); const importUser = await this.importUserRepo.findById(importUserId); // check same school @@ -137,7 +137,7 @@ export class UserImportUc { async updateFlag(currentUserId: EntityId, importUserId: EntityId, flagged: boolean): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_UPDATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); const importUser = await this.importUserRepo.findById(importUserId); @@ -168,7 +168,7 @@ export class UserImportUc { options?: IFindOptions ): Promise> { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_VIEW); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); // TODO Change to UserService to fix this workaround const unmatchedCountedUsers = await this.userRepo.findWithoutImportUser(currentUser.school, query, options); @@ -177,7 +177,7 @@ export class UserImportUc { async saveAllUsersMatches(currentUserId: EntityId): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_MIGRATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); const filters: IImportUserScope = { matches: [MatchCreatorScope.MANUAL, MatchCreatorScope.AUTO] }; // TODO batch/paginated import? @@ -219,7 +219,7 @@ export class UserImportUc { private async endSchoolInUserMigration(currentUserId: EntityId): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_MIGRATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); if (!school.externalId || school.inUserMigration !== true || !school.inMaintenanceSince) { this.logger.warning(new MigrationMayBeCompleted(school.inUserMigration)); @@ -231,7 +231,7 @@ export class UserImportUc { async startSchoolInUserMigration(currentUserId: EntityId, useCentralLdap = true): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_MIGRATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.logger.notice(new SchoolInUserMigrationStartLoggable(currentUserId, school.name, useCentralLdap)); this.checkFeatureEnabled(school); this.checkSchoolNumber(school, useCentralLdap); @@ -253,7 +253,7 @@ export class UserImportUc { async endSchoolInMaintenance(currentUserId: EntityId): Promise { const currentUser = await this.getCurrentUser(currentUserId, Permission.SCHOOL_IMPORT_USERS_MIGRATE); - const school: SchoolDO = await this.schoolService.getSchoolById(currentUser.school.id); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); this.checkFeatureEnabled(school); if (school.inUserMigration !== false || !school.inMaintenanceSince || !school.externalId) { this.logger.warning(new MigrationMayNotBeCompleted(school.inUserMigration)); @@ -271,7 +271,10 @@ export class UserImportUc { return currentUser; } - private async updateUserAndAccount(importUser: ImportUser, school: SchoolDO): Promise<[User, Account] | undefined> { + private async updateUserAndAccount( + importUser: ImportUser, + school: LegacySchoolDo + ): Promise<[User, Account] | undefined> { if (!importUser.user || !importUser.loginName || !school.externalId) { return; } @@ -296,7 +299,7 @@ export class UserImportUc { return system; } - private async checkNoExistingLdapBeforeStart(school: SchoolDO): Promise { + private async checkNoExistingLdapBeforeStart(school: LegacySchoolDo): Promise { if (school.systems && school.systems?.length > 0) { for (const systemId of school.systems) { // very unusual to have more than 1 system @@ -309,13 +312,13 @@ export class UserImportUc { } } - private checkSchoolNumber(school: SchoolDO, useCentralLdap: boolean): void | never { + private checkSchoolNumber(school: LegacySchoolDo, useCentralLdap: boolean): void | never { if (useCentralLdap && !school.officialSchoolNumber) { throw new MissingSchoolNumberException(); } } - private checkSchoolNotInMigration(school: SchoolDO): void | never { + private checkSchoolNotInMigration(school: LegacySchoolDo): void | never { if (school.inUserMigration !== undefined && school.inUserMigration !== null) { throw new MigrationAlreadyActivatedException(); } diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts index 85ea4d2a164..e370c4a30f4 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts @@ -1,6 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; -import { SchoolDO, UserDO, UserLoginMigrationDO } from '@shared/domain'; +import { LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { schoolDOFactory, userDoFactory } from '@shared/testing'; import { LegacySchoolService } from '@src/modules/school'; @@ -62,7 +62,7 @@ describe('MigrationCheckService', () => { describe('when a non-migrating school was found', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId(); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); @@ -81,7 +81,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school was found but no user', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, targetSystemId: 'targetSystemId', @@ -103,7 +103,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school and a user that has not migrated were found', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId({ lastLoginSystemChange: undefined }); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, @@ -126,7 +126,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school and a user that has migrated were found', () => { const setup = () => { - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId({ lastLoginSystemChange: new Date('2023-03-04') }); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts index 66806b2e04e..040ed4300ba 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { EntityId, UserLoginMigrationDO } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacySchoolService } from '@src/modules/school'; @@ -15,7 +15,7 @@ export class MigrationCheckService { ) {} async shouldUserMigrate(externalUserId: string, systemId: EntityId, officialSchoolNumber: string): Promise { - const school: SchoolDO | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); + const school: LegacySchoolDo | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); if (school && school.id) { const userLoginMigration: UserLoginMigrationDO | null = await this.userLoginMigrationRepo.findBySchoolId( diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index 3295d8952a0..ee7ec16b9bc 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -5,7 +5,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ValidationError } from '@shared/common'; import { UserLoginMigrationDO } from '@shared/domain'; import { Page } from '@shared/domain/domainobject/page'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; import { setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; @@ -122,7 +122,7 @@ describe('SchoolMigrationService', () => { describe('schoolToMigrate is called', () => { describe('when school number is missing', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -159,7 +159,7 @@ describe('SchoolMigrationService', () => { describe('when school could not be found with official school number', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -196,7 +196,7 @@ describe('SchoolMigrationService', () => { describe('when current users school not match with school of to migrate user ', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -236,7 +236,7 @@ describe('SchoolMigrationService', () => { describe('when school was already migrated', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -259,7 +259,7 @@ describe('SchoolMigrationService', () => { schoolService.getSchoolById.mockResolvedValue(schoolDO); schoolService.getSchoolBySchoolNumber.mockResolvedValue(schoolDO); - const result: SchoolDO | null = await service.schoolToMigrate( + const result: LegacySchoolDo | null = await service.schoolToMigrate( currentUserId, externalId, schoolDO.officialSchoolNumber @@ -271,7 +271,7 @@ describe('SchoolMigrationService', () => { describe('when school has to be migrated', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -293,7 +293,7 @@ describe('SchoolMigrationService', () => { schoolService.getSchoolBySchoolNumber.mockResolvedValue(schoolDO); userService.findById.mockResolvedValue(userDO); - const result: SchoolDO | null = await service.schoolToMigrate( + const result: LegacySchoolDo | null = await service.schoolToMigrate( currentUserId, 'newExternalId', schoolDO.officialSchoolNumber @@ -307,7 +307,7 @@ describe('SchoolMigrationService', () => { describe('migrateSchool is called', () => { describe('when school will be migrated', () => { const setup = () => { - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -329,7 +329,7 @@ describe('SchoolMigrationService', () => { await service.migrateSchool(newExternalId, schoolDO, targetSystemId); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ systems: [targetSystemId], previousExternalId: firstExternalId, externalId: newExternalId, @@ -345,7 +345,7 @@ describe('SchoolMigrationService', () => { await service.migrateSchool('newExternalId', schoolDO, targetSystemId); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ systems: ['existingSystem', targetSystemId], }) ); @@ -360,7 +360,7 @@ describe('SchoolMigrationService', () => { await service.migrateSchool('newExternalId', schoolDO, targetSystemId); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ systems: [targetSystemId], }) ); diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts index 4464ed4b1ca..79e5a05e0d9 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts @@ -1,6 +1,6 @@ import { Injectable, UnprocessableEntityException } from '@nestjs/common'; import { ValidationError } from '@shared/common'; -import { Page, SchoolDO, UserDO, UserLoginMigrationDO } from '@shared/domain'; +import { Page, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacyLogger } from '@src/core/logger'; import { LegacySchoolService } from '@src/modules/school'; @@ -25,8 +25,8 @@ export class SchoolMigrationService { } } - async migrateSchool(externalId: string, existingSchool: SchoolDO, targetSystemId: string): Promise { - const schoolDOCopy: SchoolDO = new SchoolDO({ ...existingSchool }); + async migrateSchool(externalId: string, existingSchool: LegacySchoolDo, targetSystemId: string): Promise { + const schoolDOCopy: LegacySchoolDo = new LegacySchoolDo({ ...existingSchool }); try { await this.doMigration(externalId, existingSchool, targetSystemId); @@ -44,7 +44,7 @@ export class SchoolMigrationService { currentUserId: string, externalId: string, officialSchoolNumber: string | undefined - ): Promise { + ): Promise { if (!officialSchoolNumber) { throw new OAuthMigrationError( 'Official school number from target migration system is missing', @@ -54,11 +54,13 @@ export class SchoolMigrationService { const userDO: UserDO | null = await this.userService.findById(currentUserId); if (userDO) { - const schoolDO: SchoolDO = await this.schoolService.getSchoolById(userDO.schoolId); + const schoolDO: LegacySchoolDo = await this.schoolService.getSchoolById(userDO.schoolId); this.checkOfficialSchoolNumbersMatch(schoolDO, officialSchoolNumber); } - const existingSchool: SchoolDO | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); + const existingSchool: LegacySchoolDo | null = await this.schoolService.getSchoolBySchoolNumber( + officialSchoolNumber + ); if (!existingSchool) { throw new OAuthMigrationError( @@ -125,7 +127,7 @@ export class SchoolMigrationService { this.logger.warn(`restartMigration for schoolId ${schoolId} took ${endTime - startTime} milliseconds`); } - private async doMigration(externalId: string, schoolDO: SchoolDO, targetSystemId: string): Promise { + private async doMigration(externalId: string, schoolDO: LegacySchoolDo, targetSystemId: string): Promise { if (schoolDO.systems) { schoolDO.systems.push(targetSystemId); } else { @@ -136,13 +138,13 @@ export class SchoolMigrationService { await this.schoolService.save(schoolDO); } - private async rollbackMigration(originalSchoolDO: SchoolDO) { + private async rollbackMigration(originalSchoolDO: LegacySchoolDo) { if (originalSchoolDO) { await this.schoolService.save(originalSchoolDO); } } - private checkOfficialSchoolNumbersMatch(schoolDO: SchoolDO, officialExternalSchoolNumber: string): void { + private checkOfficialSchoolNumbersMatch(schoolDO: LegacySchoolDo, officialExternalSchoolNumber: string): void { if (schoolDO.officialSchoolNumber !== officialExternalSchoolNumber) { throw new OAuthMigrationError( 'Current users school is not the same as school found by official school number from target migration system', diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts index 23b70efc372..5a5345e6956 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts @@ -3,7 +3,7 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { ObjectId } from '@mikro-orm/mongodb'; import { InternalServerErrorException, UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { EntityId, SchoolDO, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; +import { EntityId, LegacySchoolDo, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { schoolDOFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { LegacySchoolService } from '@src/modules/school'; @@ -165,7 +165,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no systems', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -212,7 +212,7 @@ describe('UserLoginMigrationService', () => { }); const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([system]); @@ -246,7 +246,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has a feature', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -274,7 +274,7 @@ describe('UserLoginMigrationService', () => { await service.setMigration(schoolId, true, undefined, undefined); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ features: [existingFeature, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }) ); @@ -284,7 +284,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no features yet', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId({ features: undefined }, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: undefined }, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -310,7 +310,7 @@ describe('UserLoginMigrationService', () => { await service.setMigration(schoolId, true, undefined, undefined); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }) ); @@ -320,7 +320,7 @@ describe('UserLoginMigrationService', () => { describe('when modifying a migration that does not exist on the school', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); userLoginMigrationRepo.findBySchoolId.mockResolvedValue(null); @@ -343,7 +343,7 @@ describe('UserLoginMigrationService', () => { describe('when creating a new migration but the SANIS system does not exist', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([]); @@ -368,7 +368,7 @@ describe('UserLoginMigrationService', () => { describe('when restarting the migration', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -415,7 +415,7 @@ describe('UserLoginMigrationService', () => { describe('when setting the migration to mandatory', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -459,7 +459,7 @@ describe('UserLoginMigrationService', () => { describe('when setting the migration back to optional', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -504,7 +504,7 @@ describe('UserLoginMigrationService', () => { describe('when closing the migration', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -551,7 +551,7 @@ describe('UserLoginMigrationService', () => { describe('when schoolId is given', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -614,7 +614,7 @@ describe('UserLoginMigrationService', () => { }); const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([system]); @@ -647,7 +647,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has schoolfeatures', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -674,7 +674,7 @@ describe('UserLoginMigrationService', () => { await service.startMigration(schoolId); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ features: [existingFeature, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }) ); @@ -684,7 +684,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no features yet', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId({ features: undefined }, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: undefined }, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -708,7 +708,7 @@ describe('UserLoginMigrationService', () => { await service.startMigration(schoolId); expect(schoolService.save).toHaveBeenCalledWith( - expect.objectContaining>({ + expect.objectContaining>({ features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }) ); @@ -718,7 +718,7 @@ describe('UserLoginMigrationService', () => { describe('when creating a new migration but the SANIS system does not exist', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: SchoolDO = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([]); diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts index 49f27b53f13..f3a9ff620ac 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts @@ -1,6 +1,6 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { Injectable, InternalServerErrorException, UnprocessableEntityException } from '@nestjs/common'; -import { EntityId, SchoolDO, SchoolFeatures, SystemTypeEnum, UserDO, UserLoginMigrationDO } from '@shared/domain'; +import { EntityId, LegacySchoolDo, SchoolFeatures, SystemTypeEnum, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacySchoolService } from '@src/modules/school'; import { SystemDto, SystemService } from '@src/modules/system'; @@ -24,7 +24,7 @@ export class UserLoginMigrationService { oauthMigrationMandatory?: boolean, oauthMigrationFinished?: boolean ): Promise { - const schoolDo: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const schoolDo: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const existingUserLoginMigration: UserLoginMigrationDO | null = await this.userLoginMigrationRepo.findBySchoolId( schoolId @@ -67,7 +67,7 @@ export class UserLoginMigrationService { } async startMigration(schoolId: string): Promise { - const schoolDo: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const schoolDo: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const userLoginMigrationDO: UserLoginMigrationDO = await this.createNewMigration(schoolDo); @@ -131,7 +131,7 @@ export class UserLoginMigrationService { return userLoginMigration; } - private async createNewMigration(school: SchoolDO): Promise { + private async createNewMigration(school: LegacySchoolDo): Promise { const oauthSystems: SystemDto[] = await this.systemService.findByType(SystemTypeEnum.OAUTH); const sanisSystem: SystemDto | undefined = oauthSystems.find((system: SystemDto) => system.alias === 'SANIS'); @@ -163,7 +163,7 @@ export class UserLoginMigrationService { return userLoginMigration; } - private enableOauthMigrationFeature(schoolDo: SchoolDO) { + private enableOauthMigrationFeature(schoolDo: LegacySchoolDo) { if (schoolDo.features && !schoolDo.features.includes(SchoolFeatures.OAUTH_PROVISIONING_ENABLED)) { schoolDo.features.push(SchoolFeatures.OAUTH_PROVISIONING_ENABLED); } else { diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts index a051ba30729..7cd9557c8db 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts @@ -9,7 +9,7 @@ import { UnprocessableEntityException, } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { RoleName, SchoolDO, UserDO, UserLoginMigrationDO } from '@shared/domain'; +import { RoleName, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities, userDoFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; @@ -101,7 +101,7 @@ describe('UserMigrationService', () => { describe('when finding the migration systems', () => { const setup = () => { const officialSchoolNumber = '3'; - const school: SchoolDO = schoolDOFactory.buildWithId({ name: 'schoolName', officialSchoolNumber }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ name: 'schoolName', officialSchoolNumber }); const iservSystem: SystemDto = new SystemDto({ id: 'iservId', diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts index 5a858b4595d..84a3de00062 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts @@ -7,7 +7,7 @@ import { UnprocessableEntityException, } from '@nestjs/common'; import { UserLoginMigrationDO } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; import { LegacyLogger } from '@src/core/logger'; @@ -49,7 +49,7 @@ export class UserMigrationService { } async getMigrationConsentPageRedirect(officialSchoolNumber: string, originSystemId: string): Promise { - const school: SchoolDO | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); + const school: LegacySchoolDo | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); if (!school || !school.id) { throw new NotFoundException(`School with offical school number ${officialSchoolNumber} does not exist.`); diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts index 30d07c8048f..fd7f1e40429 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; @@ -70,7 +70,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -115,7 +115,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -157,7 +157,7 @@ describe('RestartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -179,7 +179,7 @@ describe('RestartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -207,7 +207,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts index 7da19246a12..88764a756ae 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -48,7 +48,7 @@ export class RestartUserLoginMigrationUc { async checkPermission(userId: string, schoolId: string): Promise { const user: User = await this.authorizationService.getUserWithPermissions(userId); - const school: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const context: AuthorizationContext = AuthorizationContextBuilder.write([Permission.USER_LOGIN_MIGRATION_ADMIN]); this.authorizationService.checkPermission(user, school, context); diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts index 1241c149614..d867b5bfec2 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; @@ -64,7 +64,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -109,7 +109,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -139,7 +139,7 @@ describe('StartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -161,7 +161,7 @@ describe('StartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); + const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -184,7 +184,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts index e039c668c2d..5949855f42e 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -43,7 +43,7 @@ export class StartUserLoginMigrationUc { async checkPreconditions(userId: string, schoolId: string): Promise { const user: User = await this.authorizationService.getUserWithPermissions(userId); - const school: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const context: AuthorizationContext = AuthorizationContextBuilder.write([Permission.USER_LOGIN_MIGRATION_ADMIN]); this.authorizationService.checkPermission(user, school, context); diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts index dcb884b7dbc..1076d3acbfd 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts @@ -1,7 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; @@ -71,7 +71,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -119,7 +119,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -162,7 +162,7 @@ describe('ToggleUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -184,7 +184,7 @@ describe('ToggleUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -212,7 +212,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -236,7 +236,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: SchoolDO = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = schoolDOFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts index 260d7b2a64b..06bd00323a5 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -50,7 +50,7 @@ export class ToggleUserLoginMigrationUc { async checkPermission(userId: string, schoolId: string): Promise { const user: User = await this.authorizationService.getUserWithPermissions(userId); - const school: SchoolDO = await this.schoolService.getSchoolById(schoolId); + const school: LegacySchoolDo = await this.schoolService.getSchoolById(schoolId); const context: AuthorizationContext = AuthorizationContextBuilder.write([Permission.USER_LOGIN_MIGRATION_ADMIN]); this.authorizationService.checkPermission(user, school, context); diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts index 67e94b25507..fe9fde2563b 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { NotFoundLoggableException } from '@shared/common/loggable-exception'; -import { Page, Permission, SchoolDO, System, User, UserLoginMigrationDO } from '@shared/domain'; +import { Page, Permission, LegacySchoolDo, System, User, UserLoginMigrationDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { schoolDOFactory, @@ -304,7 +304,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -419,7 +419,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -483,7 +483,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -619,7 +619,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: SchoolDO = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.ts index 121e236cea8..bfbce03c9ca 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.ts @@ -1,6 +1,6 @@ import { ForbiddenException, Injectable } from '@nestjs/common'; import { NotFoundLoggableException } from '@shared/common/loggable-exception'; -import { EntityId, Page, Permission, SchoolDO, User, UserLoginMigrationDO } from '@shared/domain'; +import { EntityId, Page, Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { LegacyLogger } from '@src/core/logger'; import { AuthenticationService } from '@src/modules/authentication/services/authentication.service'; import { Action, AuthorizationService } from '@src/modules/authorization'; @@ -95,7 +95,7 @@ export class UserLoginMigrationUc { this.logMigrationInformation(currentUserId, undefined, data, targetSystemId); if (data.externalSchool) { - let schoolToMigrate: SchoolDO | null; + let schoolToMigrate: LegacySchoolDo | null; // TODO: N21-820 after fully switching to the new client login flow, try/catch will be obsolete and schoolToMigrate should throw correct errors try { schoolToMigrate = await this.schoolMigrationService.schoolToMigrate( @@ -157,7 +157,7 @@ export class UserLoginMigrationUc { text?: string, oauthData?: OauthDataDto, targetSystemId?: string, - school?: SchoolDO + school?: LegacySchoolDo ) { let message = `MIGRATION (userId: ${userId}): ${text ?? ''}`; if (!school && oauthData) { diff --git a/apps/server/src/shared/domain/domainobject/school.do.ts b/apps/server/src/shared/domain/domainobject/school.do.ts index 6ea0cffb7a4..bb6827fa7a5 100644 --- a/apps/server/src/shared/domain/domainobject/school.do.ts +++ b/apps/server/src/shared/domain/domainobject/school.do.ts @@ -2,7 +2,7 @@ import { FederalState, SchoolFeatures, SchoolYear } from '@shared/domain/entity' import { EntityId } from '@shared/domain/types'; import { BaseDO } from './base.do'; -export class SchoolDO extends BaseDO { +export class LegacySchoolDo extends BaseDO { externalId?: string; inMaintenanceSince?: Date; @@ -27,7 +27,7 @@ export class SchoolDO extends BaseDO { // TODO: N21-990 Refactoring: Create domain objects for schoolYear and federalState federalState: FederalState; - constructor(params: SchoolDO) { + constructor(params: LegacySchoolDo) { super(); this.id = params.id; this.externalId = params.externalId; diff --git a/apps/server/src/shared/domain/rules/school.rule.spec.ts b/apps/server/src/shared/domain/rules/school.rule.spec.ts index 74e017ce4a4..13f221de519 100644 --- a/apps/server/src/shared/domain/rules/school.rule.spec.ts +++ b/apps/server/src/shared/domain/rules/school.rule.spec.ts @@ -1,5 +1,5 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { Role, School, User } from '@shared/domain/entity'; import { Permission } from '@shared/domain/interface'; import { roleFactory, schoolDOFactory, schoolFactory, setupEntities, userFactory } from '@shared/testing'; @@ -11,7 +11,7 @@ describe('SchoolRule', () => { let service: SchoolRule; let authorizationHelper: AuthorizationHelper; let user: User; - let entity: School | SchoolDO; + let entity: School | LegacySchoolDo; let role: Role; const permissionA = 'a' as Permission; const permissionB = 'b' as Permission; diff --git a/apps/server/src/shared/domain/rules/school.rule.ts b/apps/server/src/shared/domain/rules/school.rule.ts index 358d549885c..ff228f0db90 100644 --- a/apps/server/src/shared/domain/rules/school.rule.ts +++ b/apps/server/src/shared/domain/rules/school.rule.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { School, User } from '@shared/domain/entity'; import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { AuthorizationContext, Rule } from '@src/modules/authorization/types'; @@ -8,13 +8,13 @@ import { AuthorizationContext, Rule } from '@src/modules/authorization/types'; export class SchoolRule implements Rule { constructor(private readonly authorizationHelper: AuthorizationHelper) {} - public isApplicable(user: User, entity: School | SchoolDO): boolean { - const isMatched: boolean = entity instanceof School || entity instanceof SchoolDO; + public isApplicable(user: User, entity: School | LegacySchoolDo): boolean { + const isMatched: boolean = entity instanceof School || entity instanceof LegacySchoolDo; return isMatched; } - public hasPermission(user: User, entity: School | SchoolDO, context: AuthorizationContext): boolean { + public hasPermission(user: User, entity: School | LegacySchoolDo, context: AuthorizationContext): boolean { const hasPermission: boolean = this.authorizationHelper.hasAllPermissions(user, context.requiredPermissions) && user.school.id === entity.id; diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts index a45f76a425f..3720ae383aa 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts @@ -12,7 +12,7 @@ import { System, UserLoginMigration, } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { MongoMemoryDatabaseModule } from '@shared/infra/database'; import { schoolFactory, systemFactory } from '@shared/testing'; import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; @@ -59,7 +59,7 @@ describe('LegacySchoolRepo', () => { describe('save is called', () => { describe('when saving only required fields', () => { function setupDO() { - const domainObject: SchoolDO = schoolDOFactory.build(); + const domainObject: LegacySchoolDo = schoolDOFactory.build(); return { domainObject, }; @@ -70,7 +70,7 @@ describe('LegacySchoolRepo', () => { const { id, ...expected } = domainObject; expected.systems = []; - const result: SchoolDO = await repo.save(domainObject); + const result: LegacySchoolDo = await repo.save(domainObject); expect(result).toMatchObject(expected); expect(result.id).toBeDefined(); @@ -117,7 +117,7 @@ describe('LegacySchoolRepo', () => { await em.persistAndFlush(schoolEntity); - const result: SchoolDO | null = await repo.findByExternalId( + const result: LegacySchoolDo | null = await repo.findByExternalId( schoolEntity.externalId as string, schoolEntity.systems[0].id ); @@ -126,7 +126,7 @@ describe('LegacySchoolRepo', () => { }); it('should return null when no school is found', async () => { - const result: SchoolDO | null = await repo.findByExternalId( + const result: LegacySchoolDo | null = await repo.findByExternalId( new ObjectId().toHexString(), new ObjectId().toHexString() ); @@ -141,13 +141,13 @@ describe('LegacySchoolRepo', () => { await em.persistAndFlush(schoolEntity); - const result: SchoolDO | null = await repo.findBySchoolNumber(schoolEntity.officialSchoolNumber as string); + const result: LegacySchoolDo | null = await repo.findBySchoolNumber(schoolEntity.officialSchoolNumber as string); expect(result?.officialSchoolNumber).toEqual(schoolEntity.officialSchoolNumber); }); it('should return null when no school is found', async () => { - const result: SchoolDO | null = await repo.findBySchoolNumber('fail'); + const result: LegacySchoolDo | null = await repo.findBySchoolNumber('fail'); expect(result).toBeNull(); }); @@ -185,7 +185,7 @@ describe('LegacySchoolRepo', () => { const userLoginMigration: UserLoginMigration = userLoginMigrationFactory.build({ school: schoolEntity }); schoolEntity.userLoginMigration = userLoginMigration; - const schoolDO: SchoolDO = repo.mapEntityToDO(schoolEntity); + const schoolDO: LegacySchoolDo = repo.mapEntityToDO(schoolEntity); expect(schoolDO).toEqual( expect.objectContaining({ @@ -223,7 +223,7 @@ describe('LegacySchoolRepo', () => { await em.persistAndFlush([userLoginMigration, system1, system2]); - const entityDO: SchoolDO = schoolDOFactory.build({ + const entityDO: LegacySchoolDo = schoolDOFactory.build({ systems: [system1.id, system2.id], userLoginMigrationId: userLoginMigration.id, }); @@ -262,7 +262,7 @@ describe('LegacySchoolRepo', () => { describe('when there are no systems', () => { it('should not call the entity manager to get the system object', () => { - const entityDO: SchoolDO = schoolDOFactory.build({ systems: undefined }); + const entityDO: LegacySchoolDo = schoolDOFactory.build({ systems: undefined }); const emGetReferenceSpy = jest.spyOn(em, 'getReference'); repo.mapDOToEntityProperties(entityDO); @@ -273,7 +273,7 @@ describe('LegacySchoolRepo', () => { describe('when there is no userLoginMigration', () => { it('should not call the entity manager to get the user login migration reference', () => { - const entityDO: SchoolDO = schoolDOFactory.build({ userLoginMigrationId: undefined }); + const entityDO: LegacySchoolDo = schoolDOFactory.build({ userLoginMigrationId: undefined }); const emGetReferenceSpy = jest.spyOn(em, 'getReference'); repo.mapDOToEntityProperties(entityDO); diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.ts b/apps/server/src/shared/repo/school/legacy-school.repo.ts index f314b803d23..e3abfb97900 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.ts @@ -2,12 +2,12 @@ import { EntityName } from '@mikro-orm/core'; import { EntityManager } from '@mikro-orm/mongodb'; import { Injectable, InternalServerErrorException } from '@nestjs/common'; import { EntityId, ISchoolProperties, School, System, UserLoginMigration } from '@shared/domain'; -import { SchoolDO } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { LegacyLogger } from '@src/core/logger'; import { BaseDORepo } from '../base.do.repo'; @Injectable() -export class LegacySchoolRepo extends BaseDORepo { +export class LegacySchoolRepo extends BaseDORepo { constructor(protected readonly _em: EntityManager, protected readonly logger: LegacyLogger) { super(_em, logger); } @@ -16,20 +16,20 @@ export class LegacySchoolRepo extends BaseDORepo { + async findByExternalId(externalId: string, systemId: string): Promise { const school: School | null = await this._em.findOne(School, { externalId, systems: systemId }); - const schoolDo: SchoolDO | null = school ? this.mapEntityToDO(school) : null; + const schoolDo: LegacySchoolDo | null = school ? this.mapEntityToDO(school) : null; return schoolDo; } - async findBySchoolNumber(officialSchoolNumber: string): Promise { + async findBySchoolNumber(officialSchoolNumber: string): Promise { const [schools, count] = await this._em.findAndCount(School, { officialSchoolNumber }); if (count > 1) { throw new InternalServerErrorException(`Multiple schools found for officialSchoolNumber ${officialSchoolNumber}`); } - const schoolDo: SchoolDO | null = schools[0] ? this.mapEntityToDO(schools[0]) : null; + const schoolDo: LegacySchoolDo | null = schools[0] ? this.mapEntityToDO(schools[0]) : null; return schoolDo; } @@ -37,8 +37,8 @@ export class LegacySchoolRepo extends BaseDORepo {} +class SchoolFactory extends DoBaseFactory {} -export const schoolDOFactory = SchoolFactory.define(SchoolDO, ({ sequence }) => { +export const schoolDOFactory = SchoolFactory.define(LegacySchoolDo, ({ sequence }) => { return { name: `schoolName-${sequence}`, externalId: '123', From 577c59757501abe2aa7a24b50faa17388e6f8f78 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 11:12:58 +0200 Subject: [PATCH 08/29] Rename school do file --- .../authentication/strategy/ldap.strategy.ts | 3 +-- .../src/modules/oauth/service/oauth.service.ts | 4 +--- apps/server/src/modules/oauth/uc/oauth.uc.ts | 4 +--- .../provisioning/strategy/iserv/iserv-do.mapper.ts | 4 +--- .../provisioning/strategy/iserv/iserv.strategy.ts | 5 +---- .../provisioning/strategy/oidc/oidc.strategy.ts | 3 +-- .../oidc/service/oidc-provisioning.service.ts | 13 +++++++++---- .../modules/school/service/legacy-school.service.ts | 3 +-- .../src/modules/user-import/uc/user-import.uc.ts | 7 +++---- .../service/migration-check.service.ts | 4 +--- .../service/user-migration.service.ts | 3 +-- apps/server/src/shared/domain/domainobject/index.ts | 2 +- .../{school.do.ts => legacy-school.do.ts} | 0 apps/server/src/shared/domain/rules/school.rule.ts | 2 +- .../src/shared/repo/school/legacy-school.repo.ts | 3 +-- .../testing/factory/domainobject/school.factory.ts | 2 +- 16 files changed, 25 insertions(+), 37 deletions(-) rename apps/server/src/shared/domain/domainobject/{school.do.ts => legacy-school.do.ts} (100%) diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts index b8a47229ab5..df823592378 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts @@ -1,7 +1,6 @@ import { Injectable, UnauthorizedException } from '@nestjs/common'; import { PassportStrategy } from '@nestjs/passport'; -import { System, User } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, System, User } from '@shared/domain'; import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { ErrorLoggable } from '@src/core/error/loggable/error.loggable'; import { Logger } from '@src/core/logger'; diff --git a/apps/server/src/modules/oauth/service/oauth.service.ts b/apps/server/src/modules/oauth/service/oauth.service.ts index 144aa691156..d17dca6c734 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.ts @@ -1,9 +1,7 @@ import { Configuration } from '@hpi-schul-cloud/commons'; import { Inject } from '@nestjs/common'; import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator'; -import { EntityId, OauthConfig, SchoolFeatures } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { EntityId, LegacySchoolDo, OauthConfig, SchoolFeatures, UserDO } from '@shared/domain'; import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encryption'; import { LegacyLogger } from '@src/core/logger'; import { ProvisioningService } from '@src/modules/provisioning'; diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.ts b/apps/server/src/modules/oauth/uc/oauth.uc.ts index 2b728e35bba..2607f7b708f 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.ts @@ -1,7 +1,5 @@ import { Injectable, UnauthorizedException, UnprocessableEntityException } from '@nestjs/common'; -import { EntityId } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { EntityId, LegacySchoolDo, UserDO } from '@shared/domain'; import { ISession } from '@shared/domain/types/session'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts index 7004bd24534..ff2373e3765 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv-do.mapper.ts @@ -1,6 +1,4 @@ -import { RoleName } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, RoleName, UserDO } from '@shared/domain'; import { ExternalSchoolDto, ExternalUserDto } from '../../dto'; export class IservMapper { diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts index 3922a2e7eed..d2072ec1836 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts @@ -1,8 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { RoleName, User } from '@shared/domain'; -import { RoleReference } from '@shared/domain/domainobject'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, RoleName, RoleReference, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { LegacySchoolService } from '@src/modules/school'; diff --git a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts index 553f9a70e2b..a67d4233260 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, UserDO } from '@shared/domain'; import { OauthDataDto, ProvisioningDto } from '../../dto'; import { ProvisioningStrategy } from '../base.strategy'; import { OidcProvisioningService } from './service/oidc-provisioning.service'; diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts index 987280b0998..4d4e5446990 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts @@ -1,8 +1,13 @@ import { Injectable, UnprocessableEntityException } from '@nestjs/common'; -import { EntityId, FederalState, SchoolFeatures, SchoolYear } from '@shared/domain'; -import { RoleReference } from '@shared/domain/domainobject'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { + EntityId, + FederalState, + LegacySchoolDo, + RoleReference, + SchoolFeatures, + SchoolYear, + UserDO, +} from '@shared/domain'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; diff --git a/apps/server/src/modules/school/service/legacy-school.service.ts b/apps/server/src/modules/school/service/legacy-school.service.ts index e0de637d310..588084d0864 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.ts @@ -1,6 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { EntityId, SchoolFeatures } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { EntityId, LegacySchoolDo, SchoolFeatures } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; import { SchoolValidationService } from './validation'; diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.ts b/apps/server/src/modules/user-import/uc/user-import.uc.ts index b09d21e2542..7121b2c7b27 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.ts @@ -1,3 +1,4 @@ +import { Configuration } from '@hpi-schul-cloud/commons'; import { BadRequestException, ForbiddenException, Injectable, InternalServerErrorException } from '@nestjs/common'; import { UserAlreadyAssignedToImportUserError } from '@shared/common'; import { @@ -6,8 +7,9 @@ import { EntityId, IFindOptions, IImportUserScope, - INameMatch, ImportUser, + INameMatch, + LegacySchoolDo, MatchCreator, MatchCreatorScope, Permission, @@ -15,9 +17,6 @@ import { System, User, } from '@shared/domain'; - -import { Configuration } from '@hpi-schul-cloud/commons'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { Logger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts index 040ed4300ba..ec39a619ef7 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts @@ -1,7 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { EntityId, UserLoginMigrationDO } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { EntityId, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts index 84a3de00062..8e094e36368 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts @@ -6,8 +6,7 @@ import { NotFoundException, UnprocessableEntityException, } from '@nestjs/common'; -import { UserLoginMigrationDO } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; import { LegacyLogger } from '@src/core/logger'; diff --git a/apps/server/src/shared/domain/domainobject/index.ts b/apps/server/src/shared/domain/domainobject/index.ts index 3c7fe469b5e..6459619c2e6 100644 --- a/apps/server/src/shared/domain/domainobject/index.ts +++ b/apps/server/src/shared/domain/domainobject/index.ts @@ -3,7 +3,7 @@ export * from './pseudonym.do'; export * from './video-conference.do'; export * from './board'; export * from './user-login-migration.do'; -export * from './school.do'; +export * from './legacy-school.do'; export * from './user.do'; export * from './page'; export * from './role-reference'; diff --git a/apps/server/src/shared/domain/domainobject/school.do.ts b/apps/server/src/shared/domain/domainobject/legacy-school.do.ts similarity index 100% rename from apps/server/src/shared/domain/domainobject/school.do.ts rename to apps/server/src/shared/domain/domainobject/legacy-school.do.ts diff --git a/apps/server/src/shared/domain/rules/school.rule.ts b/apps/server/src/shared/domain/rules/school.rule.ts index ff228f0db90..4367dc20ca3 100644 --- a/apps/server/src/shared/domain/rules/school.rule.ts +++ b/apps/server/src/shared/domain/rules/school.rule.ts @@ -1,5 +1,5 @@ import { Injectable } from '@nestjs/common'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain'; import { School, User } from '@shared/domain/entity'; import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { AuthorizationContext, Rule } from '@src/modules/authorization/types'; diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.ts b/apps/server/src/shared/repo/school/legacy-school.repo.ts index e3abfb97900..dbcf503a6e0 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.ts @@ -1,8 +1,7 @@ import { EntityName } from '@mikro-orm/core'; import { EntityManager } from '@mikro-orm/mongodb'; import { Injectable, InternalServerErrorException } from '@nestjs/common'; -import { EntityId, ISchoolProperties, School, System, UserLoginMigration } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { EntityId, ISchoolProperties, LegacySchoolDo, School, System, UserLoginMigration } from '@shared/domain'; import { LegacyLogger } from '@src/core/logger'; import { BaseDORepo } from '../base.do.repo'; diff --git a/apps/server/src/shared/testing/factory/domainobject/school.factory.ts b/apps/server/src/shared/testing/factory/domainobject/school.factory.ts index a8a0396dd7a..95377b815c8 100644 --- a/apps/server/src/shared/testing/factory/domainobject/school.factory.ts +++ b/apps/server/src/shared/testing/factory/domainobject/school.factory.ts @@ -1,4 +1,4 @@ -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain'; import { federalStateFactory } from '../federal-state.factory'; import { schoolYearFactory } from '../schoolyear.factory'; import { DoBaseFactory } from './do-base.factory'; From 366d10aeb3bbeb7b236a07de47a31d8a750f75c9 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 11:19:30 +0200 Subject: [PATCH 09/29] Add deprecation markers --- .../server/src/modules/school/service/legacy-school.service.ts | 3 +++ apps/server/src/modules/school/uc/legacy-school.uc.ts | 3 +++ apps/server/src/shared/domain/domainobject/legacy-school.do.ts | 3 +++ apps/server/src/shared/repo/school/legacy-school.repo.ts | 3 +++ 4 files changed, 12 insertions(+) diff --git a/apps/server/src/modules/school/service/legacy-school.service.ts b/apps/server/src/modules/school/service/legacy-school.service.ts index 588084d0864..1ed43fd5f07 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.ts @@ -3,6 +3,9 @@ import { EntityId, LegacySchoolDo, SchoolFeatures } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; import { SchoolValidationService } from './validation'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @Injectable() export class LegacySchoolService { constructor( diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.ts b/apps/server/src/modules/school/uc/legacy-school.uc.ts index 43174c40a6e..57a004a441e 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.ts @@ -9,6 +9,9 @@ import { import { LegacySchoolService } from '../service'; import { OauthMigrationDto } from './dto/oauth-migration.dto'; +/** + * @deprecated because it uses the deprecated LegacySchoolService. + */ @Injectable() export class LegacySchoolUc { constructor( diff --git a/apps/server/src/shared/domain/domainobject/legacy-school.do.ts b/apps/server/src/shared/domain/domainobject/legacy-school.do.ts index bb6827fa7a5..5ac496a04c4 100644 --- a/apps/server/src/shared/domain/domainobject/legacy-school.do.ts +++ b/apps/server/src/shared/domain/domainobject/legacy-school.do.ts @@ -2,6 +2,9 @@ import { FederalState, SchoolFeatures, SchoolYear } from '@shared/domain/entity' import { EntityId } from '@shared/domain/types'; import { BaseDO } from './base.do'; +/** + * @deprecated because it extends the deprecated BaseDO. + */ export class LegacySchoolDo extends BaseDO { externalId?: string; diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.ts b/apps/server/src/shared/repo/school/legacy-school.repo.ts index dbcf503a6e0..f305d145125 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.ts @@ -5,6 +5,9 @@ import { EntityId, ISchoolProperties, LegacySchoolDo, School, System, UserLoginM import { LegacyLogger } from '@src/core/logger'; import { BaseDORepo } from '../base.do.repo'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @Injectable() export class LegacySchoolRepo extends BaseDORepo { constructor(protected readonly _em: EntityManager, protected readonly logger: LegacyLogger) { From de82018aafcc2f030a0be241b774dc928dcb12b5 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Wed, 30 Aug 2023 14:13:36 +0200 Subject: [PATCH 10/29] Fix imports in tests --- .../authentication/strategy/ldap.strategy.spec.ts | 3 +-- .../src/modules/oauth/service/oauth.service.spec.ts | 3 +-- apps/server/src/modules/oauth/uc/oauth.uc.spec.ts | 3 +-- .../strategy/iserv/iserv.strategy.spec.ts | 4 +--- .../strategy/oidc/oidc.strategy.spec.ts | 6 ++---- .../oidc/service/oidc-provisioning.service.spec.ts | 3 +-- .../school/service/legacy-school.service.spec.ts | 3 +-- .../src/modules/school/uc/legacy-school.uc.spec.ts | 3 +-- .../modules/user-import/uc/user-import.uc.spec.ts | 6 +++--- .../service/school-migration.service.spec.ts | 5 +---- .../src/shared/domain/rules/school.rule.spec.ts | 2 +- .../school/legacy-school.repo.integration.spec.ts | 13 ++++++++----- apps/server/src/shared/testing/factory/index.ts | 1 + 13 files changed, 23 insertions(+), 32 deletions(-) diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts index 4f93c9447d4..8de451dc606 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -2,8 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnauthorizedException } from '@nestjs/common'; import { PassportModule } from '@nestjs/passport'; import { Test, TestingModule } from '@nestjs/testing'; -import { RoleName, System, User } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, RoleName, System, User } from '@shared/domain'; import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { accountDtoFactory, diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index c16c25cb37a..ca40f5b4969 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -1,8 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Configuration } from '@hpi-schul-cloud/commons'; import { Test, TestingModule } from '@nestjs/testing'; -import { OauthConfig, SchoolFeatures, System } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, OauthConfig, SchoolFeatures, System } from '@shared/domain'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { DefaultEncryptionService, IEncryptionService, SymetricKeyEncryptionService } from '@shared/infra/encryption'; diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index 0eb0841ce7c..6e16d2ab779 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -1,8 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnauthorizedException, UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { ISession } from '@shared/domain/types/session'; import { schoolDOFactory, setupEntities } from '@shared/testing'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index 0d7100a8845..c75e975845e 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -1,9 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ObjectId } from '@mikro-orm/mongodb'; import { Test, TestingModule } from '@nestjs/testing'; -import { RoleName, User } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, RoleName, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; diff --git a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts index e8750cdab37..e14a69bb822 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts @@ -1,11 +1,9 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { NotImplementedException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { RoleName } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, RoleName, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; -import { userDoFactory, schoolDOFactory } from '@shared/testing'; +import { schoolDOFactory, userDoFactory } from '@shared/testing'; import { ExternalSchoolDto, ExternalUserDto, diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index 7dc79b5ab79..d6cd4cafab0 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -1,8 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { RoleName, SchoolFeatures } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, RoleName, SchoolFeatures } from '@shared/domain'; import { UserDO } from '@shared/domain/domainobject/user.do'; import { federalStateFactory, schoolDOFactory, userDoFactory } from '@shared/testing'; import { schoolYearFactory } from '@shared/testing/factory/schoolyear.factory'; diff --git a/apps/server/src/modules/school/service/legacy-school.service.spec.ts b/apps/server/src/modules/school/service/legacy-school.service.spec.ts index ab4ce387777..2f90bf234a2 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.spec.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.spec.ts @@ -1,7 +1,6 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; -import { SchoolFeatures } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, SchoolFeatures } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; import { schoolDOFactory, setupEntities } from '@shared/testing'; import { LegacySchoolService } from './legacy-school.service'; diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts index 0b5ff4be07a..9a916244756 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts @@ -1,8 +1,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { UserLoginMigrationDO } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school/service'; diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index 2e46b9d0c11..c2f1838e991 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -2,10 +2,12 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Configuration } from '@hpi-schul-cloud/commons'; import { ObjectId } from '@mikro-orm/mongodb'; import { BadRequestException, ForbiddenException } from '@nestjs/common'; +import { ConfigModule } from '@nestjs/config'; import { Test, TestingModule } from '@nestjs/testing'; import { UserAlreadyAssignedToImportUserError } from '@shared/common'; import { ImportUser, + LegacySchoolDo, MatchCreator, MatchCreatorScope, Permission, @@ -14,15 +16,13 @@ import { System, User, } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { MongoMemoryDatabaseModule } from '@shared/infra/database'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { federalStateFactory, importUserFactory, schoolFactory, userFactory } from '@shared/testing'; import { systemFactory } from '@shared/testing/factory/system.factory'; +import { LoggerModule } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { LoggerModule } from '@src/core/logger'; -import { ConfigModule } from '@nestjs/config'; import { LegacySchoolService } from '../../school'; import { LdapAlreadyPersistedException, diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index ee7ec16b9bc..c595b6d6378 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -3,10 +3,7 @@ import { ObjectId } from '@mikro-orm/mongodb'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { ValidationError } from '@shared/common'; -import { UserLoginMigrationDO } from '@shared/domain'; -import { Page } from '@shared/domain/domainobject/page'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; -import { UserDO } from '@shared/domain/domainobject/user.do'; +import { LegacySchoolDo, Page, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; import { setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; diff --git a/apps/server/src/shared/domain/rules/school.rule.spec.ts b/apps/server/src/shared/domain/rules/school.rule.spec.ts index 13f221de519..7c86d934d82 100644 --- a/apps/server/src/shared/domain/rules/school.rule.spec.ts +++ b/apps/server/src/shared/domain/rules/school.rule.spec.ts @@ -1,5 +1,5 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; +import { LegacySchoolDo } from '@shared/domain'; import { Role, School, User } from '@shared/domain/entity'; import { Permission } from '@shared/domain/interface'; import { roleFactory, schoolDOFactory, schoolFactory, setupEntities, userFactory } from '@shared/testing'; diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts index 3720ae383aa..df5c26e9581 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts @@ -5,6 +5,7 @@ import { InternalServerErrorException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { ISchoolProperties, + LegacySchoolDo, School, SchoolRolePermission, SchoolRoles, @@ -12,13 +13,15 @@ import { System, UserLoginMigration, } from '@shared/domain'; -import { LegacySchoolDo } from '@shared/domain/domainobject/school.do'; import { MongoMemoryDatabaseModule } from '@shared/infra/database'; -import { schoolFactory, systemFactory } from '@shared/testing'; -import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; -import { schoolYearFactory } from '@shared/testing/factory/schoolyear.factory'; +import { + schoolDOFactory, + schoolFactory, + schoolYearFactory, + systemFactory, + userLoginMigrationFactory, +} from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; -import { userLoginMigrationFactory } from '@shared/testing/factory/user-login-migration.factory'; import { LegacySchoolRepo } from '..'; describe('LegacySchoolRepo', () => { diff --git a/apps/server/src/shared/testing/factory/index.ts b/apps/server/src/shared/testing/factory/index.ts index 0b29d4e5136..7c2834d9c67 100644 --- a/apps/server/src/shared/testing/factory/index.ts +++ b/apps/server/src/shared/testing/factory/index.ts @@ -16,6 +16,7 @@ export * from './news.factory'; export * from './role.factory'; export * from './school-external-tool-entity.factory'; export * from './school.factory'; +export * from './schoolyear.factory'; export * from './share-token.do.factory'; export * from './storageprovider.factory'; export * from './submission.factory'; From 7fe3f8508507db6eba777c6e765ee1ff45810f4b Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Thu, 31 Aug 2023 11:34:02 +0200 Subject: [PATCH 11/29] Update and rename SchoolRule --- .../authorization/rule-manager.spec.ts | 16 ++--- .../src/modules/authorization/rule-manager.ts | 6 +- apps/server/src/shared/domain/rules/index.ts | 4 +- .../shared/domain/rules/school.rule.spec.ts | 63 ++++++++++--------- .../src/shared/domain/rules/school.rule.ts | 16 +++-- 5 files changed, 58 insertions(+), 47 deletions(-) diff --git a/apps/server/src/modules/authorization/rule-manager.spec.ts b/apps/server/src/modules/authorization/rule-manager.spec.ts index f7bd1edde5c..0a2b90c7639 100644 --- a/apps/server/src/modules/authorization/rule-manager.spec.ts +++ b/apps/server/src/modules/authorization/rule-manager.spec.ts @@ -8,7 +8,7 @@ import { CourseRule, LessonRule, SchoolExternalToolRule, - SchoolRule, + LegacySchoolRule, SubmissionRule, TaskRule, TeamRule, @@ -24,7 +24,7 @@ describe('RuleManager', () => { let courseRule: DeepMocked; let courseGroupRule: DeepMocked; let lessonRule: DeepMocked; - let schoolRule: DeepMocked; + let legacySchoolRule: DeepMocked; let userRule: DeepMocked; let taskRule: DeepMocked; let teamRule: DeepMocked; @@ -43,7 +43,7 @@ describe('RuleManager', () => { { provide: CourseRule, useValue: createMock() }, { provide: CourseGroupRule, useValue: createMock() }, { provide: LessonRule, useValue: createMock() }, - { provide: SchoolRule, useValue: createMock() }, + { provide: LegacySchoolRule, useValue: createMock() }, { provide: UserRule, useValue: createMock() }, { provide: TaskRule, useValue: createMock() }, { provide: TeamRule, useValue: createMock() }, @@ -59,7 +59,7 @@ describe('RuleManager', () => { courseRule = await module.get(CourseRule); courseGroupRule = await module.get(CourseGroupRule); lessonRule = await module.get(LessonRule); - schoolRule = await module.get(SchoolRule); + legacySchoolRule = await module.get(LegacySchoolRule); userRule = await module.get(UserRule); taskRule = await module.get(TaskRule); teamRule = await module.get(TeamRule); @@ -89,7 +89,7 @@ describe('RuleManager', () => { courseRule.isApplicable.mockReturnValueOnce(true); courseGroupRule.isApplicable.mockReturnValueOnce(false); lessonRule.isApplicable.mockReturnValueOnce(false); - schoolRule.isApplicable.mockReturnValueOnce(false); + legacySchoolRule.isApplicable.mockReturnValueOnce(false); userRule.isApplicable.mockReturnValueOnce(false); taskRule.isApplicable.mockReturnValueOnce(false); teamRule.isApplicable.mockReturnValueOnce(false); @@ -110,7 +110,7 @@ describe('RuleManager', () => { expect(courseRule.isApplicable).toBeCalled(); expect(courseGroupRule.isApplicable).toBeCalled(); expect(lessonRule.isApplicable).toBeCalled(); - expect(schoolRule.isApplicable).toBeCalled(); + expect(legacySchoolRule.isApplicable).toBeCalled(); expect(userRule.isApplicable).toBeCalled(); expect(taskRule.isApplicable).toBeCalled(); expect(teamRule.isApplicable).toBeCalled(); @@ -139,7 +139,7 @@ describe('RuleManager', () => { courseRule.isApplicable.mockReturnValueOnce(false); courseGroupRule.isApplicable.mockReturnValueOnce(false); lessonRule.isApplicable.mockReturnValueOnce(false); - schoolRule.isApplicable.mockReturnValueOnce(false); + legacySchoolRule.isApplicable.mockReturnValueOnce(false); userRule.isApplicable.mockReturnValueOnce(false); taskRule.isApplicable.mockReturnValueOnce(false); teamRule.isApplicable.mockReturnValueOnce(false); @@ -168,7 +168,7 @@ describe('RuleManager', () => { courseRule.isApplicable.mockReturnValueOnce(true); courseGroupRule.isApplicable.mockReturnValueOnce(true); lessonRule.isApplicable.mockReturnValueOnce(false); - schoolRule.isApplicable.mockReturnValueOnce(false); + legacySchoolRule.isApplicable.mockReturnValueOnce(false); userRule.isApplicable.mockReturnValueOnce(false); taskRule.isApplicable.mockReturnValueOnce(false); teamRule.isApplicable.mockReturnValueOnce(false); diff --git a/apps/server/src/modules/authorization/rule-manager.ts b/apps/server/src/modules/authorization/rule-manager.ts index 8d0fa8a629d..3aece68402a 100644 --- a/apps/server/src/modules/authorization/rule-manager.ts +++ b/apps/server/src/modules/authorization/rule-manager.ts @@ -7,7 +7,7 @@ import { CourseRule, LessonRule, SchoolExternalToolRule, - SchoolRule, + LegacySchoolRule, SubmissionRule, TaskRule, TeamRule, @@ -25,7 +25,7 @@ export class RuleManager { private readonly courseRule: CourseRule, private readonly courseGroupRule: CourseGroupRule, private readonly lessonRule: LessonRule, - private readonly schoolRule: SchoolRule, + private readonly legaySchoolRule: LegacySchoolRule, private readonly taskRule: TaskRule, private readonly userRule: UserRule, private readonly teamRule: TeamRule, @@ -42,7 +42,7 @@ export class RuleManager { this.taskRule, this.teamRule, this.userRule, - this.schoolRule, + this.legaySchoolRule, this.submissionRule, this.schoolExternalToolRule, this.boardDoRule, diff --git a/apps/server/src/shared/domain/rules/index.ts b/apps/server/src/shared/domain/rules/index.ts index ea72f8b4d0a..1de884f21f9 100644 --- a/apps/server/src/shared/domain/rules/index.ts +++ b/apps/server/src/shared/domain/rules/index.ts @@ -4,7 +4,7 @@ import { CourseGroupRule } from './course-group.rule'; import { CourseRule } from './course.rule'; import { LessonRule } from './lesson.rule'; import { SchoolExternalToolRule } from './school-external-tool.rule'; -import { SchoolRule } from './school.rule'; +import { LegacySchoolRule } from './school.rule'; import { SubmissionRule } from './submission.rule'; import { TaskRule } from './task.rule'; import { TeamRule } from './team.rule'; @@ -27,7 +27,7 @@ export const ALL_RULES = [ LessonRule, CourseRule, CourseGroupRule, - SchoolRule, + LegacySchoolRule, SubmissionRule, TaskRule, TeamRule, diff --git a/apps/server/src/shared/domain/rules/school.rule.spec.ts b/apps/server/src/shared/domain/rules/school.rule.spec.ts index 7c86d934d82..cb5f92d455a 100644 --- a/apps/server/src/shared/domain/rules/school.rule.spec.ts +++ b/apps/server/src/shared/domain/rules/school.rule.spec.ts @@ -1,18 +1,14 @@ import { Test, TestingModule } from '@nestjs/testing'; -import { LegacySchoolDo } from '@shared/domain'; -import { Role, School, User } from '@shared/domain/entity'; import { Permission } from '@shared/domain/interface'; -import { roleFactory, schoolDOFactory, schoolFactory, setupEntities, userFactory } from '@shared/testing'; +import { roleFactory, schoolDOFactory, setupEntities, userFactory } from '@shared/testing'; import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { Action } from '@src/modules/authorization/types'; -import { SchoolRule } from './school.rule'; +import { ObjectID } from 'bson'; +import { LegacySchoolRule } from './school.rule'; -describe('SchoolRule', () => { - let service: SchoolRule; +describe('LegacySchoolRule', () => { + let service: LegacySchoolRule; let authorizationHelper: AuthorizationHelper; - let user: User; - let entity: School | LegacySchoolDo; - let role: Role; const permissionA = 'a' as Permission; const permissionB = 'b' as Permission; const permissionC = 'c' as Permission; @@ -21,44 +17,55 @@ describe('SchoolRule', () => { await setupEntities(); const module: TestingModule = await Test.createTestingModule({ - providers: [AuthorizationHelper, SchoolRule], + providers: [AuthorizationHelper, LegacySchoolRule], }).compile(); - service = await module.get(SchoolRule); + service = await module.get(LegacySchoolRule); authorizationHelper = await module.get(AuthorizationHelper); }); - beforeEach(() => { - role = roleFactory.build({ permissions: [permissionA, permissionB] }); - user = userFactory.build({ roles: [role] }); - }); + const setupSchoolAndUser = () => { + const school = schoolDOFactory.build({ id: new ObjectID().toString() }); + const role = roleFactory.build({ permissions: [permissionA, permissionB] }); + const user = userFactory.build({ + roles: [role], + school: { id: school.id }, + }); + + return { school, user }; + }; it('should call hasAllPermissions on AuthorizationHelper', () => { - entity = schoolFactory.build(); - user = userFactory.build({ roles: [role], school: entity }); + const { school, user } = setupSchoolAndUser(); const spy = jest.spyOn(authorizationHelper, 'hasAllPermissions'); - service.hasPermission(user, entity, { action: Action.read, requiredPermissions: [] }); + + service.hasPermission(user, school, { action: Action.read, requiredPermissions: [] }); + expect(spy).toBeCalledWith(user, []); }); it('should return "true" if user in scope', () => { - entity = schoolFactory.build(); - user = userFactory.build({ roles: [role], school: entity }); - const res = service.hasPermission(user, entity, { action: Action.read, requiredPermissions: [] }); + const { school, user } = setupSchoolAndUser(); + + const res = service.hasPermission(user, school, { action: Action.read, requiredPermissions: [] }); + expect(res).toBe(true); }); it('should return "false" if user has not permission', () => { - entity = schoolFactory.build(); - user = userFactory.build({ roles: [role], school: entity }); - const res = service.hasPermission(user, entity, { action: Action.read, requiredPermissions: [permissionC] }); + const { school, user } = setupSchoolAndUser(); + + const res = service.hasPermission(user, school, { action: Action.read, requiredPermissions: [permissionC] }); + expect(res).toBe(false); }); - it('should return "false" if user has not some school', () => { - entity = schoolDOFactory.build({ name: 'testschool', id: 'invalidId' }); - user = userFactory.build({ roles: [role] }); - const res = service.hasPermission(user, entity, { action: Action.read, requiredPermissions: [permissionA] }); + it('should return "false" if user has not same school', () => { + const { user } = setupSchoolAndUser(); + const school = schoolDOFactory.build(); + + const res = service.hasPermission(user, school, { action: Action.read, requiredPermissions: [permissionA] }); + expect(res).toBe(false); }); }); diff --git a/apps/server/src/shared/domain/rules/school.rule.ts b/apps/server/src/shared/domain/rules/school.rule.ts index 4367dc20ca3..b17185b3bb1 100644 --- a/apps/server/src/shared/domain/rules/school.rule.ts +++ b/apps/server/src/shared/domain/rules/school.rule.ts @@ -1,20 +1,24 @@ import { Injectable } from '@nestjs/common'; -import { LegacySchoolDo } from '@shared/domain'; -import { School, User } from '@shared/domain/entity'; +import { BaseDO, LegacySchoolDo } from '@shared/domain'; +import { User } from '@shared/domain/entity'; import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { AuthorizationContext, Rule } from '@src/modules/authorization/types'; +import { AuthorizableObject } from '../domain-object'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @Injectable() -export class SchoolRule implements Rule { +export class LegacySchoolRule implements Rule { constructor(private readonly authorizationHelper: AuthorizationHelper) {} - public isApplicable(user: User, entity: School | LegacySchoolDo): boolean { - const isMatched: boolean = entity instanceof School || entity instanceof LegacySchoolDo; + public isApplicable(user: User, entity: AuthorizableObject | BaseDO): boolean { + const isMatched: boolean = entity instanceof LegacySchoolDo; return isMatched; } - public hasPermission(user: User, entity: School | LegacySchoolDo, context: AuthorizationContext): boolean { + public hasPermission(user: User, entity: LegacySchoolDo, context: AuthorizationContext): boolean { const hasPermission: boolean = this.authorizationHelper.hasAllPermissions(user, context.requiredPermissions) && user.school.id === entity.id; From 66d3a6632ba57f4fcc52cd6f58f4acd8fb406b1f Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Thu, 31 Aug 2023 11:40:20 +0200 Subject: [PATCH 12/29] Rename school rule files --- apps/server/src/shared/domain/rules/index.ts | 4 ++-- .../rules/{school.rule.spec.ts => legacy-school.rule.spec.ts} | 2 +- .../domain/rules/{school.rule.ts => legacy-school.rule.ts} | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename apps/server/src/shared/domain/rules/{school.rule.spec.ts => legacy-school.rule.spec.ts} (97%) rename apps/server/src/shared/domain/rules/{school.rule.ts => legacy-school.rule.ts} (100%) diff --git a/apps/server/src/shared/domain/rules/index.ts b/apps/server/src/shared/domain/rules/index.ts index 1de884f21f9..888b2ee8501 100644 --- a/apps/server/src/shared/domain/rules/index.ts +++ b/apps/server/src/shared/domain/rules/index.ts @@ -4,7 +4,7 @@ import { CourseGroupRule } from './course-group.rule'; import { CourseRule } from './course.rule'; import { LessonRule } from './lesson.rule'; import { SchoolExternalToolRule } from './school-external-tool.rule'; -import { LegacySchoolRule } from './school.rule'; +import { LegacySchoolRule } from './legacy-school.rule'; import { SubmissionRule } from './submission.rule'; import { TaskRule } from './task.rule'; import { TeamRule } from './team.rule'; @@ -16,7 +16,7 @@ export * from './course-group.rule'; export * from './course.rule'; export * from './lesson.rule'; export * from './school-external-tool.rule'; -export * from './school.rule'; +export * from './legacy-school.rule'; export * from './submission.rule'; export * from './task.rule'; export * from './team.rule'; diff --git a/apps/server/src/shared/domain/rules/school.rule.spec.ts b/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts similarity index 97% rename from apps/server/src/shared/domain/rules/school.rule.spec.ts rename to apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts index cb5f92d455a..ef19b08567c 100644 --- a/apps/server/src/shared/domain/rules/school.rule.spec.ts +++ b/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts @@ -4,7 +4,7 @@ import { roleFactory, schoolDOFactory, setupEntities, userFactory } from '@share import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { Action } from '@src/modules/authorization/types'; import { ObjectID } from 'bson'; -import { LegacySchoolRule } from './school.rule'; +import { LegacySchoolRule } from './legacy-school.rule'; describe('LegacySchoolRule', () => { let service: LegacySchoolRule; diff --git a/apps/server/src/shared/domain/rules/school.rule.ts b/apps/server/src/shared/domain/rules/legacy-school.rule.ts similarity index 100% rename from apps/server/src/shared/domain/rules/school.rule.ts rename to apps/server/src/shared/domain/rules/legacy-school.rule.ts From 0e9f23c7a501dae1bf8154dfd92b0bcff38d5b63 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Thu, 31 Aug 2023 11:57:46 +0200 Subject: [PATCH 13/29] Rename schoolDOFactory --- .../strategy/ldap.strategy.spec.ts | 18 +++++------ .../oauth/service/oauth.service.spec.ts | 8 ++--- .../src/modules/oauth/uc/oauth.uc.spec.ts | 4 +-- .../strategy/iserv/iserv.strategy.spec.ts | 4 +-- .../strategy/oidc/oidc.strategy.spec.ts | 4 +-- .../service/oidc-provisioning.service.spec.ts | 6 ++-- .../service/legacy-school.service.spec.ts | 16 +++++----- .../school-validation.service.spec.ts | 12 +++---- .../school/uc/legacy-school.uc.spec.ts | 16 +++++----- .../common/uc/tool-permissions-helper.spec.ts | 9 ++++-- ...external-tool-authorizable.service.spec.ts | 4 +-- .../context-external-tool.service.spec.ts | 4 +-- .../strategy/abstract-launch.strategy.spec.ts | 6 ++-- .../service/migration-check.service.spec.ts | 10 +++--- .../service/school-migration.service.spec.ts | 14 ++++---- .../user-login-migration.service.spec.ts | 32 +++++++++---------- .../service/user-migration.service.spec.ts | 4 +-- .../restart-user-login-migration.uc.spec.ts | 12 +++---- .../uc/start-user-login-migration.uc.spec.ts | 12 +++---- .../uc/toggle-user-login-migration.uc.spec.ts | 14 ++++---- .../uc/user-login-migration.uc.spec.ts | 10 +++--- .../domain/rules/legacy-school.rule.spec.ts | 6 ++-- .../legacy-school.repo.integration.spec.ts | 10 +++--- .../factory/domainobject/school.factory.ts | 4 +-- 24 files changed, 122 insertions(+), 117 deletions(-) diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts index 8de451dc606..4815921ca1b 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -8,7 +8,7 @@ import { accountDtoFactory, defaultTestPassword, defaultTestPasswordHash, - schoolDOFactory, + legacySchoolDoFactory, schoolFactory, setupEntities, systemFactory, @@ -91,7 +91,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: undefined }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -138,7 +138,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [] }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -185,7 +185,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: undefined }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: undefined }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -232,7 +232,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -279,7 +279,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -331,7 +331,7 @@ describe('LdapStrategy', () => { const user: User = userFactory.withRoleByName(RoleName.STUDENT).buildWithId({ ldapDn: 'mockLdapDn' }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [system.id] }, user.school.id); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [system.id] }, user.school.id); const account: AccountDto = accountDtoFactory.build({ systemId: system.id, @@ -388,7 +388,7 @@ describe('LdapStrategy', () => { .withRoleByName(RoleName.STUDENT) .buildWithId({ ldapDn: 'mockLdapDn', school: schoolFactory.buildWithId() }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId( { systems: [system.id], previousExternalId: undefined }, user.school.id ); @@ -450,7 +450,7 @@ describe('LdapStrategy', () => { .withRoleByName(RoleName.STUDENT) .buildWithId({ ldapDn: 'mockLdapDn', school: schoolFactory.buildWithId() }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId( { systems: [system.id], previousExternalId: 'previousExternalId' }, user.school.id ); diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index ca40f5b4969..a63e9f2b8a5 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -6,7 +6,7 @@ import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { DefaultEncryptionService, IEncryptionService, SymetricKeyEncryptionService } from '@shared/infra/encryption'; import { setupEntities, userDoFactory } from '@shared/testing'; -import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; +import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; import { systemFactory } from '@shared/testing/factory/system.factory'; import { LegacyLogger } from '@src/core/logger'; import { ProvisioningDto, ProvisioningService } from '@src/modules/provisioning'; @@ -426,7 +426,7 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); @@ -468,7 +468,7 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [] }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: [] }); provisioningService.getData.mockResolvedValue(oauthData); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); @@ -514,7 +514,7 @@ describe('OAuthService', () => { officialSchoolNumber: 'officialSchoolNumber', }), }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: [] }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: [] }); provisioningService.getData.mockResolvedValue(oauthData); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index a7db2b48d38..bad68fa190f 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { ISession } from '@shared/domain/types/session'; -import { schoolDOFactory, setupEntities } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; import { AuthenticationService } from '@src/modules/authentication/services/authentication.service'; @@ -658,7 +658,7 @@ describe('OAuthUc', () => { oauthService.requestToken.mockResolvedValue(tokenDto); provisioningService.getData.mockResolvedValue(oauthData); - const schoolToMigrate: LegacySchoolDo | void = schoolDOFactory.build({ name: 'mockName' }); + const schoolToMigrate: LegacySchoolDo | void = legacySchoolDoFactory.build({ name: 'mockName' }); oauthService.authenticateUser.mockResolvedValue(tokenDto); schoolMigrationService.schoolToMigrate.mockResolvedValue(schoolToMigrate); userMigrationService.migrateUser.mockResolvedValue(userMigrationDto); diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index c75e975845e..b48d4c9a30e 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, RoleName, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; -import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; +import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; @@ -90,7 +90,7 @@ describe('IservProvisioningStrategy', () => { const user: UserDO = userDoFactory.withRoles([{ id: 'roleId', name: RoleName.STUDENT }]).buildWithId({ externalId: userUUID, }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ externalId: 'schoolExternalId' }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ externalId: 'schoolExternalId' }); const roleDto: RoleDto = new RoleDto({ name: RoleName.STUDENT, }); diff --git a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts index e14a69bb822..c1442d37b65 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/oidc.strategy.spec.ts @@ -3,7 +3,7 @@ import { NotImplementedException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, RoleName, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; -import { schoolDOFactory, userDoFactory } from '@shared/testing'; +import { legacySchoolDoFactory, userDoFactory } from '@shared/testing'; import { ExternalSchoolDto, ExternalUserDto, @@ -76,7 +76,7 @@ describe('OidcStrategy', () => { schoolId: 'schoolId', externalId: externalUserId, }); - const school: LegacySchoolDo = schoolDOFactory.build({ + const school: LegacySchoolDo = legacySchoolDoFactory.build({ id: schoolId, name: 'schoolName', externalId: externalSchoolId, diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index d6cd4cafab0..a33735b2084 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -3,7 +3,7 @@ import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, RoleName, SchoolFeatures } from '@shared/domain'; import { UserDO } from '@shared/domain/domainobject/user.do'; -import { federalStateFactory, schoolDOFactory, userDoFactory } from '@shared/testing'; +import { federalStateFactory, legacySchoolDoFactory, userDoFactory } from '@shared/testing'; import { schoolYearFactory } from '@shared/testing/factory/schoolyear.factory'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; @@ -84,7 +84,7 @@ describe('OidcProvisioningService', () => { name: 'name', officialSchoolNumber: 'officialSchoolNumber', }); - const savedSchoolDO = schoolDOFactory.build({ + const savedSchoolDO = legacySchoolDoFactory.build({ id: 'schoolId', externalId: 'externalId', name: 'name', @@ -92,7 +92,7 @@ describe('OidcProvisioningService', () => { systems: [systemId], features: [SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); - const existingSchoolDO = schoolDOFactory.build({ + const existingSchoolDO = legacySchoolDoFactory.build({ id: 'schoolId', externalId: 'externalId', name: 'existingName', diff --git a/apps/server/src/modules/school/service/legacy-school.service.spec.ts b/apps/server/src/modules/school/service/legacy-school.service.spec.ts index 2f90bf234a2..57cc3c6f1ee 100644 --- a/apps/server/src/modules/school/service/legacy-school.service.spec.ts +++ b/apps/server/src/modules/school/service/legacy-school.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, SchoolFeatures } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; -import { schoolDOFactory, setupEntities } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities } from '@shared/testing'; import { LegacySchoolService } from './legacy-school.service'; import { SchoolValidationService } from './validation/school-validation.service'; @@ -41,7 +41,7 @@ describe('LegacySchoolService', () => { const setupOld = () => { const systems: string[] = ['systemId']; - const schoolSaved: LegacySchoolDo = schoolDOFactory.build({ + const schoolSaved: LegacySchoolDo = legacySchoolDoFactory.build({ id: 'testId', name: 'schoolName', externalId: 'externalId', @@ -49,7 +49,7 @@ describe('LegacySchoolService', () => { systems, features: [SchoolFeatures.VIDEOCONFERENCE], }); - const schoolUnsaved: LegacySchoolDo = schoolDOFactory.build({ name: 'school #2}', systems: [] }); + const schoolUnsaved: LegacySchoolDo = legacySchoolDoFactory.build({ name: 'school #2}', systems: [] }); schoolRepo.findById.mockResolvedValue(schoolSaved); schoolRepo.findByExternalId.mockResolvedValue(schoolSaved); schoolRepo.findBySchoolNumber.mockResolvedValue(schoolSaved); @@ -109,7 +109,7 @@ describe('LegacySchoolService', () => { describe('removeFeature', () => { describe('when given schoolFeature exists on school', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: [SchoolFeatures.VIDEOCONFERENCE, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); @@ -131,7 +131,7 @@ describe('LegacySchoolService', () => { describe('when school has a feature which should be removed', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: [SchoolFeatures.VIDEOCONFERENCE, SchoolFeatures.OAUTH_PROVISIONING_ENABLED], }); @@ -234,7 +234,7 @@ describe('LegacySchoolService', () => { describe('save is called', () => { describe('when validation is deactivated', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.build(); + const school: LegacySchoolDo = legacySchoolDoFactory.build(); schoolRepo.save.mockResolvedValue(school); @@ -271,7 +271,7 @@ describe('LegacySchoolService', () => { describe('when validation is active', () => { describe('when the validation fails', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.build(); + const school: LegacySchoolDo = legacySchoolDoFactory.build(); schoolRepo.save.mockResolvedValueOnce(school); schoolValidationService.validate.mockRejectedValueOnce(new Error()); @@ -308,7 +308,7 @@ describe('LegacySchoolService', () => { describe('when the validation succeeds', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.build(); + const school: LegacySchoolDo = legacySchoolDoFactory.build(); schoolRepo.save.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts index 818010807ac..aa01608fb9f 100644 --- a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts +++ b/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo } from '@shared/domain'; import { LegacySchoolRepo } from '@shared/repo'; -import { schoolDOFactory } from '@shared/testing'; +import { legacySchoolDoFactory } from '@shared/testing'; import { SchoolNumberDuplicateLoggableException } from '../../error'; import { SchoolValidationService } from './school-validation.service'; @@ -35,7 +35,7 @@ describe('SchoolValidationService', () => { describe('isSchoolNumberUnique', () => { describe('when a school has no official school number', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: undefined }); return { school, @@ -51,7 +51,7 @@ describe('SchoolValidationService', () => { describe('when a new school is created and the school number is unique', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(null); @@ -69,7 +69,7 @@ describe('SchoolValidationService', () => { describe('when an existing school is updated and the school number is unique', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(school); @@ -87,8 +87,8 @@ describe('SchoolValidationService', () => { describe('when the school number already exists on another school', () => { const setup = () => { - const newSchool: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); - const existingSchool: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: '1234' }); + const newSchool: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: '1234' }); + const existingSchool: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: '1234' }); schoolRepo.findBySchoolNumber.mockResolvedValue(existingSchool); diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts index 9a916244756..5bb583a743d 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts +++ b/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; -import { schoolDOFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; +import { legacySchoolDoFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school/service'; import { LegacySchoolUc } from '@src/modules/school/uc'; @@ -69,7 +69,7 @@ describe('LegacySchoolUc', () => { describe('setMigration is called', () => { describe('when first starting the migration', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -97,7 +97,7 @@ describe('LegacySchoolUc', () => { describe('when closing a migration', () => { describe('when there were migrated users', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = userLoginMigrationDOFactory.build({ closedAt: undefined, }); @@ -128,7 +128,7 @@ describe('LegacySchoolUc', () => { describe('when there were no users migrated', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = userLoginMigrationDOFactory.build({ closedAt: undefined, }); @@ -162,7 +162,7 @@ describe('LegacySchoolUc', () => { describe('when restarting a migration', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -193,7 +193,7 @@ describe('LegacySchoolUc', () => { describe('when trying to start a finished migration after the grace period', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -229,7 +229,7 @@ describe('LegacySchoolUc', () => { describe('getMigration is called', () => { describe('when the school has a migration', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: 'schoolId', targetSystemId: 'targetSystemId', @@ -261,7 +261,7 @@ describe('LegacySchoolUc', () => { describe('when the school has no migration', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); userLoginMigrationService.findMigrationBySchool.mockResolvedValue(null); schoolService.getSchoolById.mockResolvedValue(school); diff --git a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts index 3e30e1126ee..2aa60622e57 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts @@ -1,6 +1,11 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; -import { contextExternalToolFactory, schoolDOFactory, schoolExternalToolFactory, setupEntities } from '@shared/testing'; +import { + contextExternalToolFactory, + legacySchoolDoFactory, + schoolExternalToolFactory, + setupEntities, +} from '@shared/testing'; import { Permission, LegacySchoolDo } from '@shared/domain'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -79,7 +84,7 @@ describe('ToolPermissionHelper', () => { const userId = 'userId'; const schoolExternalTool: SchoolExternalTool = schoolExternalToolFactory.buildWithId(); const context: AuthorizationContext = AuthorizationContextBuilder.read([Permission.SCHOOL_TOOL_ADMIN]); - const school: LegacySchoolDo = schoolDOFactory.build({ id: schoolExternalTool.schoolId }); + const school: LegacySchoolDo = legacySchoolDoFactory.build({ id: schoolExternalTool.schoolId }); schoolService.getSchoolById.mockResolvedValue(school); diff --git a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.spec.ts b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.spec.ts index 96828243654..a0698e904a9 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.spec.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.spec.ts @@ -1,4 +1,4 @@ -import { contextExternalToolFactory, schoolDOFactory, schoolExternalToolFactory } from '@shared/testing'; +import { contextExternalToolFactory, legacySchoolDoFactory, schoolExternalToolFactory } from '@shared/testing'; import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ContextExternalToolRepo } from '@shared/repo'; @@ -38,7 +38,7 @@ describe('ContextExternalToolAuthorizableService', () => { describe('findById', () => { describe('when id is given', () => { const setup = () => { - const schoolId: string = schoolDOFactory.buildWithId().id as string; + const schoolId: string = legacySchoolDoFactory.buildWithId().id as string; const schoolExternalTool: SchoolExternalTool = schoolExternalToolFactory.build({ schoolId, }); diff --git a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool.service.spec.ts b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool.service.spec.ts index 1f2a1496fac..28cb093ae2d 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool.service.spec.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool.service.spec.ts @@ -4,7 +4,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ContextExternalToolRepo } from '@shared/repo'; import { contextExternalToolFactory, - schoolDOFactory, + legacySchoolDoFactory, schoolExternalToolFactory, } from '@shared/testing/factory/domainobject'; import { AuthorizationService } from '@src/modules/authorization'; @@ -133,7 +133,7 @@ describe('ContextExternalToolService', () => { describe('getContextExternalToolById', () => { describe('when contextExternalToolId is given', () => { const setup = () => { - const schoolId: string = schoolDOFactory.buildWithId().id as string; + const schoolId: string = legacySchoolDoFactory.buildWithId().id as string; const schoolExternalTool: SchoolExternalTool = schoolExternalToolFactory.build({ schoolId, }); diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts index 6daab5f8488..b2d9c898171 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts @@ -9,7 +9,7 @@ import { courseFactory, customParameterFactory, externalToolFactory, - schoolDOFactory, + legacySchoolDoFactory, schoolExternalToolFactory, setupEntities, } from '@shared/testing'; @@ -184,7 +184,7 @@ describe('AbstractLaunchStrategy', () => { }); // Other - const school: LegacySchoolDo = schoolDOFactory.buildWithId( + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId( { officialSchoolNumber: '1234', }, @@ -369,7 +369,7 @@ describe('AbstractLaunchStrategy', () => { parameters: [], }); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: undefined, }); diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts index e370c4a30f4..c21be1bddb2 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { schoolDOFactory, userDoFactory } from '@shared/testing'; +import { legacySchoolDoFactory, userDoFactory } from '@shared/testing'; import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; import { MigrationCheckService } from './migration-check.service'; @@ -62,7 +62,7 @@ describe('MigrationCheckService', () => { describe('when a non-migrating school was found', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId(); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); @@ -81,7 +81,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school was found but no user', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, targetSystemId: 'targetSystemId', @@ -103,7 +103,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school and a user that has not migrated were found', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId({ lastLoginSystemChange: undefined }); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, @@ -126,7 +126,7 @@ describe('MigrationCheckService', () => { describe('when a migrating school and a user that has migrated were found', () => { const setup = () => { - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); const user: UserDO = userDoFactory.buildWithId({ lastLoginSystemChange: new Date('2023-03-04') }); const userLoginMigration: UserLoginMigrationDO = new UserLoginMigrationDO({ schoolId: school.id as string, diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index c595b6d6378..4ae7438e540 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -6,7 +6,7 @@ import { ValidationError } from '@shared/common'; import { LegacySchoolDo, Page, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; import { setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; -import { schoolDOFactory } from '@shared/testing/factory/domainobject/school.factory'; +import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; import { LegacySchoolService } from '@src/modules/school'; @@ -119,7 +119,7 @@ describe('SchoolMigrationService', () => { describe('schoolToMigrate is called', () => { describe('when school number is missing', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -156,7 +156,7 @@ describe('SchoolMigrationService', () => { describe('when school could not be found with official school number', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -193,7 +193,7 @@ describe('SchoolMigrationService', () => { describe('when current users school not match with school of to migrate user ', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -233,7 +233,7 @@ describe('SchoolMigrationService', () => { describe('when school was already migrated', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -268,7 +268,7 @@ describe('SchoolMigrationService', () => { describe('when school has to be migrated', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', @@ -304,7 +304,7 @@ describe('SchoolMigrationService', () => { describe('migrateSchool is called', () => { describe('when school will be migrated', () => { const setup = () => { - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ id: 'schoolId', name: 'schoolName', officialSchoolNumber: 'officialSchoolNumber', diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts index 35ac252522d..bec32e35a3d 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts @@ -5,7 +5,7 @@ import { InternalServerErrorException, UnprocessableEntityException } from '@nes import { Test, TestingModule } from '@nestjs/testing'; import { EntityId, LegacySchoolDo, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { schoolDOFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; +import { legacySchoolDoFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { LegacySchoolService } from '@src/modules/school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; @@ -165,7 +165,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no systems', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -212,7 +212,7 @@ describe('UserLoginMigrationService', () => { }); const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([system]); @@ -246,7 +246,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has a feature', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -284,7 +284,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no features yet', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: undefined }, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: undefined }, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -320,7 +320,7 @@ describe('UserLoginMigrationService', () => { describe('when modifying a migration that does not exist on the school', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); userLoginMigrationRepo.findBySchoolId.mockResolvedValue(null); @@ -343,7 +343,7 @@ describe('UserLoginMigrationService', () => { describe('when creating a new migration but the SANIS system does not exist', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([]); @@ -368,7 +368,7 @@ describe('UserLoginMigrationService', () => { describe('when restarting the migration', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -415,7 +415,7 @@ describe('UserLoginMigrationService', () => { describe('when setting the migration to mandatory', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -459,7 +459,7 @@ describe('UserLoginMigrationService', () => { describe('when setting the migration back to optional', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -504,7 +504,7 @@ describe('UserLoginMigrationService', () => { describe('when closing the migration', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -551,7 +551,7 @@ describe('UserLoginMigrationService', () => { describe('when schoolId is given', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -614,7 +614,7 @@ describe('UserLoginMigrationService', () => { }); const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystemId] }, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([system]); @@ -647,7 +647,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has schoolfeatures', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -684,7 +684,7 @@ describe('UserLoginMigrationService', () => { describe('when the school has no features yet', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ features: undefined }, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ features: undefined }, schoolId); const targetSystemId: EntityId = new ObjectId().toHexString(); const system: SystemDto = new SystemDto({ @@ -718,7 +718,7 @@ describe('UserLoginMigrationService', () => { describe('when creating a new migration but the SANIS system does not exist', () => { const setup = () => { const schoolId: EntityId = new ObjectId().toHexString(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(undefined, schoolId); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(undefined, schoolId); schoolService.getSchoolById.mockResolvedValue(school); systemService.findByType.mockResolvedValue([]); diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts index f230ec78d37..5d94187702a 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts @@ -5,7 +5,7 @@ import { ObjectId } from '@mikro-orm/mongodb'; import { BadRequestException, NotFoundException, UnprocessableEntityException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, RoleName, UserDO } from '@shared/domain'; -import { schoolDOFactory, setupEntities, userDoFactory } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities, userDoFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto, AccountSaveDto } from '@src/modules/account/services/dto'; @@ -89,7 +89,7 @@ describe('UserMigrationService', () => { describe('when finding the migration systems', () => { const setup = () => { const officialSchoolNumber = '3'; - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ name: 'schoolName', officialSchoolNumber }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ name: 'schoolName', officialSchoolNumber }); schoolService.getSchoolBySchoolNumber.mockResolvedValue(school); diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts index fd7f1e40429..e2c9218322b 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; -import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -70,7 +70,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -115,7 +115,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -157,7 +157,7 @@ describe('RestartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -179,7 +179,7 @@ describe('RestartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -207,7 +207,7 @@ describe('RestartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts index d867b5bfec2..ab937d679fd 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; -import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -64,7 +64,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -109,7 +109,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -139,7 +139,7 @@ describe('StartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -161,7 +161,7 @@ describe('StartUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId({ officialSchoolNumber: undefined }); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ officialSchoolNumber: undefined }); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -184,7 +184,7 @@ describe('StartUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts index 1076d3acbfd..edd1f455aa4 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { ForbiddenException } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; -import { schoolDOFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; +import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; import { LegacySchoolService } from '@src/modules/school'; @@ -71,7 +71,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -119,7 +119,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -162,7 +162,7 @@ describe('ToggleUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -184,7 +184,7 @@ describe('ToggleUserLoginMigrationUc', () => { const setup = () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -212,7 +212,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); @@ -236,7 +236,7 @@ describe('ToggleUserLoginMigrationUc', () => { const user: User = userFactory.buildWithId(); - const school: LegacySchoolDo = schoolDOFactory.buildWithId(); + const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId(); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts index fe9fde2563b..6f6bb0f4a9a 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { NotFoundLoggableException } from '@shared/common/loggable-exception'; import { Page, Permission, LegacySchoolDo, System, User, UserLoginMigrationDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { - schoolDOFactory, + legacySchoolDoFactory, setupEntities, systemFactory, userFactory, @@ -304,7 +304,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -419,7 +419,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -483,7 +483,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', @@ -619,7 +619,7 @@ describe('UserLoginMigrationUc', () => { .withOauthConfig() .buildWithId({ provisioningStrategy: SystemProvisioningStrategy.SANIS }); - const schoolDO: LegacySchoolDo = schoolDOFactory.buildWithId({ + const schoolDO: LegacySchoolDo = legacySchoolDoFactory.buildWithId({ systems: [sourceSystem.id], officialSchoolNumber: 'officialSchoolNumber', externalId: 'oldSchoolExternalId', diff --git a/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts b/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts index ef19b08567c..c547f772de5 100644 --- a/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts +++ b/apps/server/src/shared/domain/rules/legacy-school.rule.spec.ts @@ -1,6 +1,6 @@ import { Test, TestingModule } from '@nestjs/testing'; import { Permission } from '@shared/domain/interface'; -import { roleFactory, schoolDOFactory, setupEntities, userFactory } from '@shared/testing'; +import { roleFactory, legacySchoolDoFactory, setupEntities, userFactory } from '@shared/testing'; import { AuthorizationHelper } from '@src/modules/authorization/authorization.helper'; import { Action } from '@src/modules/authorization/types'; import { ObjectID } from 'bson'; @@ -25,7 +25,7 @@ describe('LegacySchoolRule', () => { }); const setupSchoolAndUser = () => { - const school = schoolDOFactory.build({ id: new ObjectID().toString() }); + const school = legacySchoolDoFactory.build({ id: new ObjectID().toString() }); const role = roleFactory.build({ permissions: [permissionA, permissionB] }); const user = userFactory.build({ roles: [role], @@ -62,7 +62,7 @@ describe('LegacySchoolRule', () => { it('should return "false" if user has not same school', () => { const { user } = setupSchoolAndUser(); - const school = schoolDOFactory.build(); + const school = legacySchoolDoFactory.build(); const res = service.hasPermission(user, school, { action: Action.read, requiredPermissions: [permissionA] }); diff --git a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts index df5c26e9581..5cd81119d20 100644 --- a/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/school/legacy-school.repo.integration.spec.ts @@ -15,7 +15,7 @@ import { } from '@shared/domain'; import { MongoMemoryDatabaseModule } from '@shared/infra/database'; import { - schoolDOFactory, + legacySchoolDoFactory, schoolFactory, schoolYearFactory, systemFactory, @@ -62,7 +62,7 @@ describe('LegacySchoolRepo', () => { describe('save is called', () => { describe('when saving only required fields', () => { function setupDO() { - const domainObject: LegacySchoolDo = schoolDOFactory.build(); + const domainObject: LegacySchoolDo = legacySchoolDoFactory.build(); return { domainObject, }; @@ -226,7 +226,7 @@ describe('LegacySchoolRepo', () => { await em.persistAndFlush([userLoginMigration, system1, system2]); - const entityDO: LegacySchoolDo = schoolDOFactory.build({ + const entityDO: LegacySchoolDo = legacySchoolDoFactory.build({ systems: [system1.id, system2.id], userLoginMigrationId: userLoginMigration.id, }); @@ -265,7 +265,7 @@ describe('LegacySchoolRepo', () => { describe('when there are no systems', () => { it('should not call the entity manager to get the system object', () => { - const entityDO: LegacySchoolDo = schoolDOFactory.build({ systems: undefined }); + const entityDO: LegacySchoolDo = legacySchoolDoFactory.build({ systems: undefined }); const emGetReferenceSpy = jest.spyOn(em, 'getReference'); repo.mapDOToEntityProperties(entityDO); @@ -276,7 +276,7 @@ describe('LegacySchoolRepo', () => { describe('when there is no userLoginMigration', () => { it('should not call the entity manager to get the user login migration reference', () => { - const entityDO: LegacySchoolDo = schoolDOFactory.build({ userLoginMigrationId: undefined }); + const entityDO: LegacySchoolDo = legacySchoolDoFactory.build({ userLoginMigrationId: undefined }); const emGetReferenceSpy = jest.spyOn(em, 'getReference'); repo.mapDOToEntityProperties(entityDO); diff --git a/apps/server/src/shared/testing/factory/domainobject/school.factory.ts b/apps/server/src/shared/testing/factory/domainobject/school.factory.ts index 95377b815c8..9859721c9a5 100644 --- a/apps/server/src/shared/testing/factory/domainobject/school.factory.ts +++ b/apps/server/src/shared/testing/factory/domainobject/school.factory.ts @@ -3,9 +3,9 @@ import { federalStateFactory } from '../federal-state.factory'; import { schoolYearFactory } from '../schoolyear.factory'; import { DoBaseFactory } from './do-base.factory'; -class SchoolFactory extends DoBaseFactory {} +class LegacySchoolFactory extends DoBaseFactory {} -export const schoolDOFactory = SchoolFactory.define(LegacySchoolDo, ({ sequence }) => { +export const legacySchoolDoFactory = LegacySchoolFactory.define(LegacySchoolDo, ({ sequence }) => { return { name: `schoolName-${sequence}`, externalId: '123', From ab8e8e2059de78428146184f6d398eed35e47505 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Thu, 31 Aug 2023 12:18:52 +0200 Subject: [PATCH 14/29] Rename school factory file --- apps/server/src/modules/oauth/service/oauth.service.spec.ts | 4 +--- .../provisioning/strategy/iserv/iserv.strategy.spec.ts | 3 +-- .../service/school-migration.service.spec.ts | 3 +-- apps/server/src/shared/testing/factory/domainobject/index.ts | 2 +- .../{school.factory.ts => legacy-school.factory.ts} | 0 5 files changed, 4 insertions(+), 8 deletions(-) rename apps/server/src/shared/testing/factory/domainobject/{school.factory.ts => legacy-school.factory.ts} (100%) diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index a63e9f2b8a5..0f3e16313f0 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -5,9 +5,7 @@ import { LegacySchoolDo, OauthConfig, SchoolFeatures, System } from '@shared/dom import { UserDO } from '@shared/domain/domainobject/user.do'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { DefaultEncryptionService, IEncryptionService, SymetricKeyEncryptionService } from '@shared/infra/encryption'; -import { setupEntities, userDoFactory } from '@shared/testing'; -import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; -import { systemFactory } from '@shared/testing/factory/system.factory'; +import { legacySchoolDoFactory, setupEntities, systemFactory, userDoFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { ProvisioningDto, ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index b48d4c9a30e..8461f058b43 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -3,8 +3,7 @@ import { ObjectId } from '@mikro-orm/mongodb'; import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, RoleName, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; -import { schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; -import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; +import { legacySchoolDoFactory, schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { LegacySchoolService } from '@src/modules/school'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index 4ae7438e540..dad2d2451aa 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -5,8 +5,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ValidationError } from '@shared/common'; import { LegacySchoolDo, Page, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-login-migration.repo'; -import { setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; -import { legacySchoolDoFactory } from '@shared/testing/factory/domainobject/school.factory'; +import { legacySchoolDoFactory, setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; import { LegacySchoolService } from '@src/modules/school'; diff --git a/apps/server/src/shared/testing/factory/domainobject/index.ts b/apps/server/src/shared/testing/factory/domainobject/index.ts index 3ebd47e3ec7..c537c9f48ed 100644 --- a/apps/server/src/shared/testing/factory/domainobject/index.ts +++ b/apps/server/src/shared/testing/factory/domainobject/index.ts @@ -1,7 +1,7 @@ export * from './board'; export * from './tool'; export * from './do-base.factory'; -export * from './school.factory'; +export * from './legacy-school.factory'; export * from './user-login-migration-do.factory'; export * from './lti-tool.factory'; export * from './pseudonym.factory'; diff --git a/apps/server/src/shared/testing/factory/domainobject/school.factory.ts b/apps/server/src/shared/testing/factory/domainobject/legacy-school.factory.ts similarity index 100% rename from apps/server/src/shared/testing/factory/domainobject/school.factory.ts rename to apps/server/src/shared/testing/factory/domainobject/legacy-school.factory.ts From 162f73c5b4413cfc82224567ea8344b5ee5fc890 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Fri, 1 Sep 2023 11:06:13 +0200 Subject: [PATCH 15/29] Rename parameter --- apps/server/src/shared/domain/rules/legacy-school.rule.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/shared/domain/rules/legacy-school.rule.ts b/apps/server/src/shared/domain/rules/legacy-school.rule.ts index b17185b3bb1..5068d327c35 100644 --- a/apps/server/src/shared/domain/rules/legacy-school.rule.ts +++ b/apps/server/src/shared/domain/rules/legacy-school.rule.ts @@ -12,14 +12,14 @@ import { AuthorizableObject } from '../domain-object'; export class LegacySchoolRule implements Rule { constructor(private readonly authorizationHelper: AuthorizationHelper) {} - public isApplicable(user: User, entity: AuthorizableObject | BaseDO): boolean { - const isMatched: boolean = entity instanceof LegacySchoolDo; + public isApplicable(user: User, object: AuthorizableObject | BaseDO): boolean { + const isMatched = object instanceof LegacySchoolDo; return isMatched; } public hasPermission(user: User, entity: LegacySchoolDo, context: AuthorizationContext): boolean { - const hasPermission: boolean = + const hasPermission = this.authorizationHelper.hasAllPermissions(user, context.requiredPermissions) && user.school.id === entity.id; return hasPermission; From 8b9d35fecd6247875feee1c37e778f2b1eeedbfd Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Tue, 5 Sep 2023 14:36:18 +0200 Subject: [PATCH 16/29] Rename school module folder --- apps/server/src/modules/authorization/authorization.module.ts | 2 +- apps/server/src/modules/index.ts | 2 +- apps/server/src/modules/oauth/oauth-api.module.ts | 2 +- apps/server/src/modules/oauth/oauth.module.ts | 2 +- apps/server/src/modules/oauth/service/oauth.service.spec.ts | 2 +- apps/server/src/modules/oauth/service/oauth.service.ts | 2 +- apps/server/src/modules/oauth/uc/oauth.uc.spec.ts | 2 +- apps/server/src/modules/provisioning/provisioning.module.ts | 2 +- .../provisioning/strategy/iserv/iserv.strategy.spec.ts | 2 +- .../src/modules/provisioning/strategy/iserv/iserv.strategy.ts | 2 +- .../strategy/oidc/service/oidc-provisioning.service.spec.ts | 2 +- .../strategy/oidc/service/oidc-provisioning.service.ts | 4 ++-- .../{school => school-migration}/controller/dto/index.ts | 0 .../controller/dto/migration.body.ts | 0 .../controller/dto/migration.response.ts | 0 .../controller/dto/school.params.ts | 0 .../controller/school.controller.spec.ts | 0 .../controller/school.controller.ts | 0 .../src/modules/{school => school-migration}/error/index.ts | 0 .../error/school-number-duplicate.loggable-exception.spec.ts | 0 .../error/school-number-duplicate.loggable-exception.ts | 0 apps/server/src/modules/{school => school-migration}/index.ts | 0 .../mapper/migration.mapper.spec.ts | 0 .../{school => school-migration}/mapper/migration.mapper.ts | 0 .../src/modules/{school => school-migration}/repo/index.ts | 0 .../repo/schoolyear.repo.integration.spec.ts | 0 .../{school => school-migration}/repo/schoolyear.repo.ts | 0 .../modules/{school => school-migration}/school-api.module.ts | 0 .../src/modules/{school => school-migration}/school.module.ts | 0 .../service/federal-state.service.spec.ts | 0 .../service/federal-state.service.ts | 0 .../src/modules/{school => school-migration}/service/index.ts | 0 .../service/legacy-school.service.spec.ts | 0 .../service/legacy-school.service.ts | 0 .../service/school-year.service.spec.ts | 0 .../service/school-year.service.ts | 0 .../{school => school-migration}/service/validation/index.ts | 0 .../service/validation/school-validation.service.spec.ts | 0 .../service/validation/school-validation.service.ts | 0 .../types/federal-state-names.enum.ts | 0 .../src/modules/{school => school-migration}/types/index.ts | 0 .../uc/dto/oauth-migration.dto.ts | 0 .../src/modules/{school => school-migration}/uc/index.ts | 0 .../{school => school-migration}/uc/legacy-school.uc.spec.ts | 4 ++-- .../{school => school-migration}/uc/legacy-school.uc.ts | 0 apps/server/src/modules/server/server.module.ts | 2 +- apps/server/src/modules/tool/common/common-tool.module.ts | 2 +- .../src/modules/tool/common/uc/tool-permission-helper.ts | 2 +- .../modules/tool/common/uc/tool-permissions-helper.spec.ts | 2 +- apps/server/src/modules/tool/tool-api.module.ts | 2 +- .../service/strategy/abstract-launch.strategy.spec.ts | 2 +- .../tool-launch/service/strategy/abstract-launch.strategy.ts | 2 +- .../service/strategy/basic-tool-launch.strategy.spec.ts | 2 +- .../service/strategy/lti11-tool-launch.strategy.spec.ts | 2 +- .../service/strategy/lti11-tool-launch.strategy.ts | 2 +- .../service/strategy/oauth2-tool-launch.strategy.spec.ts | 2 +- .../server/src/modules/tool/tool-launch/tool-launch.module.ts | 2 +- .../user-import/controller/import-user.controller.spec.ts | 2 +- apps/server/src/modules/user-import/uc/user-import.uc.spec.ts | 2 +- apps/server/src/modules/user-import/uc/user-import.uc.ts | 2 +- apps/server/src/modules/user-import/user-import.module.ts | 2 +- .../service/migration-check.service.spec.ts | 2 +- .../user-login-migration/service/migration-check.service.ts | 2 +- .../service/school-migration.service.spec.ts | 2 +- .../user-login-migration/service/school-migration.service.ts | 2 +- .../service/user-login-migration-revert.service.spec.ts | 2 +- .../service/user-login-migration-revert.service.ts | 2 +- .../service/user-login-migration.service.spec.ts | 2 +- .../service/user-login-migration.service.ts | 2 +- .../service/user-migration.service.spec.ts | 2 +- .../user-login-migration/service/user-migration.service.ts | 2 +- .../uc/restart-user-login-migration.uc.spec.ts | 2 +- .../uc/restart-user-login-migration.uc.ts | 2 +- .../uc/start-user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/uc/start-user-login-migration.uc.ts | 2 +- .../uc/toggle-user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/uc/toggle-user-login-migration.uc.ts | 2 +- .../user-login-migration/uc/user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/user-login-migration-api.module.ts | 2 +- .../user-login-migration/user-login-migration.module.ts | 2 +- apps/server/src/modules/user/user.module.ts | 2 +- .../video-conference/service/video-conference.service.spec.ts | 2 +- .../video-conference/service/video-conference.service.ts | 2 +- .../video-conference/uc/video-conference-deprecated.uc.ts | 2 +- .../src/modules/video-conference/video-conference.module.ts | 2 +- 85 files changed, 55 insertions(+), 55 deletions(-) rename apps/server/src/modules/{school => school-migration}/controller/dto/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/controller/dto/migration.body.ts (100%) rename apps/server/src/modules/{school => school-migration}/controller/dto/migration.response.ts (100%) rename apps/server/src/modules/{school => school-migration}/controller/dto/school.params.ts (100%) rename apps/server/src/modules/{school => school-migration}/controller/school.controller.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/controller/school.controller.ts (100%) rename apps/server/src/modules/{school => school-migration}/error/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/error/school-number-duplicate.loggable-exception.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/error/school-number-duplicate.loggable-exception.ts (100%) rename apps/server/src/modules/{school => school-migration}/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/mapper/migration.mapper.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/mapper/migration.mapper.ts (100%) rename apps/server/src/modules/{school => school-migration}/repo/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/repo/schoolyear.repo.integration.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/repo/schoolyear.repo.ts (100%) rename apps/server/src/modules/{school => school-migration}/school-api.module.ts (100%) rename apps/server/src/modules/{school => school-migration}/school.module.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/federal-state.service.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/federal-state.service.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/legacy-school.service.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/legacy-school.service.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/school-year.service.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/school-year.service.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/validation/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/validation/school-validation.service.spec.ts (100%) rename apps/server/src/modules/{school => school-migration}/service/validation/school-validation.service.ts (100%) rename apps/server/src/modules/{school => school-migration}/types/federal-state-names.enum.ts (100%) rename apps/server/src/modules/{school => school-migration}/types/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/uc/dto/oauth-migration.dto.ts (100%) rename apps/server/src/modules/{school => school-migration}/uc/index.ts (100%) rename apps/server/src/modules/{school => school-migration}/uc/legacy-school.uc.spec.ts (98%) rename apps/server/src/modules/{school => school-migration}/uc/legacy-school.uc.ts (100%) diff --git a/apps/server/src/modules/authorization/authorization.module.ts b/apps/server/src/modules/authorization/authorization.module.ts index a77bb82444c..7ca73d81448 100644 --- a/apps/server/src/modules/authorization/authorization.module.ts +++ b/apps/server/src/modules/authorization/authorization.module.ts @@ -13,7 +13,7 @@ import { UserRepo, } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { ToolModule } from '@src/modules/tool'; import { BoardModule } from '../board'; import { AuthorizationHelper } from './authorization.helper'; diff --git a/apps/server/src/modules/index.ts b/apps/server/src/modules/index.ts index 6e0070a7867..5dd57a73956 100644 --- a/apps/server/src/modules/index.ts +++ b/apps/server/src/modules/index.ts @@ -14,7 +14,7 @@ export * from './oauth-provider'; export * from './provisioning'; export * from './rocketchat'; export * from './role'; -export * from './school'; +export * from './school-migration'; export * from './sharing'; export * from './system'; export * from './task'; diff --git a/apps/server/src/modules/oauth/oauth-api.module.ts b/apps/server/src/modules/oauth/oauth-api.module.ts index d97af726250..0779ff7b9b2 100644 --- a/apps/server/src/modules/oauth/oauth-api.module.ts +++ b/apps/server/src/modules/oauth/oauth-api.module.ts @@ -3,7 +3,7 @@ import { LoggerModule } from '@src/core/logger'; import { AuthenticationModule } from '@src/modules/authentication/authentication.module'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; diff --git a/apps/server/src/modules/oauth/oauth.module.ts b/apps/server/src/modules/oauth/oauth.module.ts index 78eaec06048..156eab35cbd 100644 --- a/apps/server/src/modules/oauth/oauth.module.ts +++ b/apps/server/src/modules/oauth/oauth.module.ts @@ -6,7 +6,7 @@ import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index 0f3e16313f0..1316037e3f8 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -9,7 +9,7 @@ import { legacySchoolDoFactory, setupEntities, systemFactory, userDoFactory } fr import { LegacyLogger } from '@src/core/logger'; import { ProvisioningDto, ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { OauthConfigDto } from '@src/modules/system/service'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; import { SystemService } from '@src/modules/system/service/system.service'; diff --git a/apps/server/src/modules/oauth/service/oauth.service.ts b/apps/server/src/modules/oauth/service/oauth.service.ts index d17dca6c734..29d4a50c879 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.ts @@ -6,7 +6,7 @@ import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encr import { LegacyLogger } from '@src/core/logger'; import { ProvisioningService } from '@src/modules/provisioning'; import { OauthDataDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index bad68fa190f..5557ef68614 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -12,7 +12,7 @@ import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { OauthUc } from '@src/modules/oauth/uc/oauth.uc'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto, SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index fc0499c8d46..1064097128f 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { SchoolModule } from '@src/modules/school/school.module'; +import { SchoolModule } from '@src/modules/school-migration/school.module'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index 8461f058b43..264d2f1d11d 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -5,7 +5,7 @@ import { LegacySchoolDo, RoleName, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { legacySchoolDoFactory, schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import jwt from 'jsonwebtoken'; import { RoleDto } from '../../../role/service/dto/role.dto'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts index d2072ec1836..14984651fda 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { LegacySchoolDo, RoleName, RoleReference, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import jwt, { JwtPayload } from 'jsonwebtoken'; import { diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index a33735b2084..b0382169122 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -9,7 +9,7 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts index 4d4e5446990..9c0f140d322 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts @@ -12,8 +12,8 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school'; -import { FederalStateNames } from '@src/modules/school/types'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school-migration'; +import { FederalStateNames } from '@src/modules/school-migration/types'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; diff --git a/apps/server/src/modules/school/controller/dto/index.ts b/apps/server/src/modules/school-migration/controller/dto/index.ts similarity index 100% rename from apps/server/src/modules/school/controller/dto/index.ts rename to apps/server/src/modules/school-migration/controller/dto/index.ts diff --git a/apps/server/src/modules/school/controller/dto/migration.body.ts b/apps/server/src/modules/school-migration/controller/dto/migration.body.ts similarity index 100% rename from apps/server/src/modules/school/controller/dto/migration.body.ts rename to apps/server/src/modules/school-migration/controller/dto/migration.body.ts diff --git a/apps/server/src/modules/school/controller/dto/migration.response.ts b/apps/server/src/modules/school-migration/controller/dto/migration.response.ts similarity index 100% rename from apps/server/src/modules/school/controller/dto/migration.response.ts rename to apps/server/src/modules/school-migration/controller/dto/migration.response.ts diff --git a/apps/server/src/modules/school/controller/dto/school.params.ts b/apps/server/src/modules/school-migration/controller/dto/school.params.ts similarity index 100% rename from apps/server/src/modules/school/controller/dto/school.params.ts rename to apps/server/src/modules/school-migration/controller/dto/school.params.ts diff --git a/apps/server/src/modules/school/controller/school.controller.spec.ts b/apps/server/src/modules/school-migration/controller/school.controller.spec.ts similarity index 100% rename from apps/server/src/modules/school/controller/school.controller.spec.ts rename to apps/server/src/modules/school-migration/controller/school.controller.spec.ts diff --git a/apps/server/src/modules/school/controller/school.controller.ts b/apps/server/src/modules/school-migration/controller/school.controller.ts similarity index 100% rename from apps/server/src/modules/school/controller/school.controller.ts rename to apps/server/src/modules/school-migration/controller/school.controller.ts diff --git a/apps/server/src/modules/school/error/index.ts b/apps/server/src/modules/school-migration/error/index.ts similarity index 100% rename from apps/server/src/modules/school/error/index.ts rename to apps/server/src/modules/school-migration/error/index.ts diff --git a/apps/server/src/modules/school/error/school-number-duplicate.loggable-exception.spec.ts b/apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.spec.ts similarity index 100% rename from apps/server/src/modules/school/error/school-number-duplicate.loggable-exception.spec.ts rename to apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.spec.ts diff --git a/apps/server/src/modules/school/error/school-number-duplicate.loggable-exception.ts b/apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.ts similarity index 100% rename from apps/server/src/modules/school/error/school-number-duplicate.loggable-exception.ts rename to apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.ts diff --git a/apps/server/src/modules/school/index.ts b/apps/server/src/modules/school-migration/index.ts similarity index 100% rename from apps/server/src/modules/school/index.ts rename to apps/server/src/modules/school-migration/index.ts diff --git a/apps/server/src/modules/school/mapper/migration.mapper.spec.ts b/apps/server/src/modules/school-migration/mapper/migration.mapper.spec.ts similarity index 100% rename from apps/server/src/modules/school/mapper/migration.mapper.spec.ts rename to apps/server/src/modules/school-migration/mapper/migration.mapper.spec.ts diff --git a/apps/server/src/modules/school/mapper/migration.mapper.ts b/apps/server/src/modules/school-migration/mapper/migration.mapper.ts similarity index 100% rename from apps/server/src/modules/school/mapper/migration.mapper.ts rename to apps/server/src/modules/school-migration/mapper/migration.mapper.ts diff --git a/apps/server/src/modules/school/repo/index.ts b/apps/server/src/modules/school-migration/repo/index.ts similarity index 100% rename from apps/server/src/modules/school/repo/index.ts rename to apps/server/src/modules/school-migration/repo/index.ts diff --git a/apps/server/src/modules/school/repo/schoolyear.repo.integration.spec.ts b/apps/server/src/modules/school-migration/repo/schoolyear.repo.integration.spec.ts similarity index 100% rename from apps/server/src/modules/school/repo/schoolyear.repo.integration.spec.ts rename to apps/server/src/modules/school-migration/repo/schoolyear.repo.integration.spec.ts diff --git a/apps/server/src/modules/school/repo/schoolyear.repo.ts b/apps/server/src/modules/school-migration/repo/schoolyear.repo.ts similarity index 100% rename from apps/server/src/modules/school/repo/schoolyear.repo.ts rename to apps/server/src/modules/school-migration/repo/schoolyear.repo.ts diff --git a/apps/server/src/modules/school/school-api.module.ts b/apps/server/src/modules/school-migration/school-api.module.ts similarity index 100% rename from apps/server/src/modules/school/school-api.module.ts rename to apps/server/src/modules/school-migration/school-api.module.ts diff --git a/apps/server/src/modules/school/school.module.ts b/apps/server/src/modules/school-migration/school.module.ts similarity index 100% rename from apps/server/src/modules/school/school.module.ts rename to apps/server/src/modules/school-migration/school.module.ts diff --git a/apps/server/src/modules/school/service/federal-state.service.spec.ts b/apps/server/src/modules/school-migration/service/federal-state.service.spec.ts similarity index 100% rename from apps/server/src/modules/school/service/federal-state.service.spec.ts rename to apps/server/src/modules/school-migration/service/federal-state.service.spec.ts diff --git a/apps/server/src/modules/school/service/federal-state.service.ts b/apps/server/src/modules/school-migration/service/federal-state.service.ts similarity index 100% rename from apps/server/src/modules/school/service/federal-state.service.ts rename to apps/server/src/modules/school-migration/service/federal-state.service.ts diff --git a/apps/server/src/modules/school/service/index.ts b/apps/server/src/modules/school-migration/service/index.ts similarity index 100% rename from apps/server/src/modules/school/service/index.ts rename to apps/server/src/modules/school-migration/service/index.ts diff --git a/apps/server/src/modules/school/service/legacy-school.service.spec.ts b/apps/server/src/modules/school-migration/service/legacy-school.service.spec.ts similarity index 100% rename from apps/server/src/modules/school/service/legacy-school.service.spec.ts rename to apps/server/src/modules/school-migration/service/legacy-school.service.spec.ts diff --git a/apps/server/src/modules/school/service/legacy-school.service.ts b/apps/server/src/modules/school-migration/service/legacy-school.service.ts similarity index 100% rename from apps/server/src/modules/school/service/legacy-school.service.ts rename to apps/server/src/modules/school-migration/service/legacy-school.service.ts diff --git a/apps/server/src/modules/school/service/school-year.service.spec.ts b/apps/server/src/modules/school-migration/service/school-year.service.spec.ts similarity index 100% rename from apps/server/src/modules/school/service/school-year.service.spec.ts rename to apps/server/src/modules/school-migration/service/school-year.service.spec.ts diff --git a/apps/server/src/modules/school/service/school-year.service.ts b/apps/server/src/modules/school-migration/service/school-year.service.ts similarity index 100% rename from apps/server/src/modules/school/service/school-year.service.ts rename to apps/server/src/modules/school-migration/service/school-year.service.ts diff --git a/apps/server/src/modules/school/service/validation/index.ts b/apps/server/src/modules/school-migration/service/validation/index.ts similarity index 100% rename from apps/server/src/modules/school/service/validation/index.ts rename to apps/server/src/modules/school-migration/service/validation/index.ts diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.spec.ts b/apps/server/src/modules/school-migration/service/validation/school-validation.service.spec.ts similarity index 100% rename from apps/server/src/modules/school/service/validation/school-validation.service.spec.ts rename to apps/server/src/modules/school-migration/service/validation/school-validation.service.spec.ts diff --git a/apps/server/src/modules/school/service/validation/school-validation.service.ts b/apps/server/src/modules/school-migration/service/validation/school-validation.service.ts similarity index 100% rename from apps/server/src/modules/school/service/validation/school-validation.service.ts rename to apps/server/src/modules/school-migration/service/validation/school-validation.service.ts diff --git a/apps/server/src/modules/school/types/federal-state-names.enum.ts b/apps/server/src/modules/school-migration/types/federal-state-names.enum.ts similarity index 100% rename from apps/server/src/modules/school/types/federal-state-names.enum.ts rename to apps/server/src/modules/school-migration/types/federal-state-names.enum.ts diff --git a/apps/server/src/modules/school/types/index.ts b/apps/server/src/modules/school-migration/types/index.ts similarity index 100% rename from apps/server/src/modules/school/types/index.ts rename to apps/server/src/modules/school-migration/types/index.ts diff --git a/apps/server/src/modules/school/uc/dto/oauth-migration.dto.ts b/apps/server/src/modules/school-migration/uc/dto/oauth-migration.dto.ts similarity index 100% rename from apps/server/src/modules/school/uc/dto/oauth-migration.dto.ts rename to apps/server/src/modules/school-migration/uc/dto/oauth-migration.dto.ts diff --git a/apps/server/src/modules/school/uc/index.ts b/apps/server/src/modules/school-migration/uc/index.ts similarity index 100% rename from apps/server/src/modules/school/uc/index.ts rename to apps/server/src/modules/school-migration/uc/index.ts diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts b/apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts similarity index 98% rename from apps/server/src/modules/school/uc/legacy-school.uc.spec.ts rename to apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts index 5bb583a743d..9be10a4314f 100644 --- a/apps/server/src/modules/school/uc/legacy-school.uc.spec.ts +++ b/apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts @@ -4,8 +4,8 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; import { legacySchoolDoFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school/service'; -import { LegacySchoolUc } from '@src/modules/school/uc'; +import { LegacySchoolService } from '@src/modules/school-migration/service'; +import { LegacySchoolUc } from '@src/modules/school-migration/uc'; import { SchoolMigrationService, UserLoginMigrationRevertService, diff --git a/apps/server/src/modules/school/uc/legacy-school.uc.ts b/apps/server/src/modules/school-migration/uc/legacy-school.uc.ts similarity index 100% rename from apps/server/src/modules/school/uc/legacy-school.uc.ts rename to apps/server/src/modules/school-migration/uc/legacy-school.uc.ts diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index 5a5826843e7..3d2e152ee45 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -22,7 +22,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { SchoolApiModule } from '@src/modules/school/school-api.module'; +import { SchoolApiModule } from '@src/modules/school-migration/school-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; diff --git a/apps/server/src/modules/tool/common/common-tool.module.ts b/apps/server/src/modules/tool/common/common-tool.module.ts index 419385be67d..c5463e223b7 100644 --- a/apps/server/src/modules/tool/common/common-tool.module.ts +++ b/apps/server/src/modules/tool/common/common-tool.module.ts @@ -2,7 +2,7 @@ import { forwardRef, Module } from '@nestjs/common'; import { ContextExternalToolRepo, SchoolExternalToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { CommonToolService, CommonToolValidationService } from './service'; import { ToolPermissionHelper } from './uc/tool-permission-helper'; diff --git a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts index d869ce08d50..1de25668708 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts @@ -1,7 +1,7 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { EntityId, LegacySchoolDo, User } from '@shared/domain'; import { AuthorizableReferenceType, AuthorizationContext, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { SchoolExternalTool } from '../../school-external-tool/domain'; import { ContextTypeMapper } from '../mapper'; diff --git a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts index 2aa60622e57..64e421aba9f 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts @@ -8,7 +8,7 @@ import { } from '@shared/testing'; import { Permission, LegacySchoolDo } from '@shared/domain'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { ToolPermissionHelper } from './tool-permission-helper'; import { SchoolExternalTool } from '../../school-external-tool/domain'; diff --git a/apps/server/src/modules/tool/tool-api.module.ts b/apps/server/src/modules/tool/tool-api.module.ts index a93420b59da..f5d7e0f834b 100644 --- a/apps/server/src/modules/tool/tool-api.module.ts +++ b/apps/server/src/modules/tool/tool-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { ToolContextController } from './context-external-tool/controller'; import { ContextExternalToolUc } from './context-external-tool/uc'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts index b2d9c898171..17c569f617e 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts @@ -13,7 +13,7 @@ import { schoolExternalToolFactory, setupEntities, } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { MissingToolParameterValueLoggableException, ParameterTypeNotImplementedLoggableException } from '../../error'; import { LaunchRequestMethod, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts index 2b85ab53922..8ad5bfe2a6f 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { Course, EntityId, LegacySchoolDo } from '@shared/domain'; import { CourseRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { URLSearchParams } from 'url'; import { CustomParameterLocation, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts index 3c9ba5d47e2..70297290f1f 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { LaunchRequestMethod, PropertyData, PropertyLocation } from '../../types'; import { BasicToolLaunchStrategy } from './basic-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts index 1b9c19b7aa9..cc72deb2b63 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts @@ -11,7 +11,7 @@ import { } from '@shared/testing'; import { pseudonymFactory } from '@shared/testing/factory/domainobject/pseudonym.factory'; import { PseudonymService } from '@src/modules/pseudonym/service'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { ObjectId } from 'bson'; import { Authorization } from 'oauth-1.0a'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts index af97d2ba7c2..4592c885122 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts @@ -3,7 +3,7 @@ import { EntityId, LtiPrivacyPermission, Pseudonym, RoleName, UserDO } from '@sh import { RoleReference } from '@shared/domain/domainobject'; import { CourseRepo } from '@shared/repo'; import { PseudonymService } from '@src/modules/pseudonym'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { Authorization } from 'oauth-1.0a'; import { LtiRole } from '../../../common/enum'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts index 488ac87c444..dbf390742ae 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { LaunchRequestMethod, PropertyData } from '../../types'; import { OAuth2ToolLaunchStrategy } from './oauth2-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; diff --git a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts index 3e91129b7ec..7ba04ba55f9 100644 --- a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts +++ b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { PseudonymModule } from '@src/modules/pseudonym'; import { CourseRepo } from '@shared/repo'; diff --git a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts index d6358d314ae..96bd92ec3d4 100644 --- a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts +++ b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { LoggerModule } from '@src/core/logger'; import { ConfigModule } from '@nestjs/config'; import { UserImportUc } from '../uc/user-import.uc'; diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index c2f1838e991..2faaf58463e 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -23,7 +23,7 @@ import { systemFactory } from '@shared/testing/factory/system.factory'; import { LoggerModule } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '../../school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { LdapAlreadyPersistedException, MigrationAlreadyActivatedException, diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.ts b/apps/server/src/modules/user-import/uc/user-import.uc.ts index 7121b2c7b27..cfb707bd0a5 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.ts @@ -22,7 +22,7 @@ import { Logger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto/account.dto'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { MigrationMayBeCompleted, MigrationMayNotBeCompleted, diff --git a/apps/server/src/modules/user-import/user-import.module.ts b/apps/server/src/modules/user-import/user-import.module.ts index ca2bae05883..aac78142f51 100644 --- a/apps/server/src/modules/user-import/user-import.module.ts +++ b/apps/server/src/modules/user-import/user-import.module.ts @@ -1,9 +1,9 @@ import { Module } from '@nestjs/common'; import { ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; +import { SchoolModule } from '@src/modules/school-migration'; import { AccountModule } from '../account'; import { AuthorizationModule } from '../authorization'; -import { SchoolModule } from '../school'; import { ImportUserController } from './controller/import-user.controller'; import { UserImportUc } from './uc/user-import.uc'; diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts index c21be1bddb2..88e604c36b8 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts @@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { legacySchoolDoFactory, userDoFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { MigrationCheckService } from './migration-check.service'; diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts index ec39a619ef7..29b8a823171 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { EntityId, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; @Injectable() diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index dad2d2451aa..4b43f5722ad 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -8,7 +8,7 @@ import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-log import { legacySchoolDoFactory, setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { OAuthMigrationError } from '@src/modules/user-login-migration/error/oauth-migration.error'; import { SchoolMigrationService } from './school-migration.service'; diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts index 79e5a05e0d9..64a46883b8e 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts @@ -3,7 +3,7 @@ import { ValidationError } from '@shared/common'; import { Page, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacyLogger } from '@src/core/logger'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { performance } from 'perf_hooks'; import { OAuthMigrationError } from '../error'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts index cf680799ca1..d4eb320249b 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { SchoolFeatures } from '@shared/domain'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { setupEntities, userLoginMigrationDOFactory } from '@shared/testing'; import { UserLoginMigrationRevertService } from './user-login-migration-revert.service'; import { UserLoginMigrationService } from './user-login-migration.service'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts index 41d4234bc70..60298454529 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { SchoolFeatures, UserLoginMigrationDO } from '@shared/domain'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserLoginMigrationService } from './user-login-migration.service'; @Injectable() diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts index bec32e35a3d..9234e040f14 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts @@ -6,7 +6,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { EntityId, LegacySchoolDo, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { legacySchoolDoFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts index c094e193d5b..a39346d19b0 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts @@ -2,7 +2,7 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { Injectable, InternalServerErrorException, UnprocessableEntityException } from '@nestjs/common'; import { EntityId, LegacySchoolDo, SchoolFeatures, SystemTypeEnum, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemDto, SystemService } from '@src/modules/system'; import { UserService } from '@src/modules/user'; import { UserLoginMigrationNotFoundLoggableException } from '../error'; diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts index 5d94187702a..d3c94099097 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts @@ -9,7 +9,7 @@ import { legacySchoolDoFactory, setupEntities, userDoFactory } from '@shared/tes import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto, AccountSaveDto } from '@src/modules/account/services/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto } from '@src/modules/system/service/dto/oauth-config.dto'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts index d2611b25b72..3458a82baaa 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts @@ -5,7 +5,7 @@ import { UserDO } from '@shared/domain/domainobject/user.do'; import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SystemDto, SystemService } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; import { EntityId } from '@src/shared/domain/types'; diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts index e2c9218322b..825014e6344 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts index 88764a756ae..4d377db41f3 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts index ab937d679fd..ef0a4e02066 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationService } from '../service'; import { StartUserLoginMigrationUc } from './start-user-login-migration.uc'; diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts index 5949855f42e..de033f77294 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationStartLoggable } from '../loggable'; import { UserLoginMigrationService } from '../service'; diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts index edd1f455aa4..252d609605b 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts index 06bd00323a5..107d869ae45 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts index 6f6bb0f4a9a..50ddb047711 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts @@ -18,7 +18,7 @@ import { OAuthTokenDto } from '@src/modules/oauth'; import { OAuthService } from '@src/modules/oauth/service/oauth.service'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { Oauth2MigrationParams } from '../controller/dto/oauth2-migration.params'; import { OAuthMigrationError, SchoolMigrationError, UserLoginMigrationError } from '../error'; import { PageTypes } from '../interface/page-types.enum'; diff --git a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts index 5b85a235aab..c46ea525c6b 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts @@ -4,7 +4,7 @@ import { AuthenticationModule } from '@src/modules/authentication/authentication import { AuthorizationModule } from '@src/modules/authorization'; import { OauthModule } from '@src/modules/oauth'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { UserLoginMigrationController } from './controller/user-login-migration.controller'; import { UserMigrationController } from './controller/user-migration.controller'; import { PageContentMapper } from './mapper'; diff --git a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts index c18274f9d69..dfb119ce06b 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; -import { SchoolModule } from '@src/modules/school'; +import { SchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index 6d1dfde6fef..598d95ae47e 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,7 +4,7 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { SchoolModule } from '@src/modules/school/school.module'; +import { SchoolModule } from '@src/modules/school-migration/school.module'; import { UserService } from './service/user.service'; @Module({ diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts index 34441abe2f7..dc2592ab807 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts @@ -19,7 +19,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { courseFactory, roleFactory, setupEntities, userDoFactory } from '@shared/testing'; import { videoConferenceDOFactory } from '@shared/testing/factory/video-conference.do.factory'; diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.ts b/apps/server/src/modules/video-conference/service/video-conference.service.ts index 55b24036ccc..5537e59fd78 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.ts @@ -22,7 +22,7 @@ import { AuthorizationService, } from '@src/modules/authorization'; import { CourseService } from '@src/modules/learnroom/service/course.service'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { UserService } from '@src/modules/user'; import { BBBRole } from '../bbb'; import { ErrorStatus } from '../error/error-status.enum'; diff --git a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts index 023de7db7ce..6cad2d6e813 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts @@ -24,7 +24,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school'; +import { LegacySchoolService } from '@src/modules/school-migration'; import { CourseService } from '@src/modules/learnroom/service/course.service'; import { UserService } from '@src/modules/user'; import { IScopeInfo, VideoConference, VideoConferenceInfo, VideoConferenceJoin, VideoConferenceState } from './dto'; diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index 21ea09201b9..d547045ee46 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { SchoolModule } from '@src/modules/school/school.module'; +import { SchoolModule } from '@src/modules/school-migration/school.module'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; From 2990193808631fe32a965c83f12bad03ec9eb5ca Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Tue, 5 Sep 2023 15:00:44 +0200 Subject: [PATCH 17/29] Rename school module --- .../src/modules/authorization/authorization.module.ts | 10 ++++++++-- apps/server/src/modules/oauth/oauth-api.module.ts | 4 ++-- apps/server/src/modules/oauth/oauth.module.ts | 4 ++-- .../src/modules/provisioning/provisioning.module.ts | 4 ++-- .../src/modules/school-migration/school-api.module.ts | 4 ++-- .../src/modules/school-migration/school.module.ts | 2 +- .../src/modules/tool/common/common-tool.module.ts | 4 ++-- apps/server/src/modules/tool/tool-api.module.ts | 4 ++-- .../src/modules/tool/tool-launch/tool-launch.module.ts | 4 ++-- .../src/modules/user-import/user-import.module.ts | 4 ++-- .../user-login-migration-api.module.ts | 4 ++-- .../user-login-migration.module.ts | 4 ++-- apps/server/src/modules/user/user.module.ts | 4 ++-- .../video-conference/video-conference.module.ts | 4 ++-- 14 files changed, 33 insertions(+), 27 deletions(-) diff --git a/apps/server/src/modules/authorization/authorization.module.ts b/apps/server/src/modules/authorization/authorization.module.ts index 7ca73d81448..3ded5452d1b 100644 --- a/apps/server/src/modules/authorization/authorization.module.ts +++ b/apps/server/src/modules/authorization/authorization.module.ts @@ -13,7 +13,7 @@ import { UserRepo, } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { ToolModule } from '@src/modules/tool'; import { BoardModule } from '../board'; import { AuthorizationHelper } from './authorization.helper'; @@ -24,7 +24,13 @@ import { RuleManager } from './rule-manager'; @Module({ // TODO: remove forwardRef to TooModule N21-1055 - imports: [FeathersModule, LoggerModule, SchoolModule, forwardRef(() => ToolModule), forwardRef(() => BoardModule)], + imports: [ + FeathersModule, + LoggerModule, + SchoolMigrationModule, + forwardRef(() => ToolModule), + forwardRef(() => BoardModule), + ], providers: [ FeathersAuthorizationService, FeathersAuthProvider, diff --git a/apps/server/src/modules/oauth/oauth-api.module.ts b/apps/server/src/modules/oauth/oauth-api.module.ts index 0779ff7b9b2..158944005b5 100644 --- a/apps/server/src/modules/oauth/oauth-api.module.ts +++ b/apps/server/src/modules/oauth/oauth-api.module.ts @@ -3,7 +3,7 @@ import { LoggerModule } from '@src/core/logger'; import { AuthenticationModule } from '@src/modules/authentication/authentication.module'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; @@ -17,7 +17,7 @@ import { HydraOauthUc, OauthUc } from './uc'; AuthenticationModule, AuthorizationModule, ProvisioningModule, - SchoolModule, + SchoolMigrationModule, UserLoginMigrationModule, SystemModule, UserModule, diff --git a/apps/server/src/modules/oauth/oauth.module.ts b/apps/server/src/modules/oauth/oauth.module.ts index 156eab35cbd..4009084c108 100644 --- a/apps/server/src/modules/oauth/oauth.module.ts +++ b/apps/server/src/modules/oauth/oauth.module.ts @@ -6,7 +6,7 @@ import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; @@ -25,7 +25,7 @@ import { OAuthService } from './service/oauth.service'; SystemModule, UserLoginMigrationModule, CacheWrapperModule, - SchoolModule, + SchoolMigrationModule, ], providers: [OAuthService, OauthAdapterService, HydraSsoService, LtiToolRepo], exports: [OAuthService, HydraSsoService], diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index 1064097128f..efd6364b2af 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { SchoolModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; @@ -12,7 +12,7 @@ import { OidcProvisioningService } from './strategy/oidc/service/oidc-provisioni import { SanisResponseMapper } from './strategy/sanis/sanis-response.mapper'; @Module({ - imports: [AccountModule, SchoolModule, UserModule, RoleModule, SystemModule, HttpModule, LoggerModule], + imports: [AccountModule, SchoolMigrationModule, UserModule, RoleModule, SystemModule, HttpModule, LoggerModule], providers: [ ProvisioningService, SanisResponseMapper, diff --git a/apps/server/src/modules/school-migration/school-api.module.ts b/apps/server/src/modules/school-migration/school-api.module.ts index e4acf39aa9e..1708ee06cb9 100644 --- a/apps/server/src/modules/school-migration/school-api.module.ts +++ b/apps/server/src/modules/school-migration/school-api.module.ts @@ -3,12 +3,12 @@ import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; -import { SchoolModule } from './school.module'; +import { SchoolMigrationModule } from './school.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; @Module({ - imports: [SchoolModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], + imports: [SchoolMigrationModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], controllers: [SchoolController], providers: [LegacySchoolUc, MigrationMapper], }) diff --git a/apps/server/src/modules/school-migration/school.module.ts b/apps/server/src/modules/school-migration/school.module.ts index 5afc3087beb..4fa40246f03 100644 --- a/apps/server/src/modules/school-migration/school.module.ts +++ b/apps/server/src/modules/school-migration/school.module.ts @@ -17,4 +17,4 @@ import { FederalStateService, LegacySchoolService, SchoolValidationService, Scho ], exports: [LegacySchoolService, SchoolYearService, FederalStateService], }) -export class SchoolModule {} +export class SchoolMigrationModule {} diff --git a/apps/server/src/modules/tool/common/common-tool.module.ts b/apps/server/src/modules/tool/common/common-tool.module.ts index c5463e223b7..10b031b5133 100644 --- a/apps/server/src/modules/tool/common/common-tool.module.ts +++ b/apps/server/src/modules/tool/common/common-tool.module.ts @@ -2,12 +2,12 @@ import { forwardRef, Module } from '@nestjs/common'; import { ContextExternalToolRepo, SchoolExternalToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { CommonToolService, CommonToolValidationService } from './service'; import { ToolPermissionHelper } from './uc/tool-permission-helper'; @Module({ - imports: [LoggerModule, forwardRef(() => AuthorizationModule), SchoolModule], + imports: [LoggerModule, forwardRef(() => AuthorizationModule), SchoolMigrationModule], // TODO: make deletion of entities cascading, adjust ExternalToolService.deleteExternalTool and remove the repos from here providers: [ CommonToolService, diff --git a/apps/server/src/modules/tool/tool-api.module.ts b/apps/server/src/modules/tool/tool-api.module.ts index f5d7e0f834b..3f39200a690 100644 --- a/apps/server/src/modules/tool/tool-api.module.ts +++ b/apps/server/src/modules/tool/tool-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { ToolContextController } from './context-external-tool/controller'; import { ContextExternalToolUc } from './context-external-tool/uc'; @@ -26,7 +26,7 @@ import { CommonToolModule } from './common'; UserModule, AuthorizationModule, LoggerModule, - SchoolModule, + SchoolMigrationModule, ToolConfigModule, ], controllers: [ diff --git a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts index 7ba04ba55f9..f36e6209364 100644 --- a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts +++ b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { PseudonymModule } from '@src/modules/pseudonym'; import { CourseRepo } from '@shared/repo'; @@ -16,7 +16,7 @@ import { CommonToolModule } from '../common'; ExternalToolModule, SchoolExternalToolModule, ContextExternalToolModule, - SchoolModule, + SchoolMigrationModule, UserModule, PseudonymModule, ], diff --git a/apps/server/src/modules/user-import/user-import.module.ts b/apps/server/src/modules/user-import/user-import.module.ts index aac78142f51..9085f260501 100644 --- a/apps/server/src/modules/user-import/user-import.module.ts +++ b/apps/server/src/modules/user-import/user-import.module.ts @@ -1,14 +1,14 @@ import { Module } from '@nestjs/common'; import { ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { AccountModule } from '../account'; import { AuthorizationModule } from '../authorization'; import { ImportUserController } from './controller/import-user.controller'; import { UserImportUc } from './uc/user-import.uc'; @Module({ - imports: [LoggerModule, AccountModule, SchoolModule, AuthorizationModule], + imports: [LoggerModule, AccountModule, SchoolMigrationModule, AuthorizationModule], controllers: [ImportUserController], providers: [UserImportUc, ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo], exports: [], diff --git a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts index c46ea525c6b..fa8d7386515 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts @@ -4,7 +4,7 @@ import { AuthenticationModule } from '@src/modules/authentication/authentication import { AuthorizationModule } from '@src/modules/authorization'; import { OauthModule } from '@src/modules/oauth'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { UserLoginMigrationController } from './controller/user-login-migration.controller'; import { UserMigrationController } from './controller/user-migration.controller'; import { PageContentMapper } from './mapper'; @@ -25,7 +25,7 @@ import { UserLoginMigrationModule } from './user-login-migration.module'; AuthenticationModule, AuthorizationModule, LoggerModule, - SchoolModule, + SchoolMigrationModule, ], providers: [ UserLoginMigrationUc, diff --git a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts index dfb119ce06b..62114c1afad 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; -import { SchoolModule } from '@src/modules/school-migration'; +import { SchoolMigrationModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { @@ -14,7 +14,7 @@ import { } from './service'; @Module({ - imports: [UserModule, SchoolModule, LoggerModule, AccountModule, SystemModule], + imports: [UserModule, SchoolMigrationModule, LoggerModule, AccountModule, SystemModule], providers: [ UserMigrationService, SchoolMigrationService, diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index 598d95ae47e..ba538fb4a04 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,11 +4,11 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { SchoolModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; import { UserService } from './service/user.service'; @Module({ - imports: [SchoolModule, RoleModule, AccountModule, LoggerModule], + imports: [SchoolMigrationModule, RoleModule, AccountModule, LoggerModule], providers: [UserRepo, UserDORepo, UserService], exports: [UserService, UserRepo], }) diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index d547045ee46..1820e1f2d0a 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { SchoolModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; @@ -21,7 +21,7 @@ import { LearnroomModule } from '../learnroom'; AuthorizationModule, CalendarModule, HttpModule, - SchoolModule, + SchoolMigrationModule, LoggerModule, UserModule, LearnroomModule, From 1948de2b3ee8b6fb569a0f0c4900bcca827e6b6c Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Tue, 5 Sep 2023 15:02:11 +0200 Subject: [PATCH 18/29] Rename school module file --- apps/server/src/modules/provisioning/provisioning.module.ts | 2 +- apps/server/src/modules/school-migration/index.ts | 2 +- apps/server/src/modules/school-migration/school-api.module.ts | 2 +- .../{school.module.ts => school-migration.module.ts} | 0 apps/server/src/modules/user/user.module.ts | 2 +- .../src/modules/video-conference/video-conference.module.ts | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename apps/server/src/modules/school-migration/{school.module.ts => school-migration.module.ts} (100%) diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index efd6364b2af..6c920f84190 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; diff --git a/apps/server/src/modules/school-migration/index.ts b/apps/server/src/modules/school-migration/index.ts index 49cfd4c9e39..b8509d36398 100644 --- a/apps/server/src/modules/school-migration/index.ts +++ b/apps/server/src/modules/school-migration/index.ts @@ -1,2 +1,2 @@ -export * from './school.module'; +export * from './school-migration.module'; export * from './service'; diff --git a/apps/server/src/modules/school-migration/school-api.module.ts b/apps/server/src/modules/school-migration/school-api.module.ts index 1708ee06cb9..d478768bcfd 100644 --- a/apps/server/src/modules/school-migration/school-api.module.ts +++ b/apps/server/src/modules/school-migration/school-api.module.ts @@ -3,7 +3,7 @@ import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; -import { SchoolMigrationModule } from './school.module'; +import { SchoolMigrationModule } from './school-migration.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; diff --git a/apps/server/src/modules/school-migration/school.module.ts b/apps/server/src/modules/school-migration/school-migration.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/school.module.ts rename to apps/server/src/modules/school-migration/school-migration.module.ts diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index ba538fb4a04..ddae3a56f82 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,7 +4,7 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; import { UserService } from './service/user.service'; @Module({ diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index 1820e1f2d0a..66a26d61764 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school.module'; +import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; From f09fea2d0501c84e580decc438cd3aaf75d7b92c Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Tue, 5 Sep 2023 15:03:03 +0200 Subject: [PATCH 19/29] Rename SchoolApiModule --- apps/server/src/modules/school-migration/school-api.module.ts | 2 +- apps/server/src/modules/server/server.module.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/modules/school-migration/school-api.module.ts b/apps/server/src/modules/school-migration/school-api.module.ts index d478768bcfd..ab56677f64a 100644 --- a/apps/server/src/modules/school-migration/school-api.module.ts +++ b/apps/server/src/modules/school-migration/school-api.module.ts @@ -12,4 +12,4 @@ import { MigrationMapper } from './mapper/migration.mapper'; controllers: [SchoolController], providers: [LegacySchoolUc, MigrationMapper], }) -export class SchoolApiModule {} +export class SchoolMigrationApiModule {} diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index 3d2e152ee45..8676e354da1 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -22,7 +22,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { SchoolApiModule } from '@src/modules/school-migration/school-api.module'; +import { SchoolMigrationApiModule } from '@src/modules/school-migration/school-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; @@ -63,7 +63,7 @@ const serverModules = [ adminUser: Configuration.get('ROCKET_CHAT_ADMIN_USER') as string, adminPassword: Configuration.get('ROCKET_CHAT_ADMIN_PASSWORD') as string, }), - SchoolApiModule, + SchoolMigrationApiModule, VideoConferenceApiModule, OauthProviderApiModule, SharingApiModule, From 6fa45634550242c658c0b363856841ce91cc18b1 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Tue, 5 Sep 2023 16:43:28 +0200 Subject: [PATCH 20/29] Rename SchoolApiModule file --- .../{school-api.module.ts => school-migration-api.module.ts} | 0 apps/server/src/modules/server/server.module.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename apps/server/src/modules/school-migration/{school-api.module.ts => school-migration-api.module.ts} (100%) diff --git a/apps/server/src/modules/school-migration/school-api.module.ts b/apps/server/src/modules/school-migration/school-migration-api.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/school-api.module.ts rename to apps/server/src/modules/school-migration/school-migration-api.module.ts diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index 8676e354da1..05e386af476 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -22,7 +22,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { SchoolMigrationApiModule } from '@src/modules/school-migration/school-api.module'; +import { SchoolMigrationApiModule } from '@src/modules/school-migration/school-migration-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; From 5d10a41119dfcc3b878062c81e2a2142a3e6083a Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:04:23 +0200 Subject: [PATCH 21/29] Rename module --- apps/server/src/modules/authorization/authorization.module.ts | 4 ++-- apps/server/src/modules/oauth/oauth-api.module.ts | 4 ++-- apps/server/src/modules/oauth/oauth.module.ts | 4 ++-- apps/server/src/modules/provisioning/provisioning.module.ts | 4 ++-- .../modules/school-migration/school-migration-api.module.ts | 4 ++-- .../src/modules/school-migration/school-migration.module.ts | 2 +- apps/server/src/modules/tool/common/common-tool.module.ts | 4 ++-- apps/server/src/modules/tool/tool-api.module.ts | 4 ++-- .../server/src/modules/tool/tool-launch/tool-launch.module.ts | 4 ++-- apps/server/src/modules/user-import/user-import.module.ts | 4 ++-- .../user-login-migration/user-login-migration-api.module.ts | 4 ++-- .../user-login-migration/user-login-migration.module.ts | 4 ++-- apps/server/src/modules/user/user.module.ts | 4 ++-- .../src/modules/video-conference/video-conference.module.ts | 4 ++-- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/apps/server/src/modules/authorization/authorization.module.ts b/apps/server/src/modules/authorization/authorization.module.ts index 3ded5452d1b..9a27899edcb 100644 --- a/apps/server/src/modules/authorization/authorization.module.ts +++ b/apps/server/src/modules/authorization/authorization.module.ts @@ -13,7 +13,7 @@ import { UserRepo, } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { ToolModule } from '@src/modules/tool'; import { BoardModule } from '../board'; import { AuthorizationHelper } from './authorization.helper'; @@ -27,7 +27,7 @@ import { RuleManager } from './rule-manager'; imports: [ FeathersModule, LoggerModule, - SchoolMigrationModule, + LegacySchoolModule, forwardRef(() => ToolModule), forwardRef(() => BoardModule), ], diff --git a/apps/server/src/modules/oauth/oauth-api.module.ts b/apps/server/src/modules/oauth/oauth-api.module.ts index 158944005b5..d1af5b3c66d 100644 --- a/apps/server/src/modules/oauth/oauth-api.module.ts +++ b/apps/server/src/modules/oauth/oauth-api.module.ts @@ -3,7 +3,7 @@ import { LoggerModule } from '@src/core/logger'; import { AuthenticationModule } from '@src/modules/authentication/authentication.module'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; @@ -17,7 +17,7 @@ import { HydraOauthUc, OauthUc } from './uc'; AuthenticationModule, AuthorizationModule, ProvisioningModule, - SchoolMigrationModule, + LegacySchoolModule, UserLoginMigrationModule, SystemModule, UserModule, diff --git a/apps/server/src/modules/oauth/oauth.module.ts b/apps/server/src/modules/oauth/oauth.module.ts index 4009084c108..f334f1d5c50 100644 --- a/apps/server/src/modules/oauth/oauth.module.ts +++ b/apps/server/src/modules/oauth/oauth.module.ts @@ -6,7 +6,7 @@ import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; @@ -25,7 +25,7 @@ import { OAuthService } from './service/oauth.service'; SystemModule, UserLoginMigrationModule, CacheWrapperModule, - SchoolMigrationModule, + LegacySchoolModule, ], providers: [OAuthService, OauthAdapterService, HydraSsoService, LtiToolRepo], exports: [OAuthService, HydraSsoService], diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index 6c920f84190..7e69d736f12 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; @@ -12,7 +12,7 @@ import { OidcProvisioningService } from './strategy/oidc/service/oidc-provisioni import { SanisResponseMapper } from './strategy/sanis/sanis-response.mapper'; @Module({ - imports: [AccountModule, SchoolMigrationModule, UserModule, RoleModule, SystemModule, HttpModule, LoggerModule], + imports: [AccountModule, LegacySchoolModule, UserModule, RoleModule, SystemModule, HttpModule, LoggerModule], providers: [ ProvisioningService, SanisResponseMapper, diff --git a/apps/server/src/modules/school-migration/school-migration-api.module.ts b/apps/server/src/modules/school-migration/school-migration-api.module.ts index ab56677f64a..d5af0de48d7 100644 --- a/apps/server/src/modules/school-migration/school-migration-api.module.ts +++ b/apps/server/src/modules/school-migration/school-migration-api.module.ts @@ -3,12 +3,12 @@ import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; -import { SchoolMigrationModule } from './school-migration.module'; +import { LegacySchoolModule } from './school-migration.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; @Module({ - imports: [SchoolMigrationModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], + imports: [LegacySchoolModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], controllers: [SchoolController], providers: [LegacySchoolUc, MigrationMapper], }) diff --git a/apps/server/src/modules/school-migration/school-migration.module.ts b/apps/server/src/modules/school-migration/school-migration.module.ts index 4fa40246f03..e472bd94635 100644 --- a/apps/server/src/modules/school-migration/school-migration.module.ts +++ b/apps/server/src/modules/school-migration/school-migration.module.ts @@ -17,4 +17,4 @@ import { FederalStateService, LegacySchoolService, SchoolValidationService, Scho ], exports: [LegacySchoolService, SchoolYearService, FederalStateService], }) -export class SchoolMigrationModule {} +export class LegacySchoolModule {} diff --git a/apps/server/src/modules/tool/common/common-tool.module.ts b/apps/server/src/modules/tool/common/common-tool.module.ts index 10b031b5133..fd612e642b1 100644 --- a/apps/server/src/modules/tool/common/common-tool.module.ts +++ b/apps/server/src/modules/tool/common/common-tool.module.ts @@ -2,12 +2,12 @@ import { forwardRef, Module } from '@nestjs/common'; import { ContextExternalToolRepo, SchoolExternalToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { CommonToolService, CommonToolValidationService } from './service'; import { ToolPermissionHelper } from './uc/tool-permission-helper'; @Module({ - imports: [LoggerModule, forwardRef(() => AuthorizationModule), SchoolMigrationModule], + imports: [LoggerModule, forwardRef(() => AuthorizationModule), LegacySchoolModule], // TODO: make deletion of entities cascading, adjust ExternalToolService.deleteExternalTool and remove the repos from here providers: [ CommonToolService, diff --git a/apps/server/src/modules/tool/tool-api.module.ts b/apps/server/src/modules/tool/tool-api.module.ts index 3f39200a690..0d44284f4fe 100644 --- a/apps/server/src/modules/tool/tool-api.module.ts +++ b/apps/server/src/modules/tool/tool-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { ToolContextController } from './context-external-tool/controller'; import { ContextExternalToolUc } from './context-external-tool/uc'; @@ -26,7 +26,7 @@ import { CommonToolModule } from './common'; UserModule, AuthorizationModule, LoggerModule, - SchoolMigrationModule, + LegacySchoolModule, ToolConfigModule, ], controllers: [ diff --git a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts index f36e6209364..587b5e12ae3 100644 --- a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts +++ b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { UserModule } from '@src/modules/user'; import { PseudonymModule } from '@src/modules/pseudonym'; import { CourseRepo } from '@shared/repo'; @@ -16,7 +16,7 @@ import { CommonToolModule } from '../common'; ExternalToolModule, SchoolExternalToolModule, ContextExternalToolModule, - SchoolMigrationModule, + LegacySchoolModule, UserModule, PseudonymModule, ], diff --git a/apps/server/src/modules/user-import/user-import.module.ts b/apps/server/src/modules/user-import/user-import.module.ts index 9085f260501..fba1aa4ad74 100644 --- a/apps/server/src/modules/user-import/user-import.module.ts +++ b/apps/server/src/modules/user-import/user-import.module.ts @@ -1,14 +1,14 @@ import { Module } from '@nestjs/common'; import { ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { AccountModule } from '../account'; import { AuthorizationModule } from '../authorization'; import { ImportUserController } from './controller/import-user.controller'; import { UserImportUc } from './uc/user-import.uc'; @Module({ - imports: [LoggerModule, AccountModule, SchoolMigrationModule, AuthorizationModule], + imports: [LoggerModule, AccountModule, LegacySchoolModule, AuthorizationModule], controllers: [ImportUserController], providers: [UserImportUc, ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo], exports: [], diff --git a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts index fa8d7386515..5c1122a1c31 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts @@ -4,7 +4,7 @@ import { AuthenticationModule } from '@src/modules/authentication/authentication import { AuthorizationModule } from '@src/modules/authorization'; import { OauthModule } from '@src/modules/oauth'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { UserLoginMigrationController } from './controller/user-login-migration.controller'; import { UserMigrationController } from './controller/user-migration.controller'; import { PageContentMapper } from './mapper'; @@ -25,7 +25,7 @@ import { UserLoginMigrationModule } from './user-login-migration.module'; AuthenticationModule, AuthorizationModule, LoggerModule, - SchoolMigrationModule, + LegacySchoolModule, ], providers: [ UserLoginMigrationUc, diff --git a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts index 62114c1afad..a7489f4fe2c 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; -import { SchoolMigrationModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { @@ -14,7 +14,7 @@ import { } from './service'; @Module({ - imports: [UserModule, SchoolMigrationModule, LoggerModule, AccountModule, SystemModule], + imports: [UserModule, LegacySchoolModule, LoggerModule, AccountModule, SystemModule], providers: [ UserMigrationService, SchoolMigrationService, diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index ddae3a56f82..7c71bac638d 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,11 +4,11 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; import { UserService } from './service/user.service'; @Module({ - imports: [SchoolMigrationModule, RoleModule, AccountModule, LoggerModule], + imports: [LegacySchoolModule, RoleModule, AccountModule, LoggerModule], providers: [UserRepo, UserDORepo, UserService], exports: [UserService, UserRepo], }) diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index 66a26d61764..ad2bc27d274 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { SchoolMigrationModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; @@ -21,7 +21,7 @@ import { LearnroomModule } from '../learnroom'; AuthorizationModule, CalendarModule, HttpModule, - SchoolMigrationModule, + LegacySchoolModule, LoggerModule, UserModule, LearnroomModule, From aa2cdc62777583e1086103b55ed830ac64026b11 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:28:53 +0200 Subject: [PATCH 22/29] Rename module file --- apps/server/src/modules/provisioning/provisioning.module.ts | 2 +- apps/server/src/modules/school-migration/index.ts | 2 +- .../{school-migration.module.ts => legacy-school.module.ts} | 0 .../src/modules/school-migration/school-migration-api.module.ts | 2 +- apps/server/src/modules/user/user.module.ts | 2 +- .../src/modules/video-conference/video-conference.module.ts | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename apps/server/src/modules/school-migration/{school-migration.module.ts => legacy-school.module.ts} (100%) diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index 7e69d736f12..427509d7754 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; diff --git a/apps/server/src/modules/school-migration/index.ts b/apps/server/src/modules/school-migration/index.ts index b8509d36398..8d7162ddf07 100644 --- a/apps/server/src/modules/school-migration/index.ts +++ b/apps/server/src/modules/school-migration/index.ts @@ -1,2 +1,2 @@ -export * from './school-migration.module'; +export * from './legacy-school.module'; export * from './service'; diff --git a/apps/server/src/modules/school-migration/school-migration.module.ts b/apps/server/src/modules/school-migration/legacy-school.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/school-migration.module.ts rename to apps/server/src/modules/school-migration/legacy-school.module.ts diff --git a/apps/server/src/modules/school-migration/school-migration-api.module.ts b/apps/server/src/modules/school-migration/school-migration-api.module.ts index d5af0de48d7..737bf26b2df 100644 --- a/apps/server/src/modules/school-migration/school-migration-api.module.ts +++ b/apps/server/src/modules/school-migration/school-migration-api.module.ts @@ -3,7 +3,7 @@ import { AuthorizationModule } from '@src/modules/authorization'; import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; -import { LegacySchoolModule } from './school-migration.module'; +import { LegacySchoolModule } from './legacy-school.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index 7c71bac638d..bb3906e5a50 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,7 +4,7 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { UserService } from './service/user.service'; @Module({ diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index ad2bc27d274..5e1740a3734 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { LegacySchoolModule } from '@src/modules/school-migration/school-migration.module'; +import { LegacySchoolModule } from '@src/modules/school-migration'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; From 05b4c9288e744d7361539cdc53a7f7c548fa9dc4 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:29:54 +0200 Subject: [PATCH 23/29] Rename api module --- .../modules/school-migration/school-migration-api.module.ts | 2 +- apps/server/src/modules/server/server.module.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/server/src/modules/school-migration/school-migration-api.module.ts b/apps/server/src/modules/school-migration/school-migration-api.module.ts index 737bf26b2df..cb602b1cd6c 100644 --- a/apps/server/src/modules/school-migration/school-migration-api.module.ts +++ b/apps/server/src/modules/school-migration/school-migration-api.module.ts @@ -12,4 +12,4 @@ import { MigrationMapper } from './mapper/migration.mapper'; controllers: [SchoolController], providers: [LegacySchoolUc, MigrationMapper], }) -export class SchoolMigrationApiModule {} +export class LegacySchoolApiModule {} diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index 93eb1fb78cb..2e234a42c65 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -23,7 +23,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { SchoolMigrationApiModule } from '@src/modules/school-migration/school-migration-api.module'; +import { LegacySchoolApiModule } from '@src/modules/school-migration/school-migration-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; @@ -64,7 +64,7 @@ const serverModules = [ adminUser: Configuration.get('ROCKET_CHAT_ADMIN_USER') as string, adminPassword: Configuration.get('ROCKET_CHAT_ADMIN_PASSWORD') as string, }), - SchoolMigrationApiModule, + LegacySchoolApiModule, VideoConferenceApiModule, OauthProviderApiModule, SharingApiModule, From 6088d6183d7f4e6e0293714ba7a1903f259b3ad3 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:31:10 +0200 Subject: [PATCH 24/29] Rename api module file --- ...hool-migration-api.module.ts => legacy-school-api.module.ts} | 0 apps/server/src/modules/server/server.module.ts | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename apps/server/src/modules/school-migration/{school-migration-api.module.ts => legacy-school-api.module.ts} (100%) diff --git a/apps/server/src/modules/school-migration/school-migration-api.module.ts b/apps/server/src/modules/school-migration/legacy-school-api.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/school-migration-api.module.ts rename to apps/server/src/modules/school-migration/legacy-school-api.module.ts diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index 2e234a42c65..e8525e3800e 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -23,7 +23,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { LegacySchoolApiModule } from '@src/modules/school-migration/school-migration-api.module'; +import { LegacySchoolApiModule } from '@src/modules/school-migration/legacy-school-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; From be06e535cf3e68fb1e3dbdae1090aca77c0469ae Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:40:52 +0200 Subject: [PATCH 25/29] Rename folder --- apps/server/src/modules/authorization/authorization.module.ts | 2 +- apps/server/src/modules/index.ts | 2 +- .../controller/dto/index.ts | 0 .../controller/dto/migration.body.ts | 0 .../controller/dto/migration.response.ts | 0 .../controller/dto/school.params.ts | 0 .../controller/school.controller.spec.ts | 0 .../controller/school.controller.ts | 0 .../{school-migration => legacy-school}/error/index.ts | 0 .../error/school-number-duplicate.loggable-exception.spec.ts | 0 .../error/school-number-duplicate.loggable-exception.ts | 0 .../src/modules/{school-migration => legacy-school}/index.ts | 0 .../legacy-school-api.module.ts | 0 .../legacy-school.module.ts | 0 .../mapper/migration.mapper.spec.ts | 0 .../mapper/migration.mapper.ts | 0 .../modules/{school-migration => legacy-school}/repo/index.ts | 0 .../repo/schoolyear.repo.integration.spec.ts | 0 .../repo/schoolyear.repo.ts | 0 .../service/federal-state.service.spec.ts | 0 .../service/federal-state.service.ts | 0 .../{school-migration => legacy-school}/service/index.ts | 0 .../service/legacy-school.service.spec.ts | 0 .../service/legacy-school.service.ts | 0 .../service/school-year.service.spec.ts | 0 .../service/school-year.service.ts | 0 .../service/validation/index.ts | 0 .../service/validation/school-validation.service.spec.ts | 0 .../service/validation/school-validation.service.ts | 0 .../types/federal-state-names.enum.ts | 0 .../{school-migration => legacy-school}/types/index.ts | 0 .../uc/dto/oauth-migration.dto.ts | 0 .../modules/{school-migration => legacy-school}/uc/index.ts | 0 .../uc/legacy-school.uc.spec.ts | 4 ++-- .../uc/legacy-school.uc.ts | 0 apps/server/src/modules/oauth/oauth-api.module.ts | 2 +- apps/server/src/modules/oauth/oauth.module.ts | 2 +- apps/server/src/modules/oauth/service/oauth.service.spec.ts | 2 +- apps/server/src/modules/oauth/service/oauth.service.ts | 2 +- apps/server/src/modules/oauth/uc/oauth.uc.spec.ts | 2 +- apps/server/src/modules/provisioning/provisioning.module.ts | 2 +- .../provisioning/strategy/iserv/iserv.strategy.spec.ts | 2 +- .../src/modules/provisioning/strategy/iserv/iserv.strategy.ts | 2 +- .../strategy/oidc/service/oidc-provisioning.service.spec.ts | 2 +- .../strategy/oidc/service/oidc-provisioning.service.ts | 4 ++-- apps/server/src/modules/server/server.module.ts | 2 +- apps/server/src/modules/tool/common/common-tool.module.ts | 2 +- .../src/modules/tool/common/uc/tool-permission-helper.ts | 2 +- .../modules/tool/common/uc/tool-permissions-helper.spec.ts | 2 +- apps/server/src/modules/tool/tool-api.module.ts | 2 +- .../service/strategy/abstract-launch.strategy.spec.ts | 2 +- .../tool-launch/service/strategy/abstract-launch.strategy.ts | 2 +- .../service/strategy/basic-tool-launch.strategy.spec.ts | 2 +- .../service/strategy/lti11-tool-launch.strategy.spec.ts | 2 +- .../service/strategy/lti11-tool-launch.strategy.ts | 2 +- .../service/strategy/oauth2-tool-launch.strategy.spec.ts | 2 +- .../server/src/modules/tool/tool-launch/tool-launch.module.ts | 2 +- .../user-import/controller/import-user.controller.spec.ts | 2 +- apps/server/src/modules/user-import/uc/user-import.uc.spec.ts | 2 +- apps/server/src/modules/user-import/uc/user-import.uc.ts | 2 +- apps/server/src/modules/user-import/user-import.module.ts | 2 +- .../service/migration-check.service.spec.ts | 2 +- .../user-login-migration/service/migration-check.service.ts | 2 +- .../service/school-migration.service.spec.ts | 2 +- .../user-login-migration/service/school-migration.service.ts | 2 +- .../service/user-login-migration-revert.service.spec.ts | 2 +- .../service/user-login-migration-revert.service.ts | 2 +- .../service/user-login-migration.service.spec.ts | 2 +- .../service/user-login-migration.service.ts | 2 +- .../service/user-migration.service.spec.ts | 2 +- .../user-login-migration/service/user-migration.service.ts | 2 +- .../uc/restart-user-login-migration.uc.spec.ts | 2 +- .../uc/restart-user-login-migration.uc.ts | 2 +- .../uc/start-user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/uc/start-user-login-migration.uc.ts | 2 +- .../uc/toggle-user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/uc/toggle-user-login-migration.uc.ts | 2 +- .../user-login-migration/uc/user-login-migration.uc.spec.ts | 2 +- .../user-login-migration/user-login-migration-api.module.ts | 2 +- .../user-login-migration/user-login-migration.module.ts | 2 +- apps/server/src/modules/user/user.module.ts | 2 +- .../video-conference/service/video-conference.service.spec.ts | 2 +- .../video-conference/service/video-conference.service.ts | 2 +- .../video-conference/uc/video-conference-deprecated.uc.ts | 2 +- .../src/modules/video-conference/video-conference.module.ts | 2 +- 85 files changed, 55 insertions(+), 55 deletions(-) rename apps/server/src/modules/{school-migration => legacy-school}/controller/dto/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/controller/dto/migration.body.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/controller/dto/migration.response.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/controller/dto/school.params.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/controller/school.controller.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/controller/school.controller.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/error/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/error/school-number-duplicate.loggable-exception.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/error/school-number-duplicate.loggable-exception.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/legacy-school-api.module.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/legacy-school.module.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/mapper/migration.mapper.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/mapper/migration.mapper.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/repo/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/repo/schoolyear.repo.integration.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/repo/schoolyear.repo.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/federal-state.service.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/federal-state.service.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/legacy-school.service.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/legacy-school.service.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/school-year.service.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/school-year.service.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/validation/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/validation/school-validation.service.spec.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/service/validation/school-validation.service.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/types/federal-state-names.enum.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/types/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/uc/dto/oauth-migration.dto.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/uc/index.ts (100%) rename apps/server/src/modules/{school-migration => legacy-school}/uc/legacy-school.uc.spec.ts (98%) rename apps/server/src/modules/{school-migration => legacy-school}/uc/legacy-school.uc.ts (100%) diff --git a/apps/server/src/modules/authorization/authorization.module.ts b/apps/server/src/modules/authorization/authorization.module.ts index 9a27899edcb..c983ee187fd 100644 --- a/apps/server/src/modules/authorization/authorization.module.ts +++ b/apps/server/src/modules/authorization/authorization.module.ts @@ -13,7 +13,7 @@ import { UserRepo, } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { ToolModule } from '@src/modules/tool'; import { BoardModule } from '../board'; import { AuthorizationHelper } from './authorization.helper'; diff --git a/apps/server/src/modules/index.ts b/apps/server/src/modules/index.ts index 5dd57a73956..111a64d9f33 100644 --- a/apps/server/src/modules/index.ts +++ b/apps/server/src/modules/index.ts @@ -14,7 +14,7 @@ export * from './oauth-provider'; export * from './provisioning'; export * from './rocketchat'; export * from './role'; -export * from './school-migration'; +export * from './legacy-school'; export * from './sharing'; export * from './system'; export * from './task'; diff --git a/apps/server/src/modules/school-migration/controller/dto/index.ts b/apps/server/src/modules/legacy-school/controller/dto/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/dto/index.ts rename to apps/server/src/modules/legacy-school/controller/dto/index.ts diff --git a/apps/server/src/modules/school-migration/controller/dto/migration.body.ts b/apps/server/src/modules/legacy-school/controller/dto/migration.body.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/dto/migration.body.ts rename to apps/server/src/modules/legacy-school/controller/dto/migration.body.ts diff --git a/apps/server/src/modules/school-migration/controller/dto/migration.response.ts b/apps/server/src/modules/legacy-school/controller/dto/migration.response.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/dto/migration.response.ts rename to apps/server/src/modules/legacy-school/controller/dto/migration.response.ts diff --git a/apps/server/src/modules/school-migration/controller/dto/school.params.ts b/apps/server/src/modules/legacy-school/controller/dto/school.params.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/dto/school.params.ts rename to apps/server/src/modules/legacy-school/controller/dto/school.params.ts diff --git a/apps/server/src/modules/school-migration/controller/school.controller.spec.ts b/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/school.controller.spec.ts rename to apps/server/src/modules/legacy-school/controller/school.controller.spec.ts diff --git a/apps/server/src/modules/school-migration/controller/school.controller.ts b/apps/server/src/modules/legacy-school/controller/school.controller.ts similarity index 100% rename from apps/server/src/modules/school-migration/controller/school.controller.ts rename to apps/server/src/modules/legacy-school/controller/school.controller.ts diff --git a/apps/server/src/modules/school-migration/error/index.ts b/apps/server/src/modules/legacy-school/error/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/error/index.ts rename to apps/server/src/modules/legacy-school/error/index.ts diff --git a/apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.spec.ts b/apps/server/src/modules/legacy-school/error/school-number-duplicate.loggable-exception.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.spec.ts rename to apps/server/src/modules/legacy-school/error/school-number-duplicate.loggable-exception.spec.ts diff --git a/apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.ts b/apps/server/src/modules/legacy-school/error/school-number-duplicate.loggable-exception.ts similarity index 100% rename from apps/server/src/modules/school-migration/error/school-number-duplicate.loggable-exception.ts rename to apps/server/src/modules/legacy-school/error/school-number-duplicate.loggable-exception.ts diff --git a/apps/server/src/modules/school-migration/index.ts b/apps/server/src/modules/legacy-school/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/index.ts rename to apps/server/src/modules/legacy-school/index.ts diff --git a/apps/server/src/modules/school-migration/legacy-school-api.module.ts b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/legacy-school-api.module.ts rename to apps/server/src/modules/legacy-school/legacy-school-api.module.ts diff --git a/apps/server/src/modules/school-migration/legacy-school.module.ts b/apps/server/src/modules/legacy-school/legacy-school.module.ts similarity index 100% rename from apps/server/src/modules/school-migration/legacy-school.module.ts rename to apps/server/src/modules/legacy-school/legacy-school.module.ts diff --git a/apps/server/src/modules/school-migration/mapper/migration.mapper.spec.ts b/apps/server/src/modules/legacy-school/mapper/migration.mapper.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/mapper/migration.mapper.spec.ts rename to apps/server/src/modules/legacy-school/mapper/migration.mapper.spec.ts diff --git a/apps/server/src/modules/school-migration/mapper/migration.mapper.ts b/apps/server/src/modules/legacy-school/mapper/migration.mapper.ts similarity index 100% rename from apps/server/src/modules/school-migration/mapper/migration.mapper.ts rename to apps/server/src/modules/legacy-school/mapper/migration.mapper.ts diff --git a/apps/server/src/modules/school-migration/repo/index.ts b/apps/server/src/modules/legacy-school/repo/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/repo/index.ts rename to apps/server/src/modules/legacy-school/repo/index.ts diff --git a/apps/server/src/modules/school-migration/repo/schoolyear.repo.integration.spec.ts b/apps/server/src/modules/legacy-school/repo/schoolyear.repo.integration.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/repo/schoolyear.repo.integration.spec.ts rename to apps/server/src/modules/legacy-school/repo/schoolyear.repo.integration.spec.ts diff --git a/apps/server/src/modules/school-migration/repo/schoolyear.repo.ts b/apps/server/src/modules/legacy-school/repo/schoolyear.repo.ts similarity index 100% rename from apps/server/src/modules/school-migration/repo/schoolyear.repo.ts rename to apps/server/src/modules/legacy-school/repo/schoolyear.repo.ts diff --git a/apps/server/src/modules/school-migration/service/federal-state.service.spec.ts b/apps/server/src/modules/legacy-school/service/federal-state.service.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/federal-state.service.spec.ts rename to apps/server/src/modules/legacy-school/service/federal-state.service.spec.ts diff --git a/apps/server/src/modules/school-migration/service/federal-state.service.ts b/apps/server/src/modules/legacy-school/service/federal-state.service.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/federal-state.service.ts rename to apps/server/src/modules/legacy-school/service/federal-state.service.ts diff --git a/apps/server/src/modules/school-migration/service/index.ts b/apps/server/src/modules/legacy-school/service/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/index.ts rename to apps/server/src/modules/legacy-school/service/index.ts diff --git a/apps/server/src/modules/school-migration/service/legacy-school.service.spec.ts b/apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/legacy-school.service.spec.ts rename to apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts diff --git a/apps/server/src/modules/school-migration/service/legacy-school.service.ts b/apps/server/src/modules/legacy-school/service/legacy-school.service.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/legacy-school.service.ts rename to apps/server/src/modules/legacy-school/service/legacy-school.service.ts diff --git a/apps/server/src/modules/school-migration/service/school-year.service.spec.ts b/apps/server/src/modules/legacy-school/service/school-year.service.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/school-year.service.spec.ts rename to apps/server/src/modules/legacy-school/service/school-year.service.spec.ts diff --git a/apps/server/src/modules/school-migration/service/school-year.service.ts b/apps/server/src/modules/legacy-school/service/school-year.service.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/school-year.service.ts rename to apps/server/src/modules/legacy-school/service/school-year.service.ts diff --git a/apps/server/src/modules/school-migration/service/validation/index.ts b/apps/server/src/modules/legacy-school/service/validation/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/validation/index.ts rename to apps/server/src/modules/legacy-school/service/validation/index.ts diff --git a/apps/server/src/modules/school-migration/service/validation/school-validation.service.spec.ts b/apps/server/src/modules/legacy-school/service/validation/school-validation.service.spec.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/validation/school-validation.service.spec.ts rename to apps/server/src/modules/legacy-school/service/validation/school-validation.service.spec.ts diff --git a/apps/server/src/modules/school-migration/service/validation/school-validation.service.ts b/apps/server/src/modules/legacy-school/service/validation/school-validation.service.ts similarity index 100% rename from apps/server/src/modules/school-migration/service/validation/school-validation.service.ts rename to apps/server/src/modules/legacy-school/service/validation/school-validation.service.ts diff --git a/apps/server/src/modules/school-migration/types/federal-state-names.enum.ts b/apps/server/src/modules/legacy-school/types/federal-state-names.enum.ts similarity index 100% rename from apps/server/src/modules/school-migration/types/federal-state-names.enum.ts rename to apps/server/src/modules/legacy-school/types/federal-state-names.enum.ts diff --git a/apps/server/src/modules/school-migration/types/index.ts b/apps/server/src/modules/legacy-school/types/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/types/index.ts rename to apps/server/src/modules/legacy-school/types/index.ts diff --git a/apps/server/src/modules/school-migration/uc/dto/oauth-migration.dto.ts b/apps/server/src/modules/legacy-school/uc/dto/oauth-migration.dto.ts similarity index 100% rename from apps/server/src/modules/school-migration/uc/dto/oauth-migration.dto.ts rename to apps/server/src/modules/legacy-school/uc/dto/oauth-migration.dto.ts diff --git a/apps/server/src/modules/school-migration/uc/index.ts b/apps/server/src/modules/legacy-school/uc/index.ts similarity index 100% rename from apps/server/src/modules/school-migration/uc/index.ts rename to apps/server/src/modules/legacy-school/uc/index.ts diff --git a/apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts b/apps/server/src/modules/legacy-school/uc/legacy-school.uc.spec.ts similarity index 98% rename from apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts rename to apps/server/src/modules/legacy-school/uc/legacy-school.uc.spec.ts index 9be10a4314f..17dc2de5fd0 100644 --- a/apps/server/src/modules/school-migration/uc/legacy-school.uc.spec.ts +++ b/apps/server/src/modules/legacy-school/uc/legacy-school.uc.spec.ts @@ -4,8 +4,8 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserLoginMigrationDO } from '@shared/domain'; import { legacySchoolDoFactory, userLoginMigrationDOFactory } from '@shared/testing/factory'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration/service'; -import { LegacySchoolUc } from '@src/modules/school-migration/uc'; +import { LegacySchoolService } from '@src/modules/legacy-school/service'; +import { LegacySchoolUc } from '@src/modules/legacy-school/uc'; import { SchoolMigrationService, UserLoginMigrationRevertService, diff --git a/apps/server/src/modules/school-migration/uc/legacy-school.uc.ts b/apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts similarity index 100% rename from apps/server/src/modules/school-migration/uc/legacy-school.uc.ts rename to apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts diff --git a/apps/server/src/modules/oauth/oauth-api.module.ts b/apps/server/src/modules/oauth/oauth-api.module.ts index d1af5b3c66d..4bde06ce6a0 100644 --- a/apps/server/src/modules/oauth/oauth-api.module.ts +++ b/apps/server/src/modules/oauth/oauth-api.module.ts @@ -3,7 +3,7 @@ import { LoggerModule } from '@src/core/logger'; import { AuthenticationModule } from '@src/modules/authentication/authentication.module'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; diff --git a/apps/server/src/modules/oauth/oauth.module.ts b/apps/server/src/modules/oauth/oauth.module.ts index f334f1d5c50..b8519e3eaa2 100644 --- a/apps/server/src/modules/oauth/oauth.module.ts +++ b/apps/server/src/modules/oauth/oauth.module.ts @@ -6,7 +6,7 @@ import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; diff --git a/apps/server/src/modules/oauth/service/oauth.service.spec.ts b/apps/server/src/modules/oauth/service/oauth.service.spec.ts index 1316037e3f8..ae54342887f 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.spec.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.spec.ts @@ -9,7 +9,7 @@ import { legacySchoolDoFactory, setupEntities, systemFactory, userDoFactory } fr import { LegacyLogger } from '@src/core/logger'; import { ProvisioningDto, ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { OauthConfigDto } from '@src/modules/system/service'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; import { SystemService } from '@src/modules/system/service/system.service'; diff --git a/apps/server/src/modules/oauth/service/oauth.service.ts b/apps/server/src/modules/oauth/service/oauth.service.ts index 29d4a50c879..afef7f113e5 100644 --- a/apps/server/src/modules/oauth/service/oauth.service.ts +++ b/apps/server/src/modules/oauth/service/oauth.service.ts @@ -6,7 +6,7 @@ import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encr import { LegacyLogger } from '@src/core/logger'; import { ProvisioningService } from '@src/modules/provisioning'; import { OauthDataDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts index 5557ef68614..dba6cca003c 100644 --- a/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts +++ b/apps/server/src/modules/oauth/uc/oauth.uc.spec.ts @@ -12,7 +12,7 @@ import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; import { OauthUc } from '@src/modules/oauth/uc/oauth.uc'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto, SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/provisioning/provisioning.module.ts b/apps/server/src/modules/provisioning/provisioning.module.ts index 427509d7754..b4f8010826f 100644 --- a/apps/server/src/modules/provisioning/provisioning.module.ts +++ b/apps/server/src/modules/provisioning/provisioning.module.ts @@ -3,7 +3,7 @@ import { Module } from '@nestjs/common'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account/account.module'; import { RoleModule } from '@src/modules/role'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { SystemModule } from '@src/modules/system/system.module'; import { UserModule } from '@src/modules/user'; import { ProvisioningService } from './service/provisioning.service'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts index 264d2f1d11d..0926ae7e3a7 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.spec.ts @@ -5,7 +5,7 @@ import { LegacySchoolDo, RoleName, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { legacySchoolDoFactory, schoolFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import jwt from 'jsonwebtoken'; import { RoleDto } from '../../../role/service/dto/role.dto'; diff --git a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts index 14984651fda..71ea2972b54 100644 --- a/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts +++ b/apps/server/src/modules/provisioning/strategy/iserv/iserv.strategy.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { LegacySchoolDo, RoleName, RoleReference, User, UserDO } from '@shared/domain'; import { SystemProvisioningStrategy } from '@shared/domain/interface/system-provisioning.strategy'; import { OAuthSSOError } from '@src/modules/oauth/error/oauth-sso.error'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import jwt, { JwtPayload } from 'jsonwebtoken'; import { diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts index b0382169122..f2f2211a27b 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.spec.ts @@ -9,7 +9,7 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school-migration'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; diff --git a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts index 9c0f140d322..f3d35b77427 100644 --- a/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts +++ b/apps/server/src/modules/provisioning/strategy/oidc/service/oidc-provisioning.service.ts @@ -12,8 +12,8 @@ import { AccountService } from '@src/modules/account/services/account.service'; import { AccountSaveDto } from '@src/modules/account/services/dto'; import { RoleService } from '@src/modules/role'; import { RoleDto } from '@src/modules/role/service/dto/role.dto'; -import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/school-migration'; -import { FederalStateNames } from '@src/modules/school-migration/types'; +import { FederalStateService, LegacySchoolService, SchoolYearService } from '@src/modules/legacy-school'; +import { FederalStateNames } from '@src/modules/legacy-school/types'; import { UserService } from '@src/modules/user'; import CryptoJS from 'crypto-js'; import { ExternalSchoolDto, ExternalUserDto } from '../../../dto'; diff --git a/apps/server/src/modules/server/server.module.ts b/apps/server/src/modules/server/server.module.ts index e8525e3800e..b780ffab8c9 100644 --- a/apps/server/src/modules/server/server.module.ts +++ b/apps/server/src/modules/server/server.module.ts @@ -23,7 +23,7 @@ import { NewsModule } from '@src/modules/news'; import { OauthProviderApiModule } from '@src/modules/oauth-provider'; import { OauthApiModule } from '@src/modules/oauth/oauth-api.module'; import { RocketChatModule } from '@src/modules/rocketchat'; -import { LegacySchoolApiModule } from '@src/modules/school-migration/legacy-school-api.module'; +import { LegacySchoolApiModule } from '@src/modules/legacy-school/legacy-school-api.module'; import { SharingApiModule } from '@src/modules/sharing/sharing.module'; import { SystemApiModule } from '@src/modules/system/system-api.module'; import { TaskApiModule } from '@src/modules/task/task-api.module'; diff --git a/apps/server/src/modules/tool/common/common-tool.module.ts b/apps/server/src/modules/tool/common/common-tool.module.ts index fd612e642b1..cc7f5f86f00 100644 --- a/apps/server/src/modules/tool/common/common-tool.module.ts +++ b/apps/server/src/modules/tool/common/common-tool.module.ts @@ -2,7 +2,7 @@ import { forwardRef, Module } from '@nestjs/common'; import { ContextExternalToolRepo, SchoolExternalToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { CommonToolService, CommonToolValidationService } from './service'; import { ToolPermissionHelper } from './uc/tool-permission-helper'; diff --git a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts index 1de25668708..dc4f339b4ab 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permission-helper.ts @@ -1,7 +1,7 @@ import { forwardRef, Inject, Injectable } from '@nestjs/common'; import { EntityId, LegacySchoolDo, User } from '@shared/domain'; import { AuthorizableReferenceType, AuthorizationContext, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { SchoolExternalTool } from '../../school-external-tool/domain'; import { ContextTypeMapper } from '../mapper'; diff --git a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts index 64e421aba9f..b1567693130 100644 --- a/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts +++ b/apps/server/src/modules/tool/common/uc/tool-permissions-helper.spec.ts @@ -8,7 +8,7 @@ import { } from '@shared/testing'; import { Permission, LegacySchoolDo } from '@shared/domain'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { ContextExternalTool } from '../../context-external-tool/domain'; import { ToolPermissionHelper } from './tool-permission-helper'; import { SchoolExternalTool } from '../../school-external-tool/domain'; diff --git a/apps/server/src/modules/tool/tool-api.module.ts b/apps/server/src/modules/tool/tool-api.module.ts index 0d44284f4fe..fe775e01fd3 100644 --- a/apps/server/src/modules/tool/tool-api.module.ts +++ b/apps/server/src/modules/tool/tool-api.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { LtiToolRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AuthorizationModule } from '@src/modules/authorization'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { UserModule } from '@src/modules/user'; import { ToolContextController } from './context-external-tool/controller'; import { ContextExternalToolUc } from './context-external-tool/uc'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts index 17c569f617e..ab6c0ebace6 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.spec.ts @@ -13,7 +13,7 @@ import { schoolExternalToolFactory, setupEntities, } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { MissingToolParameterValueLoggableException, ParameterTypeNotImplementedLoggableException } from '../../error'; import { LaunchRequestMethod, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts index 8ad5bfe2a6f..4b4fd53053b 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/abstract-launch.strategy.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { Course, EntityId, LegacySchoolDo } from '@shared/domain'; import { CourseRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { URLSearchParams } from 'url'; import { CustomParameterLocation, diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts index 70297290f1f..a99e01ff156 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/basic-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { LaunchRequestMethod, PropertyData, PropertyLocation } from '../../types'; import { BasicToolLaunchStrategy } from './basic-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts index 10bfc91bb08..9f91a8e6524 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.spec.ts @@ -11,7 +11,7 @@ import { } from '@shared/testing'; import { pseudonymFactory } from '@shared/testing/factory/domainobject/pseudonym.factory'; import { PseudonymService } from '@src/modules/pseudonym/service'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { ObjectId } from 'bson'; import { Authorization } from 'oauth-1.0a'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts index 4592c885122..ce86e13be9a 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/lti11-tool-launch.strategy.ts @@ -3,7 +3,7 @@ import { EntityId, LtiPrivacyPermission, Pseudonym, RoleName, UserDO } from '@sh import { RoleReference } from '@shared/domain/domainobject'; import { CourseRepo } from '@shared/repo'; import { PseudonymService } from '@src/modules/pseudonym'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { Authorization } from 'oauth-1.0a'; import { LtiRole } from '../../../common/enum'; diff --git a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts index dbf390742ae..b869a144d20 100644 --- a/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts +++ b/apps/server/src/modules/tool/tool-launch/service/strategy/oauth2-tool-launch.strategy.spec.ts @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest'; import { Test, TestingModule } from '@nestjs/testing'; import { CourseRepo } from '@shared/repo'; import { contextExternalToolFactory, externalToolFactory, schoolExternalToolFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { LaunchRequestMethod, PropertyData } from '../../types'; import { OAuth2ToolLaunchStrategy } from './oauth2-tool-launch.strategy'; import { IToolLaunchParams } from './tool-launch-params.interface'; diff --git a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts index 587b5e12ae3..7a57e774d6b 100644 --- a/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts +++ b/apps/server/src/modules/tool/tool-launch/tool-launch.module.ts @@ -1,5 +1,5 @@ import { Module } from '@nestjs/common'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { UserModule } from '@src/modules/user'; import { PseudonymModule } from '@src/modules/pseudonym'; import { CourseRepo } from '@shared/repo'; diff --git a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts index 96bd92ec3d4..91b1ebc6ec7 100644 --- a/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts +++ b/apps/server/src/modules/user-import/controller/import-user.controller.spec.ts @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { ImportUserRepo, SystemRepo, UserRepo } from '@shared/repo'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { LoggerModule } from '@src/core/logger'; import { ConfigModule } from '@nestjs/config'; import { UserImportUc } from '../uc/user-import.uc'; diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts index 2faaf58463e..0f2311da1b4 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.spec.ts @@ -23,7 +23,7 @@ import { systemFactory } from '@shared/testing/factory/system.factory'; import { LoggerModule } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { LdapAlreadyPersistedException, MigrationAlreadyActivatedException, diff --git a/apps/server/src/modules/user-import/uc/user-import.uc.ts b/apps/server/src/modules/user-import/uc/user-import.uc.ts index cfb707bd0a5..ef0664c9ed7 100644 --- a/apps/server/src/modules/user-import/uc/user-import.uc.ts +++ b/apps/server/src/modules/user-import/uc/user-import.uc.ts @@ -22,7 +22,7 @@ import { Logger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto/account.dto'; import { AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { MigrationMayBeCompleted, MigrationMayNotBeCompleted, diff --git a/apps/server/src/modules/user-import/user-import.module.ts b/apps/server/src/modules/user-import/user-import.module.ts index fba1aa4ad74..6e881ff5b2f 100644 --- a/apps/server/src/modules/user-import/user-import.module.ts +++ b/apps/server/src/modules/user-import/user-import.module.ts @@ -1,7 +1,7 @@ import { Module } from '@nestjs/common'; import { ImportUserRepo, LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { AccountModule } from '../account'; import { AuthorizationModule } from '../authorization'; import { ImportUserController } from './controller/import-user.controller'; diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts index 88e604c36b8..c61382b9f63 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.spec.ts @@ -3,7 +3,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { legacySchoolDoFactory, userDoFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { MigrationCheckService } from './migration-check.service'; diff --git a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts index 29b8a823171..7a0596e3599 100644 --- a/apps/server/src/modules/user-login-migration/service/migration-check.service.ts +++ b/apps/server/src/modules/user-login-migration/service/migration-check.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { EntityId, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; @Injectable() diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts index 4b43f5722ad..19841ffb6de 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.spec.ts @@ -8,7 +8,7 @@ import { UserLoginMigrationRepo } from '@shared/repo/userloginmigration/user-log import { legacySchoolDoFactory, setupEntities, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { LegacyLogger } from '@src/core/logger'; import { ICurrentUser } from '@src/modules/authentication'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { OAuthMigrationError } from '@src/modules/user-login-migration/error/oauth-migration.error'; import { SchoolMigrationService } from './school-migration.service'; diff --git a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts index 64a46883b8e..04f3e44b265 100644 --- a/apps/server/src/modules/user-login-migration/service/school-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/school-migration.service.ts @@ -3,7 +3,7 @@ import { ValidationError } from '@shared/common'; import { Page, LegacySchoolDo, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LegacyLogger } from '@src/core/logger'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { performance } from 'perf_hooks'; import { OAuthMigrationError } from '../error'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts index d4eb320249b..0b677fd8cf6 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.spec.ts @@ -1,7 +1,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { createMock, DeepMocked } from '@golevelup/ts-jest'; import { SchoolFeatures } from '@shared/domain'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { setupEntities, userLoginMigrationDOFactory } from '@shared/testing'; import { UserLoginMigrationRevertService } from './user-login-migration-revert.service'; import { UserLoginMigrationService } from './user-login-migration.service'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts index 60298454529..88397e0b179 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration-revert.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { SchoolFeatures, UserLoginMigrationDO } from '@shared/domain'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserLoginMigrationService } from './user-login-migration.service'; @Injectable() diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts index 82dcde5e31f..0b755b68415 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.spec.ts @@ -6,7 +6,7 @@ import { Test, TestingModule } from '@nestjs/testing'; import { EntityId, LegacySchoolDo, SchoolFeatures, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; import { legacySchoolDoFactory, userDoFactory, userLoginMigrationDOFactory } from '@shared/testing'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemService } from '@src/modules/system'; import { SystemDto } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; diff --git a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts index 479672490e2..f1037997955 100644 --- a/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-login-migration.service.ts @@ -2,7 +2,7 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { Injectable, InternalServerErrorException, UnprocessableEntityException } from '@nestjs/common'; import { EntityId, LegacySchoolDo, SchoolFeatures, SystemTypeEnum, UserDO, UserLoginMigrationDO } from '@shared/domain'; import { UserLoginMigrationRepo } from '@shared/repo'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemDto, SystemService } from '@src/modules/system'; import { UserService } from '@src/modules/user'; import { UserLoginMigrationNotFoundLoggableException } from '../error'; diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts index d3c94099097..24cb59030a5 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.spec.ts @@ -9,7 +9,7 @@ import { legacySchoolDoFactory, setupEntities, userDoFactory } from '@shared/tes import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto, AccountSaveDto } from '@src/modules/account/services/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemService } from '@src/modules/system'; import { OauthConfigDto } from '@src/modules/system/service/dto/oauth-config.dto'; import { SystemDto } from '@src/modules/system/service/dto/system.dto'; diff --git a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts index 3458a82baaa..a2e999994f5 100644 --- a/apps/server/src/modules/user-login-migration/service/user-migration.service.ts +++ b/apps/server/src/modules/user-login-migration/service/user-migration.service.ts @@ -5,7 +5,7 @@ import { UserDO } from '@shared/domain/domainobject/user.do'; import { LegacyLogger } from '@src/core/logger'; import { AccountService } from '@src/modules/account/services/account.service'; import { AccountDto } from '@src/modules/account/services/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SystemDto, SystemService } from '@src/modules/system/service'; import { UserService } from '@src/modules/user'; import { EntityId } from '@src/shared/domain/types'; diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts index 825014e6344..c6e53ab483d 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts index 4d377db41f3..514973db20b 100644 --- a/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/restart-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserLoginMigrationGracePeriodExpiredLoggableException, UserLoginMigrationNotFoundLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts index ef0a4e02066..e4c7510e684 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationService } from '../service'; import { StartUserLoginMigrationUc } from './start-user-login-migration.uc'; diff --git a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts index de033f77294..8eefd9a85ee 100644 --- a/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/start-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common/decorators/core/injectable.decorator' import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { SchoolNumberMissingLoggableException, UserLoginMigrationAlreadyClosedLoggableException } from '../error'; import { UserLoginMigrationStartLoggable } from '../loggable'; import { UserLoginMigrationService } from '../service'; diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts index 252d609605b..cd97ad1e4ef 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.spec.ts @@ -5,7 +5,7 @@ import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/ import { legacySchoolDoFactory, setupEntities, userFactory, userLoginMigrationDOFactory } from '@shared/testing'; import { Logger } from '@src/core/logger'; import { AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts index 107d869ae45..d07578e7b23 100644 --- a/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts +++ b/apps/server/src/modules/user-login-migration/uc/toggle-user-login-migration.uc.ts @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common'; import { Permission, LegacySchoolDo, User, UserLoginMigrationDO } from '@shared/domain'; import { Logger } from '@src/core/logger'; import { AuthorizationContext, AuthorizationContextBuilder, AuthorizationService } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserLoginMigrationAlreadyClosedLoggableException, UserLoginMigrationGracePeriodExpiredLoggableException, diff --git a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts index 50ddb047711..3ac2aec3b4e 100644 --- a/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts +++ b/apps/server/src/modules/user-login-migration/uc/user-login-migration.uc.spec.ts @@ -18,7 +18,7 @@ import { OAuthTokenDto } from '@src/modules/oauth'; import { OAuthService } from '@src/modules/oauth/service/oauth.service'; import { ProvisioningService } from '@src/modules/provisioning'; import { ExternalSchoolDto, ExternalUserDto, OauthDataDto, ProvisioningSystemDto } from '@src/modules/provisioning/dto'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { Oauth2MigrationParams } from '../controller/dto/oauth2-migration.params'; import { OAuthMigrationError, SchoolMigrationError, UserLoginMigrationError } from '../error'; import { PageTypes } from '../interface/page-types.enum'; diff --git a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts index 5c1122a1c31..4556103658d 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration-api.module.ts @@ -4,7 +4,7 @@ import { AuthenticationModule } from '@src/modules/authentication/authentication import { AuthorizationModule } from '@src/modules/authorization'; import { OauthModule } from '@src/modules/oauth'; import { ProvisioningModule } from '@src/modules/provisioning'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { UserLoginMigrationController } from './controller/user-login-migration.controller'; import { UserMigrationController } from './controller/user-migration.controller'; import { PageContentMapper } from './mapper'; diff --git a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts index a7489f4fe2c..40e965a4df3 100644 --- a/apps/server/src/modules/user-login-migration/user-login-migration.module.ts +++ b/apps/server/src/modules/user-login-migration/user-login-migration.module.ts @@ -2,7 +2,7 @@ import { Module } from '@nestjs/common'; import { UserLoginMigrationRepo } from '@shared/repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { SystemModule } from '@src/modules/system'; import { UserModule } from '@src/modules/user'; import { diff --git a/apps/server/src/modules/user/user.module.ts b/apps/server/src/modules/user/user.module.ts index bb3906e5a50..8b462c8ca20 100644 --- a/apps/server/src/modules/user/user.module.ts +++ b/apps/server/src/modules/user/user.module.ts @@ -4,7 +4,7 @@ import { UserDORepo } from '@shared/repo/user/user-do.repo'; import { LoggerModule } from '@src/core/logger'; import { AccountModule } from '@src/modules/account'; import { RoleModule } from '@src/modules/role/role.module'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { UserService } from './service/user.service'; @Module({ diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts index dc2592ab807..a58dda9f699 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.spec.ts @@ -19,7 +19,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { courseFactory, roleFactory, setupEntities, userDoFactory } from '@shared/testing'; import { videoConferenceDOFactory } from '@shared/testing/factory/video-conference.do.factory'; diff --git a/apps/server/src/modules/video-conference/service/video-conference.service.ts b/apps/server/src/modules/video-conference/service/video-conference.service.ts index 5537e59fd78..c1bfbd9ec79 100644 --- a/apps/server/src/modules/video-conference/service/video-conference.service.ts +++ b/apps/server/src/modules/video-conference/service/video-conference.service.ts @@ -22,7 +22,7 @@ import { AuthorizationService, } from '@src/modules/authorization'; import { CourseService } from '@src/modules/learnroom/service/course.service'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { UserService } from '@src/modules/user'; import { BBBRole } from '../bbb'; import { ErrorStatus } from '../error/error-status.enum'; diff --git a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts index 6cad2d6e813..d7d38d8c683 100644 --- a/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts +++ b/apps/server/src/modules/video-conference/uc/video-conference-deprecated.uc.ts @@ -24,7 +24,7 @@ import { AuthorizationContextBuilder, AuthorizationService, } from '@src/modules/authorization'; -import { LegacySchoolService } from '@src/modules/school-migration'; +import { LegacySchoolService } from '@src/modules/legacy-school'; import { CourseService } from '@src/modules/learnroom/service/course.service'; import { UserService } from '@src/modules/user'; import { IScopeInfo, VideoConference, VideoConferenceInfo, VideoConferenceJoin, VideoConferenceState } from './dto'; diff --git a/apps/server/src/modules/video-conference/video-conference.module.ts b/apps/server/src/modules/video-conference/video-conference.module.ts index 5e1740a3734..70a999437c0 100644 --- a/apps/server/src/modules/video-conference/video-conference.module.ts +++ b/apps/server/src/modules/video-conference/video-conference.module.ts @@ -4,7 +4,7 @@ import { CalendarModule } from '@shared/infra/calendar'; import { VideoConferenceRepo } from '@shared/repo/videoconference/video-conference.repo'; import { AuthorizationModule } from '@src/modules/authorization'; import { TeamsRepo } from '@shared/repo'; -import { LegacySchoolModule } from '@src/modules/school-migration'; +import { LegacySchoolModule } from '@src/modules/legacy-school'; import { LoggerModule } from '@src/core/logger'; import { ConverterUtil } from '@shared/common'; import { UserModule } from '@src/modules/user'; From 273c3d1fcfb840abd570f84a90d1c8f497d3528e Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:45:48 +0200 Subject: [PATCH 26/29] Add deprecation markers --- .../src/modules/legacy-school/controller/school.controller.ts | 3 +++ .../src/modules/legacy-school/legacy-school-api.module.ts | 3 +++ apps/server/src/modules/legacy-school/legacy-school.module.ts | 3 +++ apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.ts b/apps/server/src/modules/legacy-school/controller/school.controller.ts index 7db8b370437..24e6a998dcd 100644 --- a/apps/server/src/modules/legacy-school/controller/school.controller.ts +++ b/apps/server/src/modules/legacy-school/controller/school.controller.ts @@ -13,6 +13,9 @@ import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @ApiTags('School') @Authenticate('jwt') @Controller('school') diff --git a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts index cb602b1cd6c..ebfa0de4440 100644 --- a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts +++ b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts @@ -7,6 +7,9 @@ import { LegacySchoolModule } from './legacy-school.module'; import { SchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @Module({ imports: [LegacySchoolModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], controllers: [SchoolController], diff --git a/apps/server/src/modules/legacy-school/legacy-school.module.ts b/apps/server/src/modules/legacy-school/legacy-school.module.ts index e472bd94635..8547c417055 100644 --- a/apps/server/src/modules/legacy-school/legacy-school.module.ts +++ b/apps/server/src/modules/legacy-school/legacy-school.module.ts @@ -4,6 +4,9 @@ import { LoggerModule } from '@src/core/logger'; import { SchoolYearRepo } from './repo'; import { FederalStateService, LegacySchoolService, SchoolValidationService, SchoolYearService } from './service'; +/** + * @deprecated because it uses the deprecated LegacySchoolDo. + */ @Module({ imports: [LoggerModule], providers: [ diff --git a/apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts b/apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts index 57a004a441e..2ccc9dc5698 100644 --- a/apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts +++ b/apps/server/src/modules/legacy-school/uc/legacy-school.uc.ts @@ -10,7 +10,7 @@ import { LegacySchoolService } from '../service'; import { OauthMigrationDto } from './dto/oauth-migration.dto'; /** - * @deprecated because it uses the deprecated LegacySchoolService. + * @deprecated because it uses the deprecated LegacySchoolDo. */ @Injectable() export class LegacySchoolUc { From ff06db06da6c04dfbb160b94827577b31e4baa92 Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:46:33 +0200 Subject: [PATCH 27/29] Rename controller --- .../legacy-school/controller/school.controller.spec.ts | 8 ++++---- .../modules/legacy-school/controller/school.controller.ts | 2 +- .../src/modules/legacy-school/legacy-school-api.module.ts | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts b/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts index 1f6be74df84..33366a2daa3 100644 --- a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts +++ b/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts @@ -6,17 +6,17 @@ import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; -import { SchoolController } from './school.controller'; +import { LegacySchoolController } from './school.controller'; describe('School Controller', () => { let module: TestingModule; - let controller: SchoolController; + let controller: LegacySchoolController; let schoolUc: DeepMocked; let mapper: DeepMocked; beforeAll(async () => { module = await Test.createTestingModule({ - controllers: [SchoolController], + controllers: [LegacySchoolController], providers: [ { provide: LegacySchoolUc, @@ -28,7 +28,7 @@ describe('School Controller', () => { }, ], }).compile(); - controller = module.get(SchoolController); + controller = module.get(LegacySchoolController); schoolUc = module.get(LegacySchoolUc); mapper = module.get(MigrationMapper); }); diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.ts b/apps/server/src/modules/legacy-school/controller/school.controller.ts index 24e6a998dcd..a91d8662752 100644 --- a/apps/server/src/modules/legacy-school/controller/school.controller.ts +++ b/apps/server/src/modules/legacy-school/controller/school.controller.ts @@ -19,7 +19,7 @@ import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; @ApiTags('School') @Authenticate('jwt') @Controller('school') -export class SchoolController { +export class LegacySchoolController { constructor(private readonly schoolUc: LegacySchoolUc, private readonly migrationMapper: MigrationMapper) {} @Put(':schoolId/migration') diff --git a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts index ebfa0de4440..508b20de89c 100644 --- a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts +++ b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts @@ -4,7 +4,7 @@ import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; import { LegacySchoolModule } from './legacy-school.module'; -import { SchoolController } from './controller/school.controller'; +import { LegacySchoolController } from './controller/school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; /** @@ -12,7 +12,7 @@ import { MigrationMapper } from './mapper/migration.mapper'; */ @Module({ imports: [LegacySchoolModule, AuthorizationModule, LoggerModule, UserLoginMigrationModule], - controllers: [SchoolController], + controllers: [LegacySchoolController], providers: [LegacySchoolUc, MigrationMapper], }) export class LegacySchoolApiModule {} From e01580c80fc8e91c22fff49a5239008f47f2d58a Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:48:32 +0200 Subject: [PATCH 28/29] Rename controller file --- .../{school.controller.ts => legacy-school.controller.ts} | 0 .../modules/legacy-school/controller/school.controller.spec.ts | 2 +- .../src/modules/legacy-school/legacy-school-api.module.ts | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename apps/server/src/modules/legacy-school/controller/{school.controller.ts => legacy-school.controller.ts} (100%) diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.ts b/apps/server/src/modules/legacy-school/controller/legacy-school.controller.ts similarity index 100% rename from apps/server/src/modules/legacy-school/controller/school.controller.ts rename to apps/server/src/modules/legacy-school/controller/legacy-school.controller.ts diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts b/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts index 33366a2daa3..68c0260d333 100644 --- a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts +++ b/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts @@ -6,7 +6,7 @@ import { MigrationMapper } from '../mapper/migration.mapper'; import { OauthMigrationDto } from '../uc/dto/oauth-migration.dto'; import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; -import { LegacySchoolController } from './school.controller'; +import { LegacySchoolController } from './legacy-school.controller'; describe('School Controller', () => { let module: TestingModule; diff --git a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts index 508b20de89c..3072fa8f6ca 100644 --- a/apps/server/src/modules/legacy-school/legacy-school-api.module.ts +++ b/apps/server/src/modules/legacy-school/legacy-school-api.module.ts @@ -4,7 +4,7 @@ import { LoggerModule } from '@src/core/logger'; import { UserLoginMigrationModule } from '@src/modules/user-login-migration'; import { LegacySchoolUc } from './uc'; import { LegacySchoolModule } from './legacy-school.module'; -import { LegacySchoolController } from './controller/school.controller'; +import { LegacySchoolController } from './controller/legacy-school.controller'; import { MigrationMapper } from './mapper/migration.mapper'; /** From 35bfd6503470238389e507d493a8e2c1b7815fab Mon Sep 17 00:00:00 2001 From: dyedwiper Date: Mon, 18 Sep 2023 11:49:58 +0200 Subject: [PATCH 29/29] Rename controller test file --- ...hool.controller.spec.ts => legacy-school.controller.spec.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename apps/server/src/modules/legacy-school/controller/{school.controller.spec.ts => legacy-school.controller.spec.ts} (98%) diff --git a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts b/apps/server/src/modules/legacy-school/controller/legacy-school.controller.spec.ts similarity index 98% rename from apps/server/src/modules/legacy-school/controller/school.controller.spec.ts rename to apps/server/src/modules/legacy-school/controller/legacy-school.controller.spec.ts index 68c0260d333..1777ad02faa 100644 --- a/apps/server/src/modules/legacy-school/controller/school.controller.spec.ts +++ b/apps/server/src/modules/legacy-school/controller/legacy-school.controller.spec.ts @@ -8,7 +8,7 @@ import { LegacySchoolUc } from '../uc'; import { MigrationBody, MigrationResponse, SchoolParams } from './dto'; import { LegacySchoolController } from './legacy-school.controller'; -describe('School Controller', () => { +describe('Legacy School Controller', () => { let module: TestingModule; let controller: LegacySchoolController; let schoolUc: DeepMocked;