diff --git a/apps/server/src/core/error/domain/domain-error-handler.spec.ts b/apps/server/src/core/error/domain/domain-error-handler.spec.ts index eb85c5a657..310ce13a3c 100644 --- a/apps/server/src/core/error/domain/domain-error-handler.spec.ts +++ b/apps/server/src/core/error/domain/domain-error-handler.spec.ts @@ -29,10 +29,7 @@ class SampleLoggableException extends BadRequestException implements Loggable { } class SampleLoggableExceptionWithCause extends InternalServerErrorException implements Loggable { - constructor( - private readonly testValue: string, - error?: unknown, - ) { + constructor(private readonly testValue: string, error?: unknown) { super(ErrorUtils.createHttpExceptionOptions(error)); } @@ -57,7 +54,7 @@ class SampleLoggableFromBusinessException extends BusinessError implements Logga title: 'test_title', defaultMessage: 'test_defaultMessage', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/core/error/dto/api-validation-error.response.ts b/apps/server/src/core/error/dto/api-validation-error.response.ts index 9bb340fa3f..e9974a9ddd 100644 --- a/apps/server/src/core/error/dto/api-validation-error.response.ts +++ b/apps/server/src/core/error/dto/api-validation-error.response.ts @@ -31,7 +31,7 @@ export class ApiValidationErrorResponse extends ErrorResponse { if (validationError.children) { validationError.children.forEach((childError: ValidationError) => - this.extractValidationErrorDetails(childError, propertyPath), + this.extractValidationErrorDetails(childError, propertyPath) ); } } diff --git a/apps/server/src/core/error/filter/global-error.filter.spec.ts b/apps/server/src/core/error/filter/global-error.filter.spec.ts index 40676e4c93..c593fb21f2 100644 --- a/apps/server/src/core/error/filter/global-error.filter.spec.ts +++ b/apps/server/src/core/error/filter/global-error.filter.spec.ts @@ -21,16 +21,13 @@ class SampleBusinessError extends BusinessError { title: 'Sample Error', defaultMessage: 'sample error message', }, - HttpStatus.NOT_IMPLEMENTED, + HttpStatus.NOT_IMPLEMENTED ); } } class SampleLoggableExceptionWithCause extends InternalServerErrorException implements Loggable { - constructor( - private readonly testValue: string, - error?: unknown, - ) { + constructor(private readonly testValue: string, error?: unknown) { super(ErrorUtils.createHttpExceptionOptions(error)); } @@ -157,7 +154,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.NOT_IMPLEMENTED).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.NOT_IMPLEMENTED).json ).toBeCalledWith(expectedResponse); }); }); @@ -170,7 +167,7 @@ describe('GlobalErrorFilter', () => { 'SAMPLE_ERROR', 'Sample Error', 'sample error message', - HttpStatus.NOT_IMPLEMENTED, + HttpStatus.NOT_IMPLEMENTED ); return { error, argumentsHost, expectedResponse }; @@ -182,7 +179,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect(argumentsHost.switchToHttp().getResponse().status).toBeCalledWith( - HttpStatus.NOT_IMPLEMENTED, + HttpStatus.NOT_IMPLEMENTED ); }); @@ -192,7 +189,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.NOT_IMPLEMENTED).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.NOT_IMPLEMENTED).json ).toBeCalledWith(expectedResponse); }); }); @@ -205,7 +202,7 @@ describe('GlobalErrorFilter', () => { 'BAD_REQUEST', 'Bad Request', 'Bad Request', - HttpStatus.BAD_REQUEST, + HttpStatus.BAD_REQUEST ); return { error, argumentsHost, expectedResponse }; @@ -225,7 +222,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.BAD_REQUEST).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.BAD_REQUEST).json ).toBeCalledWith(expectedResponse); }); }); @@ -238,7 +235,7 @@ describe('GlobalErrorFilter', () => { 'INTERNAL_SERVER_ERROR', 'Internal Server Error', 'Internal Server Error', - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); return { error, argumentsHost, expectedResponse }; @@ -250,7 +247,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect(argumentsHost.switchToHttp().getResponse().status).toBeCalledWith( - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); }); @@ -260,7 +257,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json ).toBeCalledWith(expectedResponse); }); }); @@ -273,7 +270,7 @@ describe('GlobalErrorFilter', () => { 'INTERNAL_SERVER_ERROR', 'Internal Server Error', 'Internal Server Error', - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); return { error, argumentsHost, expectedResponse }; @@ -285,7 +282,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect(argumentsHost.switchToHttp().getResponse().status).toBeCalledWith( - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); }); @@ -295,7 +292,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json ).toBeCalledWith(expectedResponse); }); }); @@ -308,7 +305,7 @@ describe('GlobalErrorFilter', () => { 'SAMPLE_WITH_CAUSE', 'Sample With Cause', 'Sample Loggable Exception With Cause', - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); const argumentsHost = mockHttpArgumentsHost(); @@ -322,7 +319,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect(argumentsHost.switchToHttp().getResponse().status).toBeCalledWith( - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); }); @@ -332,7 +329,7 @@ describe('GlobalErrorFilter', () => { service.catch(error, argumentsHost); expect( - argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json, + argumentsHost.switchToHttp().getResponse().status(HttpStatus.INTERNAL_SERVER_ERROR).json ).toBeCalledWith(expectedResponse); }); }); diff --git a/apps/server/src/core/error/loggable/error.loggable.spec.ts b/apps/server/src/core/error/loggable/error.loggable.spec.ts index 67f1ad79c1..fe2d5dbac6 100644 --- a/apps/server/src/core/error/loggable/error.loggable.spec.ts +++ b/apps/server/src/core/error/loggable/error.loggable.spec.ts @@ -13,7 +13,7 @@ class SampleBusinessError extends BusinessError { title: 'Sample Error', defaultMessage: 'sample error message', }, - HttpStatus.NOT_IMPLEMENTED, + HttpStatus.NOT_IMPLEMENTED ); } } diff --git a/apps/server/src/core/error/loggable/error.loggable.ts b/apps/server/src/core/error/loggable/error.loggable.ts index 55a142c235..f38f5c11b3 100644 --- a/apps/server/src/core/error/loggable/error.loggable.ts +++ b/apps/server/src/core/error/loggable/error.loggable.ts @@ -9,10 +9,7 @@ import { ErrorUtils } from '../utils/error.utils'; export class ErrorLoggable implements Loggable { readonly actualError: Error; - constructor( - private readonly error: unknown, - private readonly data?: LogMessageDataObject, - ) { + constructor(private readonly error: unknown, private readonly data?: LogMessageDataObject) { if (this.error instanceof Error) { this.actualError = error; } else { @@ -71,13 +68,13 @@ export class ErrorLoggable implements Loggable { target.constructor, '', true, - true, + true ); const privacyProtected = metadatas.some( (validationMetadata) => // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access - validationMetadata.propertyName === property && validationMetadata.context?.privacyProtected, + validationMetadata.propertyName === property && validationMetadata.context?.privacyProtected ); return privacyProtected; diff --git a/apps/server/src/infra/auth-guard/decorator/jwt-auth.decorator.ts b/apps/server/src/infra/auth-guard/decorator/jwt-auth.decorator.ts index f8eb6fb3f7..56d4a5c116 100644 --- a/apps/server/src/infra/auth-guard/decorator/jwt-auth.decorator.ts +++ b/apps/server/src/infra/auth-guard/decorator/jwt-auth.decorator.ts @@ -36,7 +36,7 @@ export const CurrentUser = createParamDecorator((_, if (!requestUser || !isCurrentUser(requestUser)) { throw new UnauthorizedException( - 'CurrentUser missing in request context. This route requires jwt authentication guard enabled.', + 'CurrentUser missing in request context. This route requires jwt authentication guard enabled.' ); } diff --git a/apps/server/src/infra/auth-guard/strategy/jwt.strategy.ts b/apps/server/src/infra/auth-guard/strategy/jwt.strategy.ts index 6b9b418d0a..33fbf9d036 100644 --- a/apps/server/src/infra/auth-guard/strategy/jwt.strategy.ts +++ b/apps/server/src/infra/auth-guard/strategy/jwt.strategy.ts @@ -12,7 +12,7 @@ import { CurrentUserBuilder, JwtStrategyOptionsFactory } from '../mapper'; export class JwtStrategy extends PassportStrategy(Strategy) { constructor( private readonly jwtValidationAdapter: JwtValidationAdapter, - configService: ConfigService, + configService: ConfigService ) { const strategyOptions = JwtStrategyOptionsFactory.build(extractJwtFromHeader, configService); diff --git a/apps/server/src/infra/auth-guard/strategy/ws-jwt.strategy.ts b/apps/server/src/infra/auth-guard/strategy/ws-jwt.strategy.ts index 99e5f26046..2d3aca1567 100644 --- a/apps/server/src/infra/auth-guard/strategy/ws-jwt.strategy.ts +++ b/apps/server/src/infra/auth-guard/strategy/ws-jwt.strategy.ts @@ -13,7 +13,7 @@ import { CurrentUserBuilder, JwtStrategyOptionsFactory } from '../mapper'; export class WsJwtStrategy extends PassportStrategy(Strategy, StrategyType.WS_JWT) { constructor( private readonly jwtValidationAdapter: JwtValidationAdapter, - configService: ConfigService, + configService: ConfigService ) { const strategyOptions = JwtStrategyOptionsFactory.build(JwtExtractor.fromCookie('jwt'), configService); diff --git a/apps/server/src/infra/authorization-client/authorization-client.adapter.ts b/apps/server/src/infra/authorization-client/authorization-client.adapter.ts index 131823a4bd..138c9d582b 100644 --- a/apps/server/src/infra/authorization-client/authorization-client.adapter.ts +++ b/apps/server/src/infra/authorization-client/authorization-client.adapter.ts @@ -12,15 +12,12 @@ import { AuthorizationErrorLoggableException, AuthorizationForbiddenLoggableExce @Injectable() export class AuthorizationClientAdapter { - constructor( - private readonly authorizationApi: AuthorizationApi, - @Inject(REQUEST) private request: Request, - ) {} + constructor(private readonly authorizationApi: AuthorizationApi, @Inject(REQUEST) private request: Request) {} public async checkPermissionsByReference( referenceType: AuthorizationBodyParamsReferenceType, referenceId: string, - context: AuthorizationContextParams, + context: AuthorizationContextParams ): Promise { const hasPermission = await this.hasPermissionsByReference(referenceType, referenceId, context); @@ -32,7 +29,7 @@ export class AuthorizationClientAdapter { public async hasPermissionsByReference( referenceType: AuthorizationBodyParamsReferenceType, referenceId: string, - context: AuthorizationContextParams, + context: AuthorizationContextParams ): Promise { const params = { referenceType, @@ -45,7 +42,7 @@ export class AuthorizationClientAdapter { const response = await this.authorizationApi.authorizationReferenceControllerAuthorizeByReference( params, - options, + options ); const hasPermission = response.data.isAuthorized; diff --git a/apps/server/src/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy.spec.ts b/apps/server/src/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy.spec.ts index 7de851c96d..caebae0016 100644 --- a/apps/server/src/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy.spec.ts +++ b/apps/server/src/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy.spec.ts @@ -146,7 +146,7 @@ describe('NextCloudStrategy', () => { await strategy.updateTeamPermissionsForRole(teamRolePermissionsDto); expect(client.findGroupId).toHaveBeenCalledWith( - NextcloudStrategySpec.specGenerateGroupId(teamRolePermissionsDto), + NextcloudStrategySpec.specGenerateGroupId(teamRolePermissionsDto) ); }); @@ -182,7 +182,7 @@ describe('NextCloudStrategy', () => { await strategy.updateTeamPermissionsForRole(teamRolePermissionsDto); expect(client.findGroupId).toHaveBeenCalledWith( - NextcloudStrategySpec.specGenerateGroupId(teamRolePermissionsDto), + NextcloudStrategySpec.specGenerateGroupId(teamRolePermissionsDto) ); }); diff --git a/apps/server/src/infra/etherpad-client/etherpad-client.adapter.ts b/apps/server/src/infra/etherpad-client/etherpad-client.adapter.ts index ab53bc312a..808928a25d 100644 --- a/apps/server/src/infra/etherpad-client/etherpad-client.adapter.ts +++ b/apps/server/src/infra/etherpad-client/etherpad-client.adapter.ts @@ -35,7 +35,7 @@ export class EtherpadClientAdapter { private readonly groupApi: GroupApi, private readonly sessionApi: SessionApi, private readonly authorApi: AuthorApi, - private readonly padApi: PadApi, + private readonly padApi: PadApi ) {} public async getOrCreateAuthorId(userId: EntityId, username?: string): Promise { @@ -49,7 +49,7 @@ export class EtherpadClientAdapter { private async tryCreateAuthor( userId: string, - username?: string, + username?: string ): Promise> { try { const response = await this.authorApi.createAuthorIfNotExistsForUsingGET(userId, username); @@ -88,7 +88,7 @@ export class EtherpadClientAdapter { authorId: AuthorId, parentId: EntityId, sessionCookieExpire: Date, - durationThreshold: number, + durationThreshold: number ): Promise { const session = await this.getSessionByGroupAndAuthor(groupId, authorId); @@ -115,7 +115,7 @@ export class EtherpadClientAdapter { private async tryCreateSession( groupId: string, authorId: string, - sessionCookieExpire: Date, + sessionCookieExpire: Date ): Promise> { try { const unixTimeInSeconds = Math.floor(sessionCookieExpire.getTime() / 1000); @@ -162,7 +162,7 @@ export class EtherpadClientAdapter { } private async tryListSessionsOfAuthor( - authorId: AuthorId, + authorId: AuthorId ): Promise> { try { const response = await this.authorApi.listSessionsOfAuthorUsingGET(authorId); @@ -209,7 +209,7 @@ export class EtherpadClientAdapter { private async tryCreateEtherpad( groupId: string, - parentId: string, + parentId: string ): Promise> { try { const response = await this.groupApi.createGroupPadUsingGET(groupId, parentId); @@ -333,7 +333,7 @@ export class EtherpadClientAdapter { private handleEtherpadResponse( axiosResponse: AxiosResponse, - payload: EtherpadParams, + payload: EtherpadParams ): T['data'] { const response = axiosResponse.data; diff --git a/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts b/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts index f318c2e0e8..762be94149 100644 --- a/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts +++ b/apps/server/src/infra/etherpad-client/mappers/etherpad-response.mapper.ts @@ -60,13 +60,13 @@ export class EtherpadResponseMapper { static mapResponseToException( type: EtherpadErrorType, payload: EtherpadParams, - response: T | Error, + response: T | Error ): EtherpadErrorLoggableException { return new EtherpadErrorLoggableException( type, payload, response.message, - ErrorUtils.createHttpExceptionOptions(response.message), + ErrorUtils.createHttpExceptionOptions(response.message) ); } diff --git a/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.spec.ts b/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.spec.ts index a9b7b7168e..944b7dd558 100644 --- a/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.spec.ts +++ b/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.spec.ts @@ -90,13 +90,13 @@ describe('KeycloakIdentityManagementService', () => { expect(ret).not.toBeNull(); expect(ret).toBe(accountId); expect(createUserMock).toBeCalledWith( - expect.objectContaining({ username: testAccount.username, email: testAccount.email }), + expect.objectContaining({ username: testAccount.username, email: testAccount.email }) ); expect(resetPasswordMock).toBeCalledWith( expect.objectContaining({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment credential: expect.objectContaining({ value: testAccountPassword }), - }), + }) ); }); @@ -145,7 +145,7 @@ describe('KeycloakIdentityManagementService', () => { email: mockedAccount1.email, firstName: mockedAccount1.firstName, lastName: mockedAccount1.lastName, - }), + }) ); }); @@ -161,7 +161,7 @@ describe('KeycloakIdentityManagementService', () => { expect(ret).toEqual( expect.objectContaining({ id: '', - }), + }) ); }); @@ -176,7 +176,7 @@ describe('KeycloakIdentityManagementService', () => { date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), - date.getUTCMilliseconds(), + date.getUTCMilliseconds() ); kcUsersMock.findOne.mockResolvedValueOnce({ @@ -191,7 +191,7 @@ describe('KeycloakIdentityManagementService', () => { expect.objectContaining({ id: ret.id, createdDate: date, - }), + }) ); }); @@ -215,7 +215,7 @@ describe('KeycloakIdentityManagementService', () => { attDbcAccountId: 'dbcAccountId', attDbcUserId: 'dbcUserId', attDbcSystemId: 'dbcSystemId', - }), + }) ); }); @@ -239,7 +239,7 @@ describe('KeycloakIdentityManagementService', () => { attDbcAccountId: 'dbcAccountId', attDbcUserId: 'dbcUserId', attDbcSystemId: 'dbcSystemId', - }), + }) ); }); @@ -267,7 +267,7 @@ describe('KeycloakIdentityManagementService', () => { firstName: mockedAccount1.firstName, lastName: mockedAccount1.lastName, }), - ]), + ]) ); }); it('should return undefined if no account found', async () => { @@ -291,7 +291,7 @@ describe('KeycloakIdentityManagementService', () => { email: mockedAccount1.email, firstName: mockedAccount1.firstName, lastName: mockedAccount1.lastName, - }), + }) ); }); it('should throw if no account found', async () => { @@ -317,7 +317,7 @@ describe('KeycloakIdentityManagementService', () => { email: mockedAccount1.email, firstName: mockedAccount1.firstName, lastName: mockedAccount1.lastName, - }), + }) ); }); it('should throw if no account found', async () => { @@ -345,7 +345,7 @@ describe('KeycloakIdentityManagementService', () => { email: mockedAccount1.email, firstName: mockedAccount1.firstName, lastName: mockedAccount1.lastName, - }), + }) ); expect(ret).toContainEqual( expect.objectContaining({ @@ -354,7 +354,7 @@ describe('KeycloakIdentityManagementService', () => { email: mockedAccount2.email, firstName: mockedAccount2.firstName, lastName: mockedAccount2.lastName, - }), + }) ); }); @@ -378,7 +378,7 @@ describe('KeycloakIdentityManagementService', () => { expect(ret).toBe(accountId); expect(updateUserMock).toBeCalledWith( expect.objectContaining({ id: accountId }), - expect.objectContaining({ firstName: testAccount.firstName, email: testAccount.email }), + expect.objectContaining({ firstName: testAccount.firstName, email: testAccount.email }) ); }); @@ -394,7 +394,7 @@ describe('KeycloakIdentityManagementService', () => { expect(ret).toBe(accountId); expect(updateUserMock).toBeCalledWith( expect.objectContaining({ id: accountId }), - expect.objectContaining({ enabled: true }), + expect.objectContaining({ enabled: true }) ); }); @@ -442,7 +442,7 @@ describe('KeycloakIdentityManagementService', () => { expect.objectContaining({ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment credential: expect.objectContaining({ value: testAccountPassword }), - }), + }) ); }); @@ -509,7 +509,7 @@ describe('KeycloakIdentityManagementService', () => { await idm.setUserAttribute(mockedAccount1.id, attributeName, attributeValue); expect(kcUsersMock.update).toBeCalledWith( expect.objectContaining({ id: mockedAccount1.id }), - expect.objectContaining({ attributes: { [attributeName]: attributeValue } }), + expect.objectContaining({ attributes: { [attributeName]: attributeValue } }) ); }); @@ -519,7 +519,7 @@ describe('KeycloakIdentityManagementService', () => { await idm.setUserAttribute(mockedAccount1.id, attributeName, attributeValue); expect(kcUsersMock.update).toBeCalledWith( expect.objectContaining({ id: mockedAccount1.id }), - expect.objectContaining({ attributes: { [attributeName]: attributeValue } }), + expect.objectContaining({ attributes: { [attributeName]: attributeValue } }) ); }); }); @@ -532,7 +532,7 @@ describe('KeycloakIdentityManagementService', () => { it('should throw an error', async () => { setup(); await expect(idm.setUserAttribute('userId', 'attributeName', 'attributeValue')).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); diff --git a/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.ts b/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.ts index d910a55628..e665540115 100644 --- a/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.ts +++ b/apps/server/src/infra/identity-management/keycloak/service/keycloak-identity-management.service.ts @@ -55,7 +55,7 @@ export class KeycloakIdentityManagementService extends IdentityManagementService firstName: account.firstName, lastName: account.lastName, enabled: true, - }, + } ); return id; } @@ -136,7 +136,7 @@ export class KeycloakIdentityManagementService extends IdentityManagementService async getUserAttribute( userId: string, - attributeName: string, + attributeName: string ): Promise { const kc = await this.kcAdminClient.callKcAdminClient(); const user = await kc.users.findOne({ id: userId }); @@ -153,7 +153,7 @@ export class KeycloakIdentityManagementService extends IdentityManagementService async setUserAttribute( userId: string, attributeName: string, - attributeValue: TValue, + attributeValue: TValue ): Promise { const kc = await this.kcAdminClient.callKcAdminClient(); const user = await kc.users.findOne({ id: userId }); diff --git a/apps/server/src/infra/s3-client/s3-client.adapter.ts b/apps/server/src/infra/s3-client/s3-client.adapter.ts index def05f96f5..59021aa434 100644 --- a/apps/server/src/infra/s3-client/s3-client.adapter.ts +++ b/apps/server/src/infra/s3-client/s3-client.adapter.ts @@ -28,7 +28,7 @@ export class S3ClientAdapter { constructor( @Inject(S3_CLIENT) readonly client: S3Client, @Inject(S3_CONFIG) readonly config: S3Config, - private logger: LegacyLogger, + private logger: LegacyLogger ) { this.logger.setContext(S3ClientAdapter.name); } @@ -46,7 +46,7 @@ export class S3ClientAdapter { } throw new InternalServerErrorException( 'S3ClientAdapter:createBucket', - ErrorUtils.createHttpExceptionOptions(err), + ErrorUtils.createHttpExceptionOptions(err) ); } } @@ -285,7 +285,7 @@ export class S3ClientAdapter { } catch (err) { throw new InternalServerErrorException( 'S3ClientAdapter:deleteDirectory', - ErrorUtils.createHttpExceptionOptions(err), + ErrorUtils.createHttpExceptionOptions(err) ); } } diff --git a/apps/server/src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.ts b/apps/server/src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.ts index ef83664cab..e800261356 100644 --- a/apps/server/src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.ts +++ b/apps/server/src/infra/schulconnex-client/response/policies-info/schulconnex-policies-info-response.ts @@ -5,7 +5,7 @@ import { SchulconnexPoliciesInfoErrorResponse } from './schulconnex-policies-inf import { SchulconnexPoliciesInfoLicenseResponse } from './schulconnex-policies-info-license-response'; const policiesInfoDiscriminator = ( - obj: unknown, + obj: unknown ): ClassConstructor => typeof obj === 'object' && obj !== null && 'target' in obj && 'permission' in obj ? SchulconnexPoliciesInfoLicenseResponse diff --git a/apps/server/src/infra/sync/tsp/loggable/tsp-system-not-found.loggable-exception.ts b/apps/server/src/infra/sync/tsp/loggable/tsp-system-not-found.loggable-exception.ts index cb04c99012..3abebbea60 100644 --- a/apps/server/src/infra/sync/tsp/loggable/tsp-system-not-found.loggable-exception.ts +++ b/apps/server/src/infra/sync/tsp/loggable/tsp-system-not-found.loggable-exception.ts @@ -10,7 +10,7 @@ export class TspSystemNotFoundLoggableException extends BusinessError implements title: 'The TSP system could not be found', defaultMessage: 'The TSP system could not be found during the sync', }, - HttpStatus.BAD_REQUEST, + HttpStatus.BAD_REQUEST ); } diff --git a/apps/server/src/modules/account/api/account.controller.ts b/apps/server/src/modules/account/api/account.controller.ts index 333db1bedb..a26701a9ee 100644 --- a/apps/server/src/modules/account/api/account.controller.ts +++ b/apps/server/src/modules/account/api/account.controller.ts @@ -34,7 +34,7 @@ export class AccountController { @ApiResponse({ status: 403, type: ForbiddenOperationError, description: 'User is not a superhero or administrator.' }) async searchAccounts( @CurrentUser() currentUser: ICurrentUser, - @Query() query: AccountSearchQueryParams, + @Query() query: AccountSearchQueryParams ): Promise { const search = new AccountSearchDto(query); const searchResult = await this.accountUc.searchAccounts(currentUser, search); @@ -50,7 +50,7 @@ export class AccountController { @ApiResponse({ status: 404, type: EntityNotFoundError, description: 'Account not found.' }) async findAccountById( @CurrentUser() currentUser: ICurrentUser, - @Param() params: AccountByIdParams, + @Param() params: AccountByIdParams ): Promise { const dto = await this.accountUc.findAccountById(currentUser, params.id); return AccountResponseMapper.mapToAccountResponse(dto); @@ -79,7 +79,7 @@ export class AccountController { async updateAccountById( @CurrentUser() currentUser: ICurrentUser, @Param() params: AccountByIdParams, - @Body() body: AccountByIdBodyParams, + @Body() body: AccountByIdBodyParams ): Promise { const updateData = new UpdateAccountDto(body); const dto = await this.accountUc.updateAccountById(currentUser, params.id, updateData); @@ -95,7 +95,7 @@ export class AccountController { @ApiResponse({ status: 404, type: EntityNotFoundError, description: 'Account not found.' }) async deleteAccountById( @CurrentUser() currentUser: ICurrentUser, - @Param() params: AccountByIdParams, + @Param() params: AccountByIdParams ): Promise { const dto = await this.accountUc.deleteAccountById(currentUser, params.id); return AccountResponseMapper.mapToAccountResponse(dto); @@ -109,7 +109,7 @@ export class AccountController { @ApiResponse({ status: 404, type: EntityNotFoundError, description: 'Account or user not found.' }) async replaceMyPassword( @CurrentUser() currentUser: ICurrentUser, - @Body() params: PatchMyPasswordParams, + @Body() params: PatchMyPasswordParams ): Promise { return this.accountUc.replaceMyTemporaryPassword(currentUser.userId, params.password, params.confirmPassword); } diff --git a/apps/server/src/modules/account/api/account.uc.spec.ts b/apps/server/src/modules/account/api/account.uc.spec.ts index d15d50b447..d9761a9837 100644 --- a/apps/server/src/modules/account/api/account.uc.spec.ts +++ b/apps/server/src/modules/account/api/account.uc.spec.ts @@ -81,7 +81,7 @@ describe('AccountUc', () => { it('should throw EntityNotFoundError', async () => { setup(); await expect(accountUc.updateMyAccount('accountWithoutUser', { passwordOld: defaultPassword })).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -112,7 +112,7 @@ describe('AccountUc', () => { await expect( accountUc.updateMyAccount(mockUserWithoutAccount.id, { passwordOld: defaultPassword, - }), + }) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -145,13 +145,13 @@ describe('AccountUc', () => { accountUc.updateMyAccount(mockStudentUser.id, { passwordOld: defaultPassword, firstName: 'newFirstName', - }), + }) ).rejects.toThrow(UnauthorizedException); await expect( accountUc.updateMyAccount(mockStudentUser.id, { passwordOld: defaultPassword, lastName: 'newLastName', - }), + }) ).rejects.toThrow(UnauthorizedException); }); }); @@ -196,13 +196,13 @@ describe('AccountUc', () => { accountUc.updateMyAccount(mockAdminUser.id, { passwordOld: defaultPassword, firstName: 'newFirstName', - }), + }) ).resolves.not.toThrow(); await expect( accountUc.updateMyAccount(mockAdminUser.id, { passwordOld: defaultPassword, lastName: 'newLastName', - }), + }) ).resolves.not.toThrow(); }); }); @@ -237,13 +237,13 @@ describe('AccountUc', () => { accountUc.updateMyAccount(mockSuperheroUser.id, { passwordOld: defaultPassword, firstName: 'newFirstName', - }), + }) ).resolves.not.toThrow(); await expect( accountUc.updateMyAccount(mockSuperheroUser.id, { passwordOld: defaultPassword, lastName: 'newLastName', - }), + }) ).resolves.not.toThrow(); }); }); @@ -311,7 +311,7 @@ describe('AccountUc', () => { ], 1, 0, - 1, + 1 ); expect(accounts).toStrictEqual(expected); }); @@ -463,21 +463,21 @@ describe('AccountUc', () => { accountUc.searchAccounts(currentUserFactory.build({ userId: mockTeacherUser.id }), { type: AccountSearchType.USER_ID, value: mockAdminUser.id, - } as AccountSearchDto), + } as AccountSearchDto) ).rejects.toThrow(UnauthorizedException); await expect( accountUc.searchAccounts(currentUserFactory.build({ userId: mockStudentUser.id }), { type: AccountSearchType.USER_ID, value: mockOtherStudentUser.id, - } as AccountSearchDto), + } as AccountSearchDto) ).rejects.toThrow(UnauthorizedException); await expect( accountUc.searchAccounts(currentUserFactory.build({ userId: mockStudentUser.id }), { type: AccountSearchType.USER_ID, value: mockTeacherUser.id, - } as AccountSearchDto), + } as AccountSearchDto) ).rejects.toThrow(UnauthorizedException); }); }); @@ -505,7 +505,7 @@ describe('AccountUc', () => { await expect( accountUc.searchAccounts(currentUserFactory.build({ userId: mockSuperheroUser.id }), { type: '' as AccountSearchType, - } as AccountSearchDto), + } as AccountSearchDto) ).rejects.toThrow('Invalid search type.'); }); }); @@ -543,7 +543,7 @@ describe('AccountUc', () => { accountUc.searchAccounts(currentUserFactory.build({ userId: mockTeacherUser.id }), { type: AccountSearchType.USERNAME, value: mockStudentUser.id, - } as AccountSearchDto), + } as AccountSearchDto) ).rejects.toThrow(UnauthorizedException); }); }); @@ -1264,7 +1264,7 @@ describe('AccountUc', () => { const { mockSuperheroUser, mockStudentUser, mockStudentAccount } = setup(); const account = await accountUc.findAccountById( currentUserFactory.build({ userId: mockSuperheroUser.id }), - mockStudentAccount.id, + mockStudentAccount.id ); expect(account).toStrictEqual( expect.objectContaining({ @@ -1272,7 +1272,7 @@ describe('AccountUc', () => { username: mockStudentAccount.username, userId: mockStudentUser.id, activated: mockStudentAccount.activated, - }), + }) ); }); }); @@ -1309,7 +1309,7 @@ describe('AccountUc', () => { it('should throw UnauthorizedException', async () => { const { mockTeacherUser, mockStudentAccount } = setup(); await expect( - accountUc.findAccountById(currentUserFactory.build({ userId: mockTeacherUser.id }), mockStudentAccount.id), + accountUc.findAccountById(currentUserFactory.build({ userId: mockTeacherUser.id }), mockStudentAccount.id) ).rejects.toThrow(UnauthorizedException); }); }); @@ -1338,7 +1338,7 @@ describe('AccountUc', () => { it('should throw EntityNotFoundError', async () => { const { mockSuperheroUser } = setup(); await expect( - accountUc.findAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx'), + accountUc.findAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx') ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1367,7 +1367,7 @@ describe('AccountUc', () => { it('should throw EntityNotFoundError', async () => { const { mockSuperheroUser } = setup(); await expect( - accountUc.findAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx'), + accountUc.findAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx') ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1392,7 +1392,7 @@ describe('AccountUc', () => { expect(spy).toHaveBeenCalledWith( expect.objectContaining({ username: 'john.doe@domain.tld', - }), + }) ); }); }); @@ -1423,7 +1423,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: '00000000000' }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, mockStudentAccount.id, body)).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -1467,7 +1467,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: mockAdminUser.id }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, '000000000000000', body)).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -1505,8 +1505,8 @@ describe('AccountUc', () => { mockAccountWithoutUser.id, { username: 'user-fail@to.update', - } as UpdateAccountDto, - ), + } as UpdateAccountDto + ) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1690,7 +1690,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: mockTeacherUser.id }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, mockOtherTeacherAccount.id, body)).rejects.toThrow( - UnauthorizedException, + UnauthorizedException ); }); }); @@ -1749,7 +1749,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: mockDifferentSchoolAdminUser.id }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, mockTeacherAccount.id, body)).rejects.toThrow( - UnauthorizedException, + UnauthorizedException ); }); }); @@ -1836,7 +1836,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: mockUnknownRoleUser.id }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, mockAccountWithoutRole.id, body)).rejects.toThrow( - UnauthorizedException, + UnauthorizedException ); }); }); @@ -1884,7 +1884,7 @@ describe('AccountUc', () => { const currentUser = currentUserFactory.build({ userId: mockAdminUser.id }); const body = {} as UpdateAccountDto; await expect(accountUc.updateAccountById(currentUser, mockUnknownRoleUserAccount.id, body)).rejects.toThrow( - UnauthorizedException, + UnauthorizedException ); }); }); @@ -1923,10 +1923,7 @@ describe('AccountUc', () => { it('should delete an account', async () => { const { mockSuperheroUser, mockStudentAccount } = setup(); await expect( - accountUc.deleteAccountById( - currentUserFactory.build({ userId: mockSuperheroUser.id }), - mockStudentAccount.id, - ), + accountUc.deleteAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), mockStudentAccount.id) ).resolves.not.toThrow(); }); }); @@ -1979,7 +1976,7 @@ describe('AccountUc', () => { it('should throw UnauthorizedException', async () => { const { mockAdminUser, mockStudentAccount } = setup(); await expect( - accountUc.deleteAccountById(currentUserFactory.build({ userId: mockAdminUser.id }), mockStudentAccount.id), + accountUc.deleteAccountById(currentUserFactory.build({ userId: mockAdminUser.id }), mockStudentAccount.id) ).rejects.toThrow(UnauthorizedException); }); }); @@ -2017,7 +2014,7 @@ describe('AccountUc', () => { it('should throw, if no account matches the search term', async () => { const { mockSuperheroUser } = setup(); await expect( - accountUc.deleteAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx'), + accountUc.deleteAccountById(currentUserFactory.build({ userId: mockSuperheroUser.id }), 'xxx') ).rejects.toThrow(EntityNotFoundError); }); }); diff --git a/apps/server/src/modules/account/domain/services/account-db.service.spec.ts b/apps/server/src/modules/account/domain/services/account-db.service.spec.ts index c1800db756..77a53fa9eb 100644 --- a/apps/server/src/modules/account/domain/services/account-db.service.spec.ts +++ b/apps/server/src/modules/account/domain/services/account-db.service.spec.ts @@ -100,7 +100,7 @@ describe('AccountDbService', () => { const resultAccount = await accountService.findById(mockTeacherAccount.id); expect(resultAccount).toEqual(mockTeacherAccount); }, - 10 * 60 * 1000, + 10 * 60 * 1000 ); }); @@ -177,7 +177,7 @@ describe('AccountDbService', () => { const { mockAccountWithSystemId } = setup(); const resultAccount = await accountService.findByUsernameAndSystemId( mockAccountWithSystemId.username, - mockAccountWithSystemId.systemId ?? '', + mockAccountWithSystemId.systemId ?? '' ); expect(resultAccount).not.toBe(undefined); }); @@ -194,7 +194,7 @@ describe('AccountDbService', () => { return Promise.resolve(mockAccountWithSystemId); } return Promise.resolve(null); - }, + } ); return { mockAccountWithSystemId }; }; @@ -203,7 +203,7 @@ describe('AccountDbService', () => { const { mockAccountWithSystemId } = setup(); const resultAccount = await accountService.findByUsernameAndSystemId( 'nonExistentUsername', - mockAccountWithSystemId.systemId ?? '', + mockAccountWithSystemId.systemId ?? '' ); expect(resultAccount).toBeNull(); }); @@ -221,7 +221,7 @@ describe('AccountDbService', () => { return Promise.resolve(mockAccountWithSystemId); } return Promise.resolve(null); - }, + } ); return { mockAccountWithSystemId }; }; @@ -230,7 +230,7 @@ describe('AccountDbService', () => { const { mockAccountWithSystemId } = setup(); const resultAccount = await accountService.findByUsernameAndSystemId( mockAccountWithSystemId.username, - 'nonExistentSystemId', + 'nonExistentSystemId' ); expect(resultAccount).toBeNull(); }); @@ -253,7 +253,7 @@ describe('AccountDbService', () => { accountRepo.findMultipleByUserId.mockImplementation((userIds: (EntityId | ObjectId)[]): Promise => { const accounts = [mockStudentAccount, mockTeacherAccount].filter((tempAccount) => - userIds.find((userId) => tempAccount.userId?.toString() === userId), + userIds.find((userId) => tempAccount.userId?.toString() === userId) ); return Promise.resolve(accounts); }); @@ -276,7 +276,7 @@ describe('AccountDbService', () => { accountRepo.findMultipleByUserId.mockImplementation((userIds: (EntityId | ObjectId)[]): Promise => { const accounts = [mockStudentAccount, mockTeacherAccount].filter((tempAccount) => - userIds.find((userId) => tempAccount.userId?.toString() === userId), + userIds.find((userId) => tempAccount.userId?.toString() === userId) ); return Promise.resolve(accounts); }); @@ -471,7 +471,7 @@ describe('AccountDbService', () => { systemId: accountToSave.systemId, createdAt: accountToSave.createdAt, updatedAt: accountToSave.updatedAt, - }), + }) ); return { accountToSave }; @@ -516,7 +516,7 @@ describe('AccountDbService', () => { userId: accountToSave.userId, createdAt: accountToSave.createdAt, updatedAt: accountToSave.updatedAt, - }), + }) ); return { accountToSave }; @@ -553,7 +553,7 @@ describe('AccountDbService', () => { userId: accountToSave.userId, createdAt: accountToSave.createdAt, updatedAt: accountToSave.updatedAt, - }), + }) ); return { accountToSave }; @@ -567,7 +567,7 @@ describe('AccountDbService', () => { expect(accountRepo.save).toBeCalledWith( // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - expect.objectContaining({ password: expect.not.stringMatching(defaultPassword) }), + expect.objectContaining({ password: expect.not.stringMatching(defaultPassword) }) ); }); }); @@ -607,7 +607,7 @@ describe('AccountDbService', () => { userId: accountToSave.userId, createdAt: accountToSave.createdAt, updatedAt: accountToSave.updatedAt, - }), + }) ); return { accountToSave, accountInRepo }; @@ -643,7 +643,7 @@ describe('AccountDbService', () => { expect(spy).toHaveBeenCalledWith( expect.objectContaining({ password: undefined, - }), + }) ); }); }); @@ -671,7 +671,7 @@ describe('AccountDbService', () => { expect(spy).toHaveBeenCalledWith( expect.objectContaining({ password: mockTeacherAccount.password, - }), + }) ); }); }); @@ -805,7 +805,7 @@ describe('AccountDbService', () => { const setup = async () => { const ret = await accountService.validatePassword( { password: await bcrypt.hash(defaultPassword, 10) } as unknown as Account, - defaultPassword, + defaultPassword ); return { ret }; @@ -822,7 +822,7 @@ describe('AccountDbService', () => { const setup = async () => { const ret = await accountService.validatePassword( { password: await bcrypt.hash(defaultPassword, 10) } as unknown as Account, - 'incorrectPwd', + 'incorrectPwd' ); return { ret }; diff --git a/apps/server/src/modules/account/domain/services/account-db.service.ts b/apps/server/src/modules/account/domain/services/account-db.service.ts index 32cbc7cc62..fa5198310f 100644 --- a/apps/server/src/modules/account/domain/services/account-db.service.ts +++ b/apps/server/src/modules/account/domain/services/account-db.service.ts @@ -16,7 +16,7 @@ export class AccountServiceDb extends AbstractAccountService { constructor( private readonly accountRepo: AccountRepo, private readonly idmService: IdentityManagementService, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) { super(); } @@ -69,7 +69,7 @@ export class AccountServiceDb extends AbstractAccountService { } await account.update(accountSave); return account; - }), + }) ); const savedAccounts = this.accountRepo.saveAll(updatedAccounts); diff --git a/apps/server/src/modules/account/domain/services/account-idm.service.spec.ts b/apps/server/src/modules/account/domain/services/account-idm.service.spec.ts index 15b9b0d21c..8abdbaea87 100644 --- a/apps/server/src/modules/account/domain/services/account-idm.service.spec.ts +++ b/apps/server/src/modules/account/domain/services/account-idm.service.spec.ts @@ -297,14 +297,14 @@ describe('AccountIdmService', () => { describe('when validate password', () => { const setup = (acceptPassword: boolean) => { idmOauthServiceMock.resourceOwnerPasswordGrant.mockResolvedValue( - acceptPassword ? '{ "alg": "HS256", "typ": "JWT" }' : undefined, + acceptPassword ? '{ "alg": "HS256", "typ": "JWT" }' : undefined ); }; it('should validate password by checking JWT', async () => { setup(true); const ret = await accountIdmService.validatePassword( { username: 'username' } as unknown as Account, - 'password', + 'password' ); expect(ret).toBe(true); }); @@ -312,7 +312,7 @@ describe('AccountIdmService', () => { setup(false); const ret = await accountIdmService.validatePassword( { username: 'username' } as unknown as Account, - 'password', + 'password' ); expect(ret).toBe(false); }); diff --git a/apps/server/src/modules/account/domain/services/account-idm.service.ts b/apps/server/src/modules/account/domain/services/account-idm.service.ts index c71474da0f..0cd0effd9a 100644 --- a/apps/server/src/modules/account/domain/services/account-idm.service.ts +++ b/apps/server/src/modules/account/domain/services/account-idm.service.ts @@ -19,7 +19,7 @@ export class AccountServiceIdm extends AbstractAccountService { private readonly accountIdmToDoMapper: AccountIdmToDoMapper, private readonly idmOauthService: IdentityManagementOauthService, private readonly logger: Logger, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) { super(); } @@ -76,7 +76,7 @@ export class AccountServiceIdm extends AbstractAccountService { public async searchByUsernamePartialMatch( userName: string, skip: number, - limit: number, + limit: number ): Promise> { const [results, total] = await this.identityManager.findAccountsByUsername(userName, { skip, limit, exact: false }); const accounts = results.map((result) => this.accountIdmToDoMapper.mapToDo(result)); diff --git a/apps/server/src/modules/account/domain/services/account.service.integration.spec.ts b/apps/server/src/modules/account/domain/services/account.service.integration.spec.ts index 36591a7c45..de4cabbe90 100644 --- a/apps/server/src/modules/account/domain/services/account.service.integration.spec.ts +++ b/apps/server/src/modules/account/domain/services/account.service.integration.spec.ts @@ -59,7 +59,7 @@ describe('AccountService Integration', () => { attDbcSystemId: testAccount.systemId, attDbcAccountId: refId, }, - testAccount.password, + testAccount.password ); return idmId; }; @@ -151,7 +151,7 @@ describe('AccountService Integration', () => { attDbcAccountId: createdAccount.id, attDbcUserId: createdAccount.userId, attDbcSystemId: createdAccount.systemId, - }), + }) ); }; @@ -162,7 +162,7 @@ describe('AccountService Integration', () => { username: createdAccount.username, userId: new ObjectId(createdAccount.userId), systemId: new ObjectId(createdAccount.systemId), - }), + }) ); }; @@ -235,12 +235,12 @@ describe('AccountService Integration', () => { expect(foundAccount).toEqual( expect.objectContaining>({ username: newUsername, - }), + }) ); expect(foundDbAccount).toEqual( expect.objectContaining>({ username: newUsername, - }), + }) ); }); }); diff --git a/apps/server/src/modules/account/domain/services/account.service.spec.ts b/apps/server/src/modules/account/domain/services/account.service.spec.ts index 0987c73daa..eb0c28b90a 100644 --- a/apps/server/src/modules/account/domain/services/account.service.spec.ts +++ b/apps/server/src/modules/account/domain/services/account.service.spec.ts @@ -60,7 +60,7 @@ describe('AccountService', () => { userRepo, accountRepo, eventBus, - orm, + orm ); const defaultPassword = 'DummyPasswd!1'; @@ -374,7 +374,7 @@ describe('AccountService', () => { accountServiceDb.save.mockResolvedValueOnce(account); accountServiceIdm.save.mockImplementation(() => - Promise.resolve(new Account({ username: 'otherUsername', id: '' })), + Promise.resolve(new Account({ username: 'otherUsername', id: '' })) ); return { service: newAccountService(), account }; @@ -446,7 +446,7 @@ describe('AccountService', () => { expect(spy).toHaveBeenCalledWith( expect.objectContaining({ username: ' John.Doe@domain.tld ', - }), + }) ); spy.mockRestore(); }); @@ -1101,7 +1101,7 @@ describe('AccountService', () => { await expect( accountService.updateMyAccount(mockExternalUser, mockExternalAccount, { passwordOld: defaultPassword, - }), + }) ).rejects.toThrow(ForbiddenOperationError); }); }); @@ -1130,7 +1130,7 @@ describe('AccountService', () => { await expect( accountService.updateMyAccount(mockStudentUser, mockStudentAccount, { passwordOld: 'DoesNotMatch', - }), + }) ).rejects.toThrow(AuthorizationError); }); }); @@ -1160,7 +1160,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, passwordNew: otherPassword, - }), + }) ).resolves.not.toThrow(); }); }); @@ -1199,7 +1199,7 @@ describe('AccountService', () => { expect(spyAccountServiceSave).toHaveBeenCalledWith( expect.objectContaining({ password: undefined, - }), + }) ); }); }); @@ -1231,7 +1231,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: 'an@available.mail', - }), + }) ).resolves.not.toThrow(); }); }); @@ -1267,7 +1267,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: testMail, - }), + }) ).resolves.not.toThrow(); expect(accountSaveSpy).toBeCalledWith(expect.objectContaining({ username: testMail.toLowerCase() })); }); @@ -1303,7 +1303,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: testMail, - }), + }) ).resolves.not.toThrow(); expect(userUpdateSpy).toBeCalledWith(expect.objectContaining({ email: testMail.toLowerCase() })); }); @@ -1339,7 +1339,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: testMail, - }), + }) ).resolves.not.toThrow(); expect(userUpdateSpy).toBeCalledWith(expect.objectContaining({ email: testMail.toLowerCase() })); expect(accountSaveSpy).toBeCalledWith(expect.objectContaining({ username: testMail.toLowerCase() })); @@ -1371,7 +1371,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: 'already@in.use', - }), + }) ).rejects.toThrow(ValidationError); }); }); @@ -1401,13 +1401,13 @@ describe('AccountService', () => { accountService.updateMyAccount(mockTeacherUser, mockTeacherAccountDo, { passwordOld: defaultPassword, firstName: 'newFirstName', - }), + }) ).resolves.not.toThrow(); await expect( accountService.updateMyAccount(mockTeacherUser, mockTeacherAccountDo, { passwordOld: defaultPassword, lastName: 'newLastName', - }), + }) ).resolves.not.toThrow(); }); }); @@ -1438,7 +1438,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockTeacherUser, mockTeacherAccountDo, { passwordOld: defaultPassword, firstName: 'failToUpdate', - }), + }) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1471,7 +1471,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: 'fail@to.update', - }), + }) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1504,7 +1504,7 @@ describe('AccountService', () => { accountService.updateMyAccount(mockStudentUser, mockStudentAccountDo, { passwordOld: defaultPassword, email: 'fail@to.update', - }), + }) ).rejects.toThrow(ValidationError); }); }); @@ -1635,7 +1635,7 @@ describe('AccountService', () => { const body = { username: 'fail@to.update' } as UpdateAccount; await expect(accountService.updateAccount(mockStudentUser, mockStudentAccountDo, body)).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -1664,7 +1664,7 @@ describe('AccountService', () => { const body = { username: 'user-fail@to.update' } as UpdateAccount; await expect(accountService.updateAccount(mockStudentUser, mockStudentAccountDo, body)).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -1725,7 +1725,7 @@ describe('AccountService', () => { const body = { username: mockOtherTeacherAccount.username } as UpdateAccount; await expect(accountService.updateAccount(mockStudentUser, mockStudentAccountDo, body)).rejects.toThrow( - ValidationError, + ValidationError ); }); }); @@ -1735,7 +1735,7 @@ describe('AccountService', () => { describe('When passwords do not match', () => { it('should throw ForbiddenOperationError', async () => { await expect( - accountService.replaceMyTemporaryPassword('userId', defaultPassword, otherPassword), + accountService.replaceMyTemporaryPassword('userId', defaultPassword, otherPassword) ).rejects.toThrow(ForbiddenOperationError); }); }); @@ -1758,7 +1758,7 @@ describe('AccountService', () => { it('should throw EntityNotFoundError', async () => { const { mockUserWithoutAccount } = setup(); await expect( - accountService.replaceMyTemporaryPassword(mockUserWithoutAccount.id, defaultPassword, defaultPassword), + accountService.replaceMyTemporaryPassword(mockUserWithoutAccount.id, defaultPassword, defaultPassword) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1771,7 +1771,7 @@ describe('AccountService', () => { it('should throw EntityNotFoundError', async () => { setup(); await expect( - accountService.replaceMyTemporaryPassword('accountWithoutUser', defaultPassword, defaultPassword), + accountService.replaceMyTemporaryPassword('accountWithoutUser', defaultPassword, defaultPassword) ).rejects.toThrow(EntityNotFoundError); }); }); @@ -1792,7 +1792,7 @@ describe('AccountService', () => { userRepo.findById.mockResolvedValueOnce(mockExternalUser); accountServiceDb.findByUserIdOrFail.mockResolvedValueOnce( - AccountEntityToDoMapper.mapToDo(mockExternalUserAccount), + AccountEntityToDoMapper.mapToDo(mockExternalUserAccount) ); return { mockExternalUserAccount }; @@ -1804,8 +1804,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockExternalUserAccount.userId?.toString() ?? '', defaultPassword, - defaultPassword, - ), + defaultPassword + ) ).rejects.toThrow(ForbiddenOperationError); }); }); @@ -1837,8 +1837,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', defaultPassword, - defaultPassword, - ), + defaultPassword + ) ).rejects.toThrow(ForbiddenOperationError); }); }); @@ -1871,8 +1871,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', defaultPassword, - defaultPassword, - ), + defaultPassword + ) ).rejects.toThrow(ForbiddenOperationError); }); }); @@ -1905,8 +1905,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', defaultPassword, - defaultPassword, - ), + defaultPassword + ) ).rejects.toThrow(Error); }); }); @@ -1940,8 +1940,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', otherPassword, - otherPassword, - ), + otherPassword + ) ).resolves.not.toThrow(); }); }); @@ -1975,8 +1975,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', otherPassword, - otherPassword, - ), + otherPassword + ) ).resolves.not.toThrow(); }); }); @@ -2010,8 +2010,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', otherPassword, - otherPassword, - ), + otherPassword + ) ).resolves.not.toThrow(); }); }); @@ -2051,8 +2051,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', otherPassword, - otherPassword, - ), + otherPassword + ) ).rejects.toThrow(new EntityNotFoundError(User.name)); }); }); @@ -2088,8 +2088,8 @@ describe('AccountService', () => { accountService.replaceMyTemporaryPassword( mockStudentAccount.userId?.toString() ?? '', otherPassword, - otherPassword, - ), + otherPassword + ) ).rejects.toThrow(EntityNotFoundError); }); }); diff --git a/apps/server/src/modules/account/domain/services/account.service.ts b/apps/server/src/modules/account/domain/services/account.service.ts index 802742889e..83f86a3260 100644 --- a/apps/server/src/modules/account/domain/services/account.service.ts +++ b/apps/server/src/modules/account/domain/services/account.service.ts @@ -66,7 +66,7 @@ export class AccountService extends AbstractAccountService implements DeletionSe private readonly userRepo: UserRepo, private readonly accountRepo: AccountRepo, private readonly eventBus: EventBus, - private readonly orm: MikroORM, + private readonly orm: MikroORM ) { super(); this.logger.setContext(AccountService.name); @@ -122,7 +122,7 @@ export class AccountService extends AbstractAccountService implements DeletionSe updateData: UpdateMyAccount, user: User, account: Account, - accountSave: AccountSave, + accountSave: AccountSave ): Promise { if (updateData.email && user.email !== updateData.email) { const newMail = updateData.email.toLowerCase(); diff --git a/apps/server/src/modules/authentication/controllers/login.controller.ts b/apps/server/src/modules/authentication/controllers/login.controller.ts index 17d3e8f9ac..0e87ec2448 100644 --- a/apps/server/src/modules/authentication/controllers/login.controller.ts +++ b/apps/server/src/modules/authentication/controllers/login.controller.ts @@ -61,7 +61,7 @@ export class LoginController { @CurrentUser() user: OauthCurrentUser, // Body is not used, but validated and used in the strategy implementation // eslint-disable-next-line @typescript-eslint/no-unused-vars - @Body() _: Oauth2AuthorizationBodyParams, + @Body() _: Oauth2AuthorizationBodyParams ): Promise { const loginDto: LoginDto = await this.loginUc.getLoginData(user); diff --git a/apps/server/src/modules/authentication/errors/brute-force.error.ts b/apps/server/src/modules/authentication/errors/brute-force.error.ts index ece519e701..e0f217217f 100644 --- a/apps/server/src/modules/authentication/errors/brute-force.error.ts +++ b/apps/server/src/modules/authentication/errors/brute-force.error.ts @@ -10,7 +10,7 @@ export class BruteForceError extends BusinessError { HttpStatus.TOO_MANY_REQUESTS, { timeToWait, - }, + } ); this.timeToWait = timeToWait; } diff --git a/apps/server/src/modules/authentication/errors/ldap-connection.error.ts b/apps/server/src/modules/authentication/errors/ldap-connection.error.ts index 5cc9a9e7d4..3ae56f2b76 100644 --- a/apps/server/src/modules/authentication/errors/ldap-connection.error.ts +++ b/apps/server/src/modules/authentication/errors/ldap-connection.error.ts @@ -10,7 +10,7 @@ export class LdapConnectionError extends BusinessError { defaultMessage: 'LDAP connection failed', }, HttpStatus.BAD_GATEWAY, - details, + details ); } } diff --git a/apps/server/src/modules/authentication/loggable/account-not-found.loggable-exception.ts b/apps/server/src/modules/authentication/loggable/account-not-found.loggable-exception.ts index e8ccd1d1f0..03cdff60ca 100644 --- a/apps/server/src/modules/authentication/loggable/account-not-found.loggable-exception.ts +++ b/apps/server/src/modules/authentication/loggable/account-not-found.loggable-exception.ts @@ -11,7 +11,7 @@ export class AccountNotFoundLoggableException extends BusinessError implements L title: 'Login has failed because account not found', defaultMessage: 'Login has failed because account not found', }, - HttpStatus.UNAUTHORIZED, + HttpStatus.UNAUTHORIZED ); } diff --git a/apps/server/src/modules/authentication/loggable/school-in-migration.loggable-exception.ts b/apps/server/src/modules/authentication/loggable/school-in-migration.loggable-exception.ts index 3d8c9a8d4a..8d6a0d651b 100644 --- a/apps/server/src/modules/authentication/loggable/school-in-migration.loggable-exception.ts +++ b/apps/server/src/modules/authentication/loggable/school-in-migration.loggable-exception.ts @@ -10,7 +10,7 @@ export class SchoolInMigrationLoggableException extends BusinessError implements title: 'Login failed because school is in migration', defaultMessage: 'Login failed because creation of user is not possible during migration', }, - HttpStatus.UNAUTHORIZED, + HttpStatus.UNAUTHORIZED ); } diff --git a/apps/server/src/modules/authentication/loggable/user-account-deactivated-exception.ts b/apps/server/src/modules/authentication/loggable/user-account-deactivated-exception.ts index 352dd4d6f7..9357970d2c 100644 --- a/apps/server/src/modules/authentication/loggable/user-account-deactivated-exception.ts +++ b/apps/server/src/modules/authentication/loggable/user-account-deactivated-exception.ts @@ -10,7 +10,7 @@ export class UserAccountDeactivatedLoggableException extends BusinessError imple title: 'Login failed because user account is deactivated', defaultMessage: 'Login failed because user account is deactivated', }, - HttpStatus.UNAUTHORIZED, + HttpStatus.UNAUTHORIZED ); } diff --git a/apps/server/src/modules/authentication/loggable/user-could-not-be-authenticated.loggable.exception.ts b/apps/server/src/modules/authentication/loggable/user-could-not-be-authenticated.loggable.exception.ts index 384ad90377..f47d6cc879 100644 --- a/apps/server/src/modules/authentication/loggable/user-could-not-be-authenticated.loggable.exception.ts +++ b/apps/server/src/modules/authentication/loggable/user-could-not-be-authenticated.loggable.exception.ts @@ -11,7 +11,7 @@ export class LdapUserCouldNotBeAuthenticatedLoggableException extends BusinessEr title: 'User could not be authenticated', defaultMessage: 'LdapService connection failed because User could not be authenticated', }, - HttpStatus.UNAUTHORIZED, + HttpStatus.UNAUTHORIZED ); } diff --git a/apps/server/src/modules/authentication/mapper/current-user.mapper.spec.ts b/apps/server/src/modules/authentication/mapper/current-user.mapper.spec.ts index 25af7951f0..bde332cfe2 100644 --- a/apps/server/src/modules/authentication/mapper/current-user.mapper.spec.ts +++ b/apps/server/src/modules/authentication/mapper/current-user.mapper.spec.ts @@ -124,7 +124,7 @@ describe('CurrentUserMapper', () => { const { accountId, user } = setup(); expect(() => CurrentUserMapper.mapToOauthCurrentUser(accountId, user, undefined, 'idToken')).toThrow( - ValidationError, + ValidationError ); }); }); diff --git a/apps/server/src/modules/authentication/mapper/current-user.mapper.ts b/apps/server/src/modules/authentication/mapper/current-user.mapper.ts index 97c96a2158..66ad3d11d9 100644 --- a/apps/server/src/modules/authentication/mapper/current-user.mapper.ts +++ b/apps/server/src/modules/authentication/mapper/current-user.mapper.ts @@ -24,7 +24,7 @@ export class CurrentUserMapper { accountId: string, user: UserDO, systemId?: string, - externalIdToken?: string, + externalIdToken?: string ): ICurrentUser { if (!user.id) { throw new ValidationError('user has no ID'); 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 475e2af890..5bf56f8506 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.spec.ts @@ -390,7 +390,7 @@ describe('LdapStrategy', () => { const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId( { systems: [system.id], previousExternalId: undefined }, - user.school.id, + user.school.id ); const account: Account = accountDoFactory.build({ @@ -454,7 +454,7 @@ describe('LdapStrategy', () => { const school: LegacySchoolDo = legacySchoolDoFactory.buildWithId( { systems: [system.id], previousExternalId: 'previousExternalId' }, - user.school.id, + user.school.id ); const account: Account = accountDoFactory.build({ diff --git a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts index 801158bfef..3480438368 100644 --- a/apps/server/src/modules/authentication/strategy/ldap.strategy.ts +++ b/apps/server/src/modules/authentication/strategy/ldap.strategy.ts @@ -24,7 +24,7 @@ export class LdapStrategy extends PassportStrategy(Strategy, StrategyType.LDAP) private readonly ldapService: LdapService, private readonly authenticationService: AuthenticationService, private readonly userRepo: UserRepo, - private readonly logger: Logger, + private readonly logger: Logger ) { super(); } @@ -97,14 +97,14 @@ export class LdapStrategy extends PassportStrategy(Strategy, StrategyType.LDAP) this.logger.info( new ErrorLoggable( new Error( - `Could not find LDAP account with externalSchoolId ${externalSchoolId} for user ${username}. Trying to use the previousExternalId ${school.previousExternalId} next...`, - ), - ), + `Could not find LDAP account with externalSchoolId ${externalSchoolId} for user ${username}. Trying to use the previousExternalId ${school.previousExternalId} next...` + ) + ) ); account = await this.authenticationService.loadAccount( `${school.previousExternalId}/${username}`.toLowerCase(), - systemId, + systemId ); } else { throw err; diff --git a/apps/server/src/modules/authentication/strategy/local.strategy.ts b/apps/server/src/modules/authentication/strategy/local.strategy.ts index 608536c229..e5b96182cc 100644 --- a/apps/server/src/modules/authentication/strategy/local.strategy.ts +++ b/apps/server/src/modules/authentication/strategy/local.strategy.ts @@ -17,7 +17,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) { private readonly authenticationService: AuthenticationService, private readonly idmOauthService: IdentityManagementOauthService, private readonly configService: ConfigService, - private readonly userRepo: UserRepo, + private readonly userRepo: UserRepo ) { super(); } @@ -36,7 +36,7 @@ export class LocalStrategy extends PassportStrategy(Strategy) { const accountUserId = TypeGuard.checkNotNullOrUndefined( account.userId, - new Error(`login failing, because account ${account.id} has no userId`), + new Error(`login failing, because account ${account.id} has no userId`) ); const user = await this.userRepo.findById(accountUserId, true); const currentUser = CurrentUserMapper.userToICurrentUser(account.id, user, false); diff --git a/apps/server/src/modules/authorization-reference/api/authorization-reference.controller.ts b/apps/server/src/modules/authorization-reference/api/authorization-reference.controller.ts index 60820cf796..9828f7f2be 100644 --- a/apps/server/src/modules/authorization-reference/api/authorization-reference.controller.ts +++ b/apps/server/src/modules/authorization-reference/api/authorization-reference.controller.ts @@ -19,13 +19,13 @@ export class AuthorizationReferenceController { @Post('by-reference') public async authorizeByReference( @Body() body: AuthorizationBodyParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const authorizationReponse = await this.authorizationReferenceUc.authorizeByReference( user.userId, body.referenceType, body.referenceId, - body.context, + body.context ); return authorizationReponse; diff --git a/apps/server/src/modules/authorization-reference/domain/reference.loader.spec.ts b/apps/server/src/modules/authorization-reference/domain/reference.loader.spec.ts index a31978e0fd..742e7ce3f6 100644 --- a/apps/server/src/modules/authorization-reference/domain/reference.loader.spec.ts +++ b/apps/server/src/modules/authorization-reference/domain/reference.loader.spec.ts @@ -119,7 +119,7 @@ describe('reference.loader', () => { it('should throw on unknown authorization entity type', () => { void expect(async () => - service.loadAuthorizableObject('NotAllowedEntityType' as AuthorizableReferenceType, entityId), + service.loadAuthorizableObject('NotAllowedEntityType' as AuthorizableReferenceType, entityId) ).rejects.toThrow(NotImplementedException); }); }); @@ -136,7 +136,7 @@ describe('reference.loader', () => { it('should inject course group repo', () => { expect(injectionService.injectReferenceLoader).toBeCalledWith( AuthorizableReferenceType.CourseGroup, - courseGroupRepo, + courseGroupRepo ); }); @@ -151,14 +151,14 @@ describe('reference.loader', () => { it('should inject submission repo', () => { expect(injectionService.injectReferenceLoader).toBeCalledWith( AuthorizableReferenceType.Submission, - submissionRepo, + submissionRepo ); }); it('should inject instance service', () => { expect(injectionService.injectReferenceLoader).toBeCalledWith( AuthorizableReferenceType.Instance, - instanceService, + instanceService ); }); }); diff --git a/apps/server/src/modules/authorization-reference/domain/reference.loader.ts b/apps/server/src/modules/authorization-reference/domain/reference.loader.ts index 42195eeb57..c96b0a41fd 100644 --- a/apps/server/src/modules/authorization-reference/domain/reference.loader.ts +++ b/apps/server/src/modules/authorization-reference/domain/reference.loader.ts @@ -26,7 +26,7 @@ export class ReferenceLoader { private readonly schoolRepo: LegacySchoolRepo, private readonly submissionRepo: SubmissionRepo, private readonly instanceService: InstanceService, - private readonly authorizationInjectionService: AuthorizationInjectionService, + private readonly authorizationInjectionService: AuthorizationInjectionService ) { const service = this.authorizationInjectionService; service.injectReferenceLoader(AuthorizableReferenceType.Task, this.taskRepo); @@ -48,7 +48,7 @@ export class ReferenceLoader { async loadAuthorizableObject( objectName: AuthorizableReferenceType, - objectId: EntityId, + objectId: EntityId ): Promise { const referenceLoader: AuthorizationLoaderService = this.resolveLoader(objectName); const object = await referenceLoader.findById(objectId); diff --git a/apps/server/src/modules/authorization/domain/service/authorization.service.ts b/apps/server/src/modules/authorization/domain/service/authorization.service.ts index 6df3723db2..4a4e683bb5 100644 --- a/apps/server/src/modules/authorization/domain/service/authorization.service.ts +++ b/apps/server/src/modules/authorization/domain/service/authorization.service.ts @@ -14,7 +14,7 @@ export class AuthorizationService { constructor( private readonly ruleManager: RuleManager, private readonly authorizationHelper: AuthorizationHelper, - private readonly userRepo: UserRepo, + private readonly userRepo: UserRepo ) {} public checkPermission(user: User, object: AuthorizableObject | BaseDO, context: AuthorizationContext): void { diff --git a/apps/server/src/modules/board/controller/board-submission.controller.ts b/apps/server/src/modules/board/controller/board-submission.controller.ts index a51c2332da..0923a5024e 100644 --- a/apps/server/src/modules/board/controller/board-submission.controller.ts +++ b/apps/server/src/modules/board/controller/board-submission.controller.ts @@ -34,7 +34,7 @@ export class BoardSubmissionController { constructor( private readonly cardUc: CardUc, private readonly elementUc: ElementUc, - private readonly submissionItemUc: SubmissionItemUc, + private readonly submissionItemUc: SubmissionItemUc ) {} @ApiOperation({ summary: 'Get a list of submission items by their parent container.' }) @@ -44,11 +44,11 @@ export class BoardSubmissionController { @Get(':submissionContainerId') async getSubmissionItems( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: SubmissionContainerUrlParams, + @Param() urlParams: SubmissionContainerUrlParams ): Promise { const { submissionItems, users } = await this.submissionItemUc.findSubmissionItems( currentUser.userId, - urlParams.submissionContainerId, + urlParams.submissionContainerId ); const mapper = SubmissionItemResponseMapper.getInstance(); const response = mapper.mapToResponse(submissionItems, users); @@ -66,12 +66,12 @@ export class BoardSubmissionController { async updateSubmissionItem( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: SubmissionItemUrlParams, - @Body() bodyParams: UpdateSubmissionItemBodyParams, + @Body() bodyParams: UpdateSubmissionItemBodyParams ) { await this.submissionItemUc.updateSubmissionItem( currentUser.userId, urlParams.submissionItemId, - bodyParams.completed, + bodyParams.completed ); } @@ -101,7 +101,7 @@ export class BoardSubmissionController { async createElement( @Param() urlParams: SubmissionItemUrlParams, @Body() bodyParams: CreateContentElementBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const { type } = bodyParams; const element = await this.submissionItemUc.createElement(currentUser.userId, urlParams.submissionItemId, type); diff --git a/apps/server/src/modules/board/controller/board.controller.ts b/apps/server/src/modules/board/controller/board.controller.ts index 4f53ee954c..d65c836681 100644 --- a/apps/server/src/modules/board/controller/board.controller.ts +++ b/apps/server/src/modules/board/controller/board.controller.ts @@ -42,7 +42,7 @@ export class BoardController { @Post() async createBoard( @Body() bodyParams: CreateBoardBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const board = await this.boardUc.createBoard(currentUser.userId, bodyParams); @@ -59,7 +59,7 @@ export class BoardController { @Get(':boardId') async getBoardSkeleton( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const { board, features } = await this.boardUc.findBoard(currentUser.userId, urlParams.boardId); @@ -76,7 +76,7 @@ export class BoardController { @Get(':boardId/context') async getBoardContext( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const boardContext = await this.boardUc.findBoardContext(currentUser.userId, urlParams.boardId); @@ -95,7 +95,7 @@ export class BoardController { async updateBoardTitle( @Param() urlParams: BoardUrlParams, @Body() bodyParams: UpdateBoardTitleParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.boardUc.updateBoardTitle(currentUser.userId, urlParams.boardId, bodyParams.title); } @@ -119,7 +119,7 @@ export class BoardController { @Post(':boardId/columns') async createColumn( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const column = await this.boardUc.createColumn(currentUser.userId, urlParams.boardId); @@ -137,7 +137,7 @@ export class BoardController { @RequestTimeout('INCOMING_REQUEST_TIMEOUT_COPY_API') async copyBoard( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const copyStatus = await this.boardUc.copyBoard(currentUser.userId, urlParams.boardId, currentUser.schoolId); const dto = CopyMapper.mapToResponse(copyStatus); @@ -154,7 +154,7 @@ export class BoardController { async updateVisibility( @Param() urlParams: BoardUrlParams, @Body() bodyParams: VisibilityBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ) { await this.boardUc.updateVisibility(currentUser.userId, urlParams.boardId, bodyParams.isVisible); } diff --git a/apps/server/src/modules/board/controller/card.controller.ts b/apps/server/src/modules/board/controller/card.controller.ts index 075d308ee4..23803ddc00 100644 --- a/apps/server/src/modules/board/controller/card.controller.ts +++ b/apps/server/src/modules/board/controller/card.controller.ts @@ -40,10 +40,7 @@ import { CardResponseMapper, ContentElementResponseFactory } from './mapper'; @JwtAuthentication() @Controller('cards') export class CardController { - constructor( - private readonly columnUc: ColumnUc, - private readonly cardUc: CardUc, - ) {} + constructor(private readonly columnUc: ColumnUc, private readonly cardUc: CardUc) {} @ApiOperation({ summary: 'Get a list of cards by their ids.' }) @ApiResponse({ status: 200, type: CardListResponse }) @@ -52,7 +49,7 @@ export class CardController { @Get() async getCards( @CurrentUser() currentUser: ICurrentUser, - @Query() cardIdParams: CardIdsParams, + @Query() cardIdParams: CardIdsParams ): Promise { const cardIds = Array.isArray(cardIdParams.ids) ? cardIdParams.ids : [cardIdParams.ids]; const cards = await this.cardUc.findCards(currentUser.userId, cardIds); @@ -74,7 +71,7 @@ export class CardController { async moveCard( @Param() urlParams: CardUrlParams, @Body() bodyParams: MoveCardBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.columnUc.moveCard(currentUser.userId, urlParams.cardId, bodyParams.toColumnId, bodyParams.toPosition); } @@ -89,7 +86,7 @@ export class CardController { async updateCardHeight( @Param() urlParams: CardUrlParams, @Body() bodyParams: SetHeightBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.cardUc.updateCardHeight(currentUser.userId, urlParams.cardId, bodyParams.height); } @@ -104,7 +101,7 @@ export class CardController { async updateCardTitle( @Param() urlParams: CardUrlParams, @Body() bodyParams: RenameBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.cardUc.updateCardTitle(currentUser.userId, urlParams.cardId, bodyParams.title); } @@ -129,7 +126,7 @@ export class CardController { SubmissionContainerElementResponse, DrawingElementResponse, DeletedElementResponse, - VideoConferenceElementResponse, + VideoConferenceElementResponse ) @ApiResponse({ status: 201, @@ -153,7 +150,7 @@ export class CardController { async createElement( @Param() urlParams: CardUrlParams, @Body() bodyParams: CreateContentElementBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const { type, toPosition } = bodyParams; const element = await this.cardUc.createElement(currentUser.userId, urlParams.cardId, type, toPosition); diff --git a/apps/server/src/modules/board/controller/column.controller.ts b/apps/server/src/modules/board/controller/column.controller.ts index 68b371102d..fda134f9e7 100644 --- a/apps/server/src/modules/board/controller/column.controller.ts +++ b/apps/server/src/modules/board/controller/column.controller.ts @@ -22,10 +22,7 @@ import { CardResponseMapper } from './mapper'; @JwtAuthentication() @Controller('columns') export class ColumnController { - constructor( - private readonly boardUc: BoardUc, - private readonly columnUc: ColumnUc, - ) {} + constructor(private readonly boardUc: BoardUc, private readonly columnUc: ColumnUc) {} @ApiOperation({ summary: 'Move a single column.' }) @ApiResponse({ status: 204 }) @@ -37,7 +34,7 @@ export class ColumnController { async moveColumn( @Param() urlParams: ColumnUrlParams, @Body() bodyParams: MoveColumnBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.boardUc.moveColumn(currentUser.userId, urlParams.columnId, bodyParams.toBoardId, bodyParams.toPosition); } @@ -52,7 +49,7 @@ export class ColumnController { async updateColumnTitle( @Param() urlParams: ColumnUrlParams, @Body() bodyParams: RenameBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.columnUc.updateColumnTitle(currentUser.userId, urlParams.columnId, bodyParams.title); } @@ -78,7 +75,7 @@ export class ColumnController { async createCard( @Param() urlParams: ColumnUrlParams, @CurrentUser() currentUser: ICurrentUser, - @Body() createCardBodyParams?: CreateCardBodyParams, + @Body() createCardBodyParams?: CreateCardBodyParams ): Promise { const { requiredEmptyElements } = createCardBodyParams || {}; const card = await this.columnUc.createCard(currentUser.userId, urlParams.columnId, requiredEmptyElements); diff --git a/apps/server/src/modules/board/controller/dto/card/card.response.ts b/apps/server/src/modules/board/controller/dto/card/card.response.ts index a1652735c5..70fdd7948b 100644 --- a/apps/server/src/modules/board/controller/dto/card/card.response.ts +++ b/apps/server/src/modules/board/controller/dto/card/card.response.ts @@ -24,7 +24,7 @@ import { VisibilitySettingsResponse } from './visibility-settings.response'; SubmissionContainerElementResponse, CollaborativeTextEditorElementResponse, DeletedElementResponse, - VideoConferenceElementResponse, + VideoConferenceElementResponse ) export class CardResponse { constructor({ id, title, height, elements, visibilitySettings, timestamps }: CardResponse) { diff --git a/apps/server/src/modules/board/controller/element.controller.ts b/apps/server/src/modules/board/controller/element.controller.ts index a329dc0ec3..3f654ad869 100644 --- a/apps/server/src/modules/board/controller/element.controller.ts +++ b/apps/server/src/modules/board/controller/element.controller.ts @@ -44,10 +44,7 @@ import { ContentElementResponseFactory, SubmissionItemResponseMapper } from './m @JwtAuthentication() @Controller('elements') export class ElementController { - constructor( - private readonly cardUc: CardUc, - private readonly elementUc: ElementUc, - ) {} + constructor(private readonly cardUc: CardUc, private readonly elementUc: ElementUc) {} @ApiOperation({ summary: 'Move a single content element.' }) @ApiResponse({ status: 204 }) @@ -59,13 +56,13 @@ export class ElementController { async moveElement( @Param() urlParams: ContentElementUrlParams, @Body() bodyParams: MoveContentElementBody, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.cardUc.moveElement( currentUser.userId, urlParams.contentElementId, bodyParams.toCardId, - bodyParams.toPosition, + bodyParams.toPosition ); } @@ -77,7 +74,7 @@ export class ElementController { ExternalToolElementContentBody, LinkElementContentBody, DrawingElementContentBody, - VideoConferenceElementContentBody, + VideoConferenceElementContentBody ) @ApiResponse({ status: 200, @@ -101,12 +98,12 @@ export class ElementController { async updateElement( @Param() urlParams: ContentElementUrlParams, @Body() bodyParams: UpdateElementContentBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const element = await this.elementUc.updateElement( currentUser.userId, urlParams.contentElementId, - bodyParams.data.content, + bodyParams.data.content ); const response = ContentElementResponseFactory.mapToResponse(element); return response; @@ -121,7 +118,7 @@ export class ElementController { @Delete(':contentElementId') async deleteElement( @Param() urlParams: ContentElementUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.elementUc.deleteElement(currentUser.userId, urlParams.contentElementId); } @@ -137,12 +134,12 @@ export class ElementController { async createSubmissionItem( @Param() urlParams: ContentElementUrlParams, @Body() bodyParams: CreateSubmissionItemBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const submissionItem = await this.elementUc.createSubmissionItem( currentUser.userId, urlParams.contentElementId, - bodyParams.completed, + bodyParams.completed ); const mapper = SubmissionItemResponseMapper.getInstance(); const response = mapper.mapSubmissionItemToResponse(submissionItem); @@ -158,7 +155,7 @@ export class ElementController { @Get(':contentElementId/permission') async readPermission( @Param() urlParams: ContentElementUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.elementUc.checkElementReadPermission(currentUser.userId, urlParams.contentElementId); } diff --git a/apps/server/src/modules/board/controller/media-board/media-board.controller.ts b/apps/server/src/modules/board/controller/media-board/media-board.controller.ts index 31888d0a73..457e89178f 100644 --- a/apps/server/src/modules/board/controller/media-board/media-board.controller.ts +++ b/apps/server/src/modules/board/controller/media-board/media-board.controller.ts @@ -41,7 +41,7 @@ import { MediaAvailableLineResponseMapper, MediaBoardResponseMapper, MediaLineRe export class MediaBoardController { constructor( private readonly mediaBoardUc: MediaBoardUc, - private readonly mediaAvailableLineUc: MediaAvailableLineUc, + private readonly mediaAvailableLineUc: MediaAvailableLineUc ) {} @ApiOperation({ summary: 'Get the media shelf of the user.' }) @@ -65,7 +65,7 @@ export class MediaBoardController { @Post(':boardId/media-lines') public async createLine( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const line: MediaLine = await this.mediaBoardUc.createLine(currentUser.userId, urlParams.boardId); @@ -80,11 +80,11 @@ export class MediaBoardController { @Get(':boardId/media-available-line') public async getMediaAvailableLine( @Param() urlParams: BoardUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const mediaAvailableLine: MediaAvailableLine = await this.mediaAvailableLineUc.getMediaAvailableLine( currentUser.userId, - urlParams.boardId, + urlParams.boardId ); const response: MediaAvailableLineResponse = MediaAvailableLineResponseMapper.mapToResponse(mediaAvailableLine); @@ -102,12 +102,12 @@ export class MediaBoardController { public async updateMediaAvailableLineColor( @Param() urlParams: BoardUrlParams, @Body() bodyParams: ColorBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaAvailableLineUc.updateAvailableLineColor( currentUser.userId, urlParams.boardId, - bodyParams.backgroundColor, + bodyParams.backgroundColor ); } @@ -121,7 +121,7 @@ export class MediaBoardController { public async collapseMediaAvailableLine( @Param() urlParams: BoardUrlParams, @Body() bodyParams: CollapsableBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaAvailableLineUc.collapseAvailableLine(currentUser.userId, urlParams.boardId, bodyParams.collapsed); } @@ -136,7 +136,7 @@ export class MediaBoardController { public async setMediaBoardLayout( @Param() urlParams: BoardUrlParams, @Body() bodyParams: LayoutBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaBoardUc.setLayout(currentUser.userId, urlParams.boardId, bodyParams.layout); } diff --git a/apps/server/src/modules/board/controller/media-board/media-element.controller.ts b/apps/server/src/modules/board/controller/media-board/media-element.controller.ts index f03128bde5..73266e350e 100644 --- a/apps/server/src/modules/board/controller/media-board/media-element.controller.ts +++ b/apps/server/src/modules/board/controller/media-board/media-element.controller.ts @@ -47,13 +47,13 @@ export class MediaElementController { public async moveElement( @Param() urlParams: ElementUrlParams, @Body() bodyParams: MoveElementBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaElementUc.moveElement( currentUser.userId, urlParams.elementId, bodyParams.toLineId, - bodyParams.toPosition, + bodyParams.toPosition ); } @@ -64,13 +64,13 @@ export class MediaElementController { @Post() public async createElement( @Body() params: CreateMediaElementBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const element: MediaExternalToolElement = await this.mediaElementUc.createElement( currentUser.userId, params.schoolExternalToolId, params.lineId, - params.position, + params.position ); const response: MediaExternalToolElementResponse = @@ -87,7 +87,7 @@ export class MediaElementController { @Delete(':elementId') public async deleteElement( @Param() urlParams: ElementUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaElementUc.deleteElement(currentUser.userId, urlParams.elementId); } diff --git a/apps/server/src/modules/board/controller/media-board/media-line.controller.ts b/apps/server/src/modules/board/controller/media-board/media-line.controller.ts index dbbd8dd889..42b6379a6b 100644 --- a/apps/server/src/modules/board/controller/media-board/media-line.controller.ts +++ b/apps/server/src/modules/board/controller/media-board/media-line.controller.ts @@ -40,7 +40,7 @@ export class MediaLineController { public async moveLine( @Param() urlParams: LineUrlParams, @Body() bodyParams: MoveColumnBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaLineUc.moveLine(currentUser.userId, urlParams.lineId, bodyParams.toBoardId, bodyParams.toPosition); } @@ -55,7 +55,7 @@ export class MediaLineController { public async updateLineTitle( @Param() urlParams: LineUrlParams, @Body() bodyParams: RenameBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaLineUc.updateLineTitle(currentUser.userId, urlParams.lineId, bodyParams.title); } @@ -70,7 +70,7 @@ export class MediaLineController { public async updateBackgroundColor( @Param() urlParams: LineUrlParams, @Body() bodyParams: ColorBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaLineUc.updateLineColor(currentUser.userId, urlParams.lineId, bodyParams.backgroundColor); } @@ -85,7 +85,7 @@ export class MediaLineController { public async collapseMediaLine( @Param() urlParams: LineUrlParams, @Body() bodyParams: CollapsableBodyParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.mediaLineUc.collapseLine(currentUser.userId, urlParams.lineId, bodyParams.collapsed); } diff --git a/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.spec.ts b/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.spec.ts index aaeb707c97..71c390d5f8 100644 --- a/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.spec.ts +++ b/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.spec.ts @@ -118,7 +118,7 @@ describe('Collaborative Storage Service', () => { create: false, delete: false, share: false, - }), + }) ).rejects.toThrow(ForbiddenException); }); }); diff --git a/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.ts b/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.ts index c89d6654e3..421335c044 100644 --- a/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.ts +++ b/apps/server/src/modules/collaborative-storage/services/collaborative-storage.service.ts @@ -18,7 +18,7 @@ export class CollaborativeStorageService { private teamsMapper: TeamMapper, private teamsRepo: TeamsRepo, private authService: AuthorizationService, - private logger: LegacyLogger, + private logger: LegacyLogger ) { this.logger.setContext(CollaborativeStorageService.name); } @@ -44,17 +44,17 @@ export class CollaborativeStorageService { currentUserId: string, teamId: string, roleId: string, - teamPermissions: TeamPermissionsDto, + teamPermissions: TeamPermissionsDto ): Promise { this.authService.checkPermission( await this.authService.getUserWithPermissions(currentUserId), await this.teamsRepo.findById(teamId, true), - AuthorizationContextBuilder.write([Permission.CHANGE_TEAM_ROLES]), + AuthorizationContextBuilder.write([Permission.CHANGE_TEAM_ROLES]) ); return this.adapter.updateTeamPermissionsForRole( await this.findTeamById(teamId, true), await this.roleService.findById(roleId), - teamPermissions, + teamPermissions ); } diff --git a/apps/server/src/modules/collaborative-text-editor/api/collaborative-text-editor.controller.ts b/apps/server/src/modules/collaborative-text-editor/api/collaborative-text-editor.controller.ts index 241325a9e3..fcabee65e7 100644 --- a/apps/server/src/modules/collaborative-text-editor/api/collaborative-text-editor.controller.ts +++ b/apps/server/src/modules/collaborative-text-editor/api/collaborative-text-editor.controller.ts @@ -23,11 +23,11 @@ export class CollaborativeTextEditorController { async getOrCreateCollaborativeTextEditorForParent( @Param() getCollaborativeTextEditorForParentParams: GetCollaborativeTextEditorForParentParams, @CurrentUser() currentUser: ICurrentUser, - @Res({ passthrough: true }) res: Response, + @Res({ passthrough: true }) res: Response ): Promise { const textEditor = await this.collaborativeTextEditorUc.getOrCreateCollaborativeTextEditorForParent( currentUser.userId, - getCollaborativeTextEditorForParentParams, + getCollaborativeTextEditorForParentParams ); res.cookie('sessionID', textEditor.sessionId, { diff --git a/apps/server/src/modules/common-cartridge/common-cartridge-client/board-client/board-client.adapter.ts b/apps/server/src/modules/common-cartridge/common-cartridge-client/board-client/board-client.adapter.ts index 80212e2b73..b2b48e2d33 100644 --- a/apps/server/src/modules/common-cartridge/common-cartridge-client/board-client/board-client.adapter.ts +++ b/apps/server/src/modules/common-cartridge/common-cartridge-client/board-client/board-client.adapter.ts @@ -9,10 +9,7 @@ import { BoardSkeletonDtoMapper } from './mapper'; @Injectable() export class BoardClientAdapter { - constructor( - private readonly boardApi: BoardApi, - @Inject(REQUEST) private request: Request, - ) {} + constructor(private readonly boardApi: BoardApi, @Inject(REQUEST) private request: Request) {} public async getBoardSkeletonById(boardId: string): Promise { const options = this.createOptionParams(); diff --git a/apps/server/src/modules/common-cartridge/common-cartridge-client/card-client/card-client.adapter.ts b/apps/server/src/modules/common-cartridge/common-cartridge-client/card-client/card-client.adapter.ts index 39d8a92dde..66a803f3c8 100644 --- a/apps/server/src/modules/common-cartridge/common-cartridge-client/card-client/card-client.adapter.ts +++ b/apps/server/src/modules/common-cartridge/common-cartridge-client/card-client/card-client.adapter.ts @@ -9,10 +9,7 @@ import { CardResponseMapper } from './mapper/card-response.mapper'; @Injectable() export class CardClientAdapter { - constructor( - private readonly boardCardApi: BoardCardApi, - @Inject(REQUEST) private request: Request, - ) {} + constructor(private readonly boardCardApi: BoardCardApi, @Inject(REQUEST) private request: Request) {} public async getAllBoardCardsByIds(cardsIds: string[]): Promise { const options = this.createOptionParams(); diff --git a/apps/server/src/modules/common-cartridge/common-cartridge-client/lesson-client/lesson-client.adapter.ts b/apps/server/src/modules/common-cartridge/common-cartridge-client/lesson-client/lesson-client.adapter.ts index 16fc4df0d6..334b68f908 100644 --- a/apps/server/src/modules/common-cartridge/common-cartridge-client/lesson-client/lesson-client.adapter.ts +++ b/apps/server/src/modules/common-cartridge/common-cartridge-client/lesson-client/lesson-client.adapter.ts @@ -9,10 +9,7 @@ import { LessonDtoMapper } from './mapper/lesson-dto.mapper'; @Injectable() export class LessonClientAdapter { - constructor( - private readonly lessonApi: LessonApi, - @Inject(REQUEST) private request: Request, - ) {} + constructor(private readonly lessonApi: LessonApi, @Inject(REQUEST) private request: Request) {} public async getLessonById(lessonId: string): Promise { const options = this.createOptionParams(); diff --git a/apps/server/src/modules/common-cartridge/common-cartridge-client/room-client/room-client.adapter.ts b/apps/server/src/modules/common-cartridge/common-cartridge-client/room-client/room-client.adapter.ts index 3c5303182f..45f4a0bf84 100644 --- a/apps/server/src/modules/common-cartridge/common-cartridge-client/room-client/room-client.adapter.ts +++ b/apps/server/src/modules/common-cartridge/common-cartridge-client/room-client/room-client.adapter.ts @@ -9,10 +9,7 @@ import { CourseRoomsApi } from './room-api-client'; @Injectable() export class CourseRoomsClientAdapter { - constructor( - private readonly courseRoomsApi: CourseRoomsApi, - @Inject(REQUEST) private request: Request, - ) {} + constructor(private readonly courseRoomsApi: CourseRoomsApi, @Inject(REQUEST) private request: Request) {} public async getRoomBoardByCourseId(roomId: string): Promise { const options = this.createOptionParams(); diff --git a/apps/server/src/modules/common-cartridge/import/common-cartridge-resource-factory.ts b/apps/server/src/modules/common-cartridge/import/common-cartridge-resource-factory.ts index 876607b6e8..b80b9a80f3 100644 --- a/apps/server/src/modules/common-cartridge/import/common-cartridge-resource-factory.ts +++ b/apps/server/src/modules/common-cartridge/import/common-cartridge-resource-factory.ts @@ -15,7 +15,7 @@ export class CommonCartridgeResourceFactory { public create( organization: CommonCartridgeOrganizationProps, - inputFormat: InputFormat, + inputFormat: InputFormat ): CommonCartridgeResourceProps | undefined { if (!this.isValidOrganization(organization)) { return undefined; @@ -60,7 +60,7 @@ export class CommonCartridgeResourceFactory { private createWebContentResource( content: string, title: string, - inputFormat: InputFormat, + inputFormat: InputFormat ): CommonCartridgeWebContentResourceProps | undefined { const document = this.tryCreateDocument(content, 'text/html'); diff --git a/apps/server/src/modules/deletion/api/uc/deletion-request.uc.spec.ts b/apps/server/src/modules/deletion/api/uc/deletion-request.uc.spec.ts index 865711916e..0d900dbb5c 100644 --- a/apps/server/src/modules/deletion/api/uc/deletion-request.uc.spec.ts +++ b/apps/server/src/modules/deletion/api/uc/deletion-request.uc.spec.ts @@ -93,7 +93,7 @@ describe(DeletionRequestUc.name, () => { expect(deletionRequestService.createDeletionRequest).toHaveBeenCalledWith( deletionRequestToCreate.targetRef.id, deletionRequestToCreate.targetRef.domain, - deletionRequestToCreate.deleteInMinutes, + deletionRequestToCreate.deleteInMinutes ); }); @@ -185,7 +185,7 @@ describe(DeletionRequestUc.name, () => { await uc.executeDeletionRequests(); expect(eventBus.publish).toHaveBeenCalledWith( - new UserDeletedEvent(deletionRequest.id, deletionRequest.targetRefId), + new UserDeletedEvent(deletionRequest.id, deletionRequest.targetRefId) ); }); }); @@ -221,19 +221,19 @@ describe(DeletionRequestUc.name, () => { const targetRef = DeletionTargetRefBuilder.build( deletionRequestExecuted.targetRefDomain, - deletionRequestExecuted.targetRefId, + deletionRequestExecuted.targetRefId ); const statistics: DomainDeletionReport = DomainDeletionReportBuilder.build( deletionLogExecuted.domain, deletionLogExecuted.operations, - deletionLogExecuted.subdomainOperations, + deletionLogExecuted.subdomainOperations ); const executedDeletionRequestSummary = DeletionRequestLogResponseBuilder.build( targetRef, deletionRequestExecuted.deleteAfter, StatusModel.SUCCESS, - [statistics], + [statistics] ); return { @@ -274,19 +274,19 @@ describe(DeletionRequestUc.name, () => { const targetRef = DeletionTargetRefBuilder.build( deletionRequestExecuted.targetRefDomain, - deletionRequestExecuted.targetRefId, + deletionRequestExecuted.targetRefId ); const statistics = DeletionLogStatisticBuilder.build( deletionLogExecuted.domain, deletionLogExecuted.operations, - deletionLogExecuted.subdomainOperations, + deletionLogExecuted.subdomainOperations ); const executedDeletionRequestSummary = DeletionRequestLogResponseBuilder.build( targetRef, deletionRequestExecuted.deleteAfter, StatusModel.FAILED, - [statistics], + [statistics] ); return { @@ -328,7 +328,7 @@ describe(DeletionRequestUc.name, () => { targetRef, deletionRequest.deleteAfter, StatusModel.REGISTERED, - [], + [] ); return { diff --git a/apps/server/src/modules/deletion/domain/service/deletion-request.service.spec.ts b/apps/server/src/modules/deletion/domain/service/deletion-request.service.spec.ts index 9052db4fd0..6f191ff5ec 100644 --- a/apps/server/src/modules/deletion/domain/service/deletion-request.service.spec.ts +++ b/apps/server/src/modules/deletion/domain/service/deletion-request.service.spec.ts @@ -67,7 +67,7 @@ describe(DeletionRequestService.name, () => { deleteAfter: expect.any(Date), targetRefId, status: StatusModel.REGISTERED, - }), + }) ); }); }); diff --git a/apps/server/src/modules/files-storage/controller/api-test/files-storage-download-upload.api.spec.ts b/apps/server/src/modules/files-storage/controller/api-test/files-storage-download-upload.api.spec.ts index 47cd661880..edc05cedde 100644 --- a/apps/server/src/modules/files-storage/controller/api-test/files-storage-download-upload.api.spec.ts +++ b/apps/server/src/modules/files-storage/controller/api-test/files-storage-download-upload.api.spec.ts @@ -177,7 +177,7 @@ describe('files-storage controller (API)', () => { parentType: 'schools', securityCheckStatus: 'pending', size: expect.any(Number), - }), + }) ); }); @@ -380,7 +380,7 @@ describe('files-storage controller (API)', () => { mimeType: 'application/octet-stream', parentType: 'schools', securityCheckStatus: 'pending', - }), + }) ); }); }); diff --git a/apps/server/src/modules/files-storage/controller/files-storage.controller.ts b/apps/server/src/modules/files-storage/controller/files-storage.controller.ts index ea50c34204..60fea3ae76 100644 --- a/apps/server/src/modules/files-storage/controller/files-storage.controller.ts +++ b/apps/server/src/modules/files-storage/controller/files-storage.controller.ts @@ -62,7 +62,7 @@ export class FilesStorageController { async uploadFromUrl( @Body() body: FileUrlParams, @Param() params: FileRecordParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const fileRecord = await this.filesStorageUC.uploadFromUrl(currentUser.userId, { ...body, ...params }); @@ -83,7 +83,7 @@ export class FilesStorageController { @Body() _: FileParams, @Param() params: FileRecordParams, @CurrentUser() currentUser: ICurrentUser, - @Req() req: Request, + @Req() req: Request ): Promise { const fileRecord = await this.filesStorageUC.upload(currentUser.userId, params, req); @@ -107,7 +107,7 @@ export class FilesStorageController { @CurrentUser() currentUser: ICurrentUser, @Req() req: Request, @Res({ passthrough: true }) response: Response, - @Headers('Range') bytesRange?: string, + @Headers('Range') bytesRange?: string ): Promise { const fileResponse = await this.filesStorageUC.download(params, bytesRange); @@ -135,13 +135,13 @@ export class FilesStorageController { @Req() req: Request, @Res({ passthrough: true }) response: Response, @Headers('Range') bytesRange?: string, - @Headers('If-None-Match') etag?: string, + @Headers('If-None-Match') etag?: string ): Promise { const fileResponse = await this.filesStorageUC.downloadPreview( currentUser.userId, params, previewParams, - bytesRange, + bytesRange ); response.set({ ETag: fileResponse.etag }); @@ -161,7 +161,7 @@ export class FilesStorageController { req: Request, fileResponse: GetFileResponse, httpResponse: Response, - bytesRange?: string, + bytesRange?: string ): StreamableFile { req.on('close', () => fileResponse.data.destroy()); @@ -191,7 +191,7 @@ export class FilesStorageController { @Get('/list/:storageLocation/:storageLocationId/:parentType/:parentId') async list( @Param() params: FileRecordParams, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { const [fileRecords, total] = await this.filesStorageUC.getFileRecordsOfParent(params); const { skip, limit } = pagination; @@ -214,7 +214,7 @@ export class FilesStorageController { @UseInterceptors(RequestLoggingInterceptor) async patchFilename( @Param() params: SingleFileParams, - @Body() renameFileParam: RenameFileParams, + @Body() renameFileParam: RenameFileParams ): Promise { const fileRecord = await this.filesStorageUC.patchFilename(params, renameFileParam); @@ -290,7 +290,7 @@ export class FilesStorageController { async copy( @Param() params: FileRecordParams, @Body() copyFilesParam: CopyFilesOfParentParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const [response, count] = await this.filesStorageUC.copyFilesOfParent(currentUser.userId, params, copyFilesParam); @@ -307,7 +307,7 @@ export class FilesStorageController { async copyFile( @Param() params: SingleFileParams, @Body() copyFileParam: CopyFileParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const response = await this.filesStorageUC.copyOneFile(currentUser.userId, params, copyFileParam); diff --git a/apps/server/src/modules/files-storage/repo/filerecord.repo.ts b/apps/server/src/modules/files-storage/repo/filerecord.repo.ts index b4292681c7..3d0050beac 100644 --- a/apps/server/src/modules/files-storage/repo/filerecord.repo.ts +++ b/apps/server/src/modules/files-storage/repo/filerecord.repo.ts @@ -37,7 +37,7 @@ export class FileRecordRepo extends BaseRepo { storageLocation: StorageLocation, storageLocationId: EntityId, parentId: EntityId, - options?: IFindOptions, + options?: IFindOptions ): Promise> { const scope = new FileRecordScope() .byStorageType(storageLocation) @@ -53,7 +53,7 @@ export class FileRecordRepo extends BaseRepo { storageLocation: StorageLocation, storageLocationId: EntityId, parentId: EntityId, - options?: IFindOptions, + options?: IFindOptions ): Promise> { const scope = new FileRecordScope() .byStorageType(storageLocation) @@ -83,7 +83,7 @@ export class FileRecordRepo extends BaseRepo { private async findAndCount( scope: FileRecordScope, - options?: IFindOptions, + options?: IFindOptions ): Promise> { const { pagination } = options || {}; const order = { createdAt: SortOrder.desc, id: SortOrder.asc }; diff --git a/apps/server/src/modules/files/uc/delete-files.uc.ts b/apps/server/src/modules/files/uc/delete-files.uc.ts index cf9bcc42dc..5aaa026ca4 100644 --- a/apps/server/src/modules/files/uc/delete-files.uc.ts +++ b/apps/server/src/modules/files/uc/delete-files.uc.ts @@ -15,7 +15,7 @@ export class DeleteFilesUc { constructor( private readonly filesRepo: FilesRepo, private readonly storageProviderRepo: StorageProviderRepo, - private readonly logger: LegacyLogger, + private readonly logger: LegacyLogger ) { this.logger.setContext(DeleteFilesUc.name); } @@ -49,14 +49,14 @@ export class DeleteFilesUc { batchCounter += 1; this.logger.log( - `Finished batch ${batchCounter} with ${numberOfFilesInBatch} files and ${numberOfFailingFilesInBatch} failed deletions`, + `Finished batch ${batchCounter} with ${numberOfFilesInBatch} files and ${numberOfFailingFilesInBatch} failed deletions` ); } while (numberOfFilesInBatch > 0); this.logger.log( `${ numberOfProcessedFiles - failingFileIds.length - } out of ${numberOfProcessedFiles} files were successfully deleted`, + } out of ${numberOfProcessedFiles} files were successfully deleted` ); if (failingFileIds.length > 0) { @@ -107,7 +107,7 @@ export class DeleteFilesUc { private getClientForFile(file: FileEntity): S3Client { const storageProvider = TypeGuard.checkNotNullOrUndefined( file.storageProvider, - new Error(`File ${file.id} has no provider.`), + new Error(`File ${file.id} has no provider.`) ); const client = this.s3ClientMap.get(storageProvider.id); diff --git a/apps/server/src/modules/group/controller/group.controller.ts b/apps/server/src/modules/group/controller/group.controller.ts index f8531cef47..7c1b9beb67 100644 --- a/apps/server/src/modules/group/controller/group.controller.ts +++ b/apps/server/src/modules/group/controller/group.controller.ts @@ -24,10 +24,7 @@ import { GroupResponseMapper } from './mapper'; @JwtAuthentication() @Controller('groups') export class GroupController { - constructor( - private readonly groupUc: GroupUc, - private readonly classGroupUc: ClassGroupUc, - ) {} + constructor(private readonly groupUc: GroupUc, private readonly classGroupUc: ClassGroupUc) {} @ApiOperation({ summary: 'Get a list of classes and groups of type class for the current user.' }) @ApiResponse({ status: HttpStatus.OK, type: ClassInfoSearchListResponse }) @@ -38,7 +35,7 @@ export class GroupController { @Query() pagination: GroupPaginationParams, @Query() sortingQuery: ClassSortParams, @Query() filterParams: ClassFilterParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const board: Page = await this.classGroupUc.findAllClasses( currentUser.userId, @@ -46,13 +43,13 @@ export class GroupController { filterParams.type, pagination, sortingQuery.sortBy, - sortingQuery.sortOrder, + sortingQuery.sortOrder ); const response: ClassInfoSearchListResponse = GroupResponseMapper.mapToClassInfoSearchListResponse( board, pagination.skip, - pagination.limit, + pagination.limit ); return response; @@ -65,7 +62,7 @@ export class GroupController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async getGroup( @CurrentUser() currentUser: ICurrentUser, - @Param() params: GroupIdParams, + @Param() params: GroupIdParams ): Promise { const group: ResolvedGroupDto = await this.groupUc.getGroup(currentUser.userId, params.groupId); @@ -84,7 +81,7 @@ export class GroupController { public async getAllGroups( @CurrentUser() currentUser: ICurrentUser, @Query() pagination: GroupPaginationParams, - @Query() params: GroupParams, + @Query() params: GroupParams ): Promise { const options: IFindOptions = { pagination }; @@ -93,7 +90,7 @@ export class GroupController { currentUser.schoolId, options, params.nameQuery, - params.availableGroupsForCourseSync, + params.availableGroupsForCourseSync ); const response: GroupListResponse = GroupResponseMapper.mapToGroupListResponse(groups, pagination); diff --git a/apps/server/src/modules/group/domain/group-aggregate.scope.ts b/apps/server/src/modules/group/domain/group-aggregate.scope.ts index 4b8e5405b6..1454868aa4 100644 --- a/apps/server/src/modules/group/domain/group-aggregate.scope.ts +++ b/apps/server/src/modules/group/domain/group-aggregate.scope.ts @@ -31,7 +31,7 @@ export class GroupAggregateScope extends MongoDbScope { $match: { $or: [{ syncedCourses: { $size: 0 } }, { type: { $eq: GroupTypes.CLASS } }], }, - }, + } ); } diff --git a/apps/server/src/modules/group/repo/group.repo.ts b/apps/server/src/modules/group/repo/group.repo.ts index 5af1b90405..5324d1fe8c 100644 --- a/apps/server/src/modules/group/repo/group.repo.ts +++ b/apps/server/src/modules/group/repo/group.repo.ts @@ -87,13 +87,13 @@ export class GroupRepo extends BaseDomainObjectRepo { public async findGroupsForScope(scope: GroupAggregateScope): Promise> { const mongoEntitiesFacet = (await this.em.aggregate( GroupEntity, - scope.build(), + scope.build() )) as ScopeAggregateResult; const total: number = mongoEntitiesFacet[0]?.total[0]?.count ?? 0; const entities: GroupEntity[] = mongoEntitiesFacet[0].data.map((entity: EntityDictionary) => - this.em.map(GroupEntity, entity), + this.em.map(GroupEntity, entity) ); const domainObjects: Group[] = entities.map((entity) => GroupDomainMapper.mapEntityToDo(entity)); diff --git a/apps/server/src/modules/group/uc/class-group.uc.ts b/apps/server/src/modules/group/uc/class-group.uc.ts index 85755040fc..b400e36675 100644 --- a/apps/server/src/modules/group/uc/class-group.uc.ts +++ b/apps/server/src/modules/group/uc/class-group.uc.ts @@ -31,7 +31,7 @@ export class ClassGroupUc { private readonly authorizationService: AuthorizationService, private readonly schoolYearService: SchoolYearService, private readonly courseService: CourseDoService, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) {} public async findAllClasses( @@ -40,7 +40,7 @@ export class ClassGroupUc { schoolYearQueryType?: SchoolYearQueryType, pagination?: Pagination, sortBy: keyof ClassInfoDto = 'name', - sortOrder: SortOrder = SortOrder.asc, + sortOrder: SortOrder = SortOrder.asc ): Promise> { const school: School = await this.schoolService.getSchoolById(schoolId); @@ -48,7 +48,7 @@ export class ClassGroupUc { this.authorizationService.checkPermission( user, school, - AuthorizationContextBuilder.read([Permission.CLASS_VIEW, Permission.GROUP_VIEW]), + AuthorizationContextBuilder.read([Permission.CLASS_VIEW, Permission.GROUP_VIEW]) ); const groupVisibilityPermission: GroupVisibilityPermission = this.getGroupVisibilityPermission(user, school); @@ -61,7 +61,7 @@ export class ClassGroupUc { } combinedClassInfo.sort((a: ClassInfoDto, b: ClassInfoDto): number => - SortHelper.genericSortFunction(a[sortBy], b[sortBy], sortOrder), + SortHelper.genericSortFunction(a[sortBy], b[sortBy], sortOrder) ); const pageContent: ClassInfoDto[] = this.applyPagination(combinedClassInfo, pagination?.skip, pagination?.limit); @@ -77,7 +77,7 @@ export class ClassGroupUc { this.authorizationService.hasPermission( user, school, - AuthorizationContextBuilder.read([Permission.STUDENT_LIST]), + AuthorizationContextBuilder.read([Permission.STUDENT_LIST]) ); if (canSeeAllSchoolGroups) { @@ -89,7 +89,7 @@ export class ClassGroupUc { private async findCombinedClassListForSchool( schoolId: EntityId, - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): Promise { let classInfosFromGroups: ClassInfoDto[] = []; @@ -106,7 +106,7 @@ export class ClassGroupUc { private async findCombinedClassListForUser( userId: EntityId, - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): Promise { let classInfosFromGroups: ClassInfoDto[] = []; @@ -123,7 +123,7 @@ export class ClassGroupUc { private async findClassesForSchool( schoolId: EntityId, - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): Promise { const classes: Class[] = await this.classService.findClassesForSchool(schoolId); @@ -134,7 +134,7 @@ export class ClassGroupUc { private async findClassesForUser( userId: EntityId, - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): Promise { const classes: Class[] = await this.classService.findAllByUserId(userId); @@ -145,16 +145,17 @@ export class ClassGroupUc { private async getClassInfosFromClasses( classes: Class[], - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): Promise { const currentYear: SchoolYear | undefined = classes.length > 0 ? await this.schoolService.getCurrentYear(classes[0].schoolId) : undefined; - const classesWithSchoolYear: { clazz: Class; schoolYear?: SchoolYearEntity }[] = - await this.addSchoolYearsToClasses(classes); + const classesWithSchoolYear: { clazz: Class; schoolYear?: SchoolYearEntity }[] = await this.addSchoolYearsToClasses( + classes + ); const filteredClassesForSchoolYear = classesWithSchoolYear.filter((classWithSchoolYear) => - this.isClassOfQueryType(currentYear, classWithSchoolYear.schoolYear, schoolYearQueryType), + this.isClassOfQueryType(currentYear, classWithSchoolYear.schoolYear, schoolYearQueryType) ); const classInfosFromClasses: ClassInfoDto[] = this.mapClassInfosFromClasses(filteredClassesForSchoolYear); @@ -174,7 +175,7 @@ export class ClassGroupUc { clazz, schoolYear, }; - }), + }) ); return classesWithSchoolYear; @@ -183,7 +184,7 @@ export class ClassGroupUc { private isClassOfQueryType( currentYear: SchoolYear | undefined, schoolYear?: SchoolYearEntity, - schoolYearQueryType?: SchoolYearQueryType, + schoolYearQueryType?: SchoolYearQueryType ): boolean { if (schoolYearQueryType === undefined) { return true; @@ -206,7 +207,7 @@ export class ClassGroupUc { } private mapClassInfosFromClasses( - filteredClassesForSchoolYear: { clazz: Class; schoolYear?: SchoolYearEntity }[], + filteredClassesForSchoolYear: { clazz: Class; schoolYear?: SchoolYearEntity }[] ): ClassInfoDto[] { const classInfosFromClasses: ClassInfoDto[] = filteredClassesForSchoolYear.map( (classWithSchoolYear): ClassInfoDto => { @@ -215,11 +216,11 @@ export class ClassGroupUc { const mapped: ClassInfoDto = GroupUcMapper.mapClassToClassInfoDto( classWithSchoolYear.clazz, teachers, - classWithSchoolYear.schoolYear, + classWithSchoolYear.schoolYear ); return mapped; - }, + } ); return classInfosFromClasses; } @@ -248,7 +249,7 @@ export class ClassGroupUc { const systemMap: Map = await this.findSystemNamesForGroups(groups); const classInfosFromGroups: ClassInfoDto[] = await Promise.all( - groups.map(async (group: Group): Promise => this.getClassInfoFromGroup(group, systemMap)), + groups.map(async (group: Group): Promise => this.getClassInfoFromGroup(group, systemMap)) ); return classInfosFromGroups; @@ -271,7 +272,7 @@ export class ClassGroupUc { group, resolvedUsers, synchronizedCourses, - system, + system ); return mapped; @@ -293,7 +294,7 @@ export class ClassGroupUc { if (system) { systems.set(systemId, system); } - }), + }) ); return systems; diff --git a/apps/server/src/modules/h5p-editor/controller/h5p-editor.controller.ts b/apps/server/src/modules/h5p-editor/controller/h5p-editor.controller.ts index 51bc542c70..18066c3493 100644 --- a/apps/server/src/modules/h5p-editor/controller/h5p-editor.controller.ts +++ b/apps/server/src/modules/h5p-editor/controller/h5p-editor.controller.ts @@ -82,13 +82,13 @@ export class H5PEditorController { @Param() params: ContentFileUrlParams, @Req() req: Request, @Res({ passthrough: true }) res: Response, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ) { const { data, contentType, contentLength, contentRange } = await this.h5pEditorUc.getContentFile( params.id, params.filename, req, - currentUser, + currentUser ); H5PEditorController.setRangeResponseHeaders(res, contentLength, contentRange); @@ -103,12 +103,12 @@ export class H5PEditorController { @CurrentUser() currentUser: ICurrentUser, @Param('file') file: string, @Req() req: Request, - @Res({ passthrough: true }) res: Response, + @Res({ passthrough: true }) res: Response ) { const { data, contentType, contentLength, contentRange } = await this.h5pEditorUc.getTemporaryFile( file, req, - currentUser, + currentUser ); H5PEditorController.setRangeResponseHeaders(res, contentLength, contentRange); @@ -130,13 +130,13 @@ export class H5PEditorController { FileFieldsInterceptor([ { name: 'file', maxCount: 1 }, { name: 'h5p', maxCount: 1 }, - ]), + ]) ) async postAjax( @Body(AjaxPostBodyParamsTransformPipe) body: AjaxPostBodyParams, @Query() query: AjaxPostQueryParams, @CurrentUser() currentUser: ICurrentUser, - @UploadedFiles() files?: { file?: Express.Multer.File[]; h5p?: Express.Multer.File[] }, + @UploadedFiles() files?: { file?: Express.Multer.File[]; h5p?: Express.Multer.File[] } ) { const contentFile = files?.file?.[0]; const h5pFile = files?.h5p?.[0]; @@ -149,7 +149,7 @@ export class H5PEditorController { @Post('/delete/:contentId') async deleteH5pContent( @Param() params: GetH5PContentParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const deleteSuccessfull = this.h5pEditorUc.deleteH5pContent(currentUser, params.contentId); @@ -170,7 +170,7 @@ export class H5PEditorController { const { editorModel, content } = await this.h5pEditorUc.getH5pEditor( currentUser, params.contentId, - params.language, + params.language ); return new H5PEditorModelContentResponse(editorModel, content); @@ -185,7 +185,7 @@ export class H5PEditorController { body.params.metadata, body.library, body.parentType, - body.parentId, + body.parentId ); const saveResponse = new H5PSaveResponse(response.id, response.metadata); @@ -198,7 +198,7 @@ export class H5PEditorController { async saveH5pContent( @Body() body: PostH5PContentCreateParams, @Param() params: SaveH5PEditorParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ) { const response = await this.h5pEditorUc.saveH5pContentGetMetadata( params.contentId, @@ -207,7 +207,7 @@ export class H5PEditorController { body.params.metadata, body.library, body.parentType, - body.parentId, + body.parentId ); const saveResponse = new H5PSaveResponse(response.id, response.metadata); diff --git a/apps/server/src/modules/h5p-editor/uc/h5p-get-editor.uc.spec.ts b/apps/server/src/modules/h5p-editor/uc/h5p-get-editor.uc.spec.ts index feb00b7be8..92d7376051 100644 --- a/apps/server/src/modules/h5p-editor/uc/h5p-get-editor.uc.spec.ts +++ b/apps/server/src/modules/h5p-editor/uc/h5p-get-editor.uc.spec.ts @@ -119,7 +119,7 @@ describe('get H5P editor', () => { language, expect.objectContaining({ id: mockCurrentUser.userId, - }), + }) ); }); @@ -174,7 +174,7 @@ describe('get H5P editor', () => { expect(authorizationClientAdapter.checkPermissionsByReference).toBeCalledWith( content.parentType, content.parentId, - AuthorizationContextBuilder.write([]), + AuthorizationContextBuilder.write([]) ); }); @@ -188,13 +188,13 @@ describe('get H5P editor', () => { language, expect.objectContaining({ id: mockCurrentUser.userId, - }), + }) ); expect(h5pEditor.getContent).toHaveBeenCalledWith( content.id, expect.objectContaining({ id: mockCurrentUser.userId, - }), + }) ); }); diff --git a/apps/server/src/modules/learnroom/controller/api-test/dashboard.api.spec.ts b/apps/server/src/modules/learnroom/controller/api-test/dashboard.api.spec.ts index 6d78aab534..9889234ada 100644 --- a/apps/server/src/modules/learnroom/controller/api-test/dashboard.api.spec.ts +++ b/apps/server/src/modules/learnroom/controller/api-test/dashboard.api.spec.ts @@ -156,7 +156,7 @@ describe('Dashboard Controller (API)', () => { pos: { x: 1, y: 3 }, gridElement: GridElement.FromPersistedReference( new ObjectId().toString(), - courseFactory.build({ students: [teacherUser], name: 'Mathe' }), + courseFactory.build({ students: [teacherUser], name: 'Mathe' }) ), }, ], @@ -181,14 +181,14 @@ describe('Dashboard Controller (API)', () => { pos: { x: 1, y: 3 }, gridElement: GridElement.FromPersistedReference( new ObjectId().toString(), - courseFactory.build({ students: [teacherUser], name: 'Quantumphysics' }), + courseFactory.build({ students: [teacherUser], name: 'Quantumphysics' }) ), }, { pos: { x: 2, y: 2 }, gridElement: GridElement.FromPersistedReference( new ObjectId().toString(), - courseFactory.build({ students: [teacherUser], name: 'Astrophysics' }), + courseFactory.build({ students: [teacherUser], name: 'Astrophysics' }) ), }, ], @@ -216,7 +216,7 @@ describe('Dashboard Controller (API)', () => { pos: { x: 2, y: 2 }, gridElement: GridElement.FromPersistedReference( new ObjectId().toString(), - courseFactory.build({ students: [teacherUser], name: 'mannequinization' }), + courseFactory.build({ students: [teacherUser], name: 'mannequinization' }) ), }, { @@ -278,7 +278,7 @@ describe('Dashboard Controller (API)', () => { pos: { x: 1, y: 3 }, gridElement: GridElement.FromPersistedReference( new ObjectId().toString(), - courseFactory.build({ students: [teacherUser], name: 'Mathe' }), + courseFactory.build({ students: [teacherUser], name: 'Mathe' }) ), }, ], diff --git a/apps/server/src/modules/learnroom/controller/course-info.controller.ts b/apps/server/src/modules/learnroom/controller/course-info.controller.ts index def45e3e1f..e2535b87a9 100644 --- a/apps/server/src/modules/learnroom/controller/course-info.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course-info.controller.ts @@ -26,7 +26,7 @@ export class CourseInfoController { @CurrentUser() currentUser: ICurrentUser, @Query() pagination: PaginationParams, @Query() sortingQuery: CourseSortParams, - @Query() filterParams: CourseFilterParams, + @Query() filterParams: CourseFilterParams ): Promise { const courses: Page = await this.courseInfoUc.getCourseInfo( currentUser.userId, @@ -34,13 +34,13 @@ export class CourseInfoController { sortingQuery.sortBy, filterParams.status, pagination, - sortingQuery.sortOrder, + sortingQuery.sortOrder ); const response: CourseInfoListResponse = CourseInfoResponseMapper.mapToCourseInfoListResponse( courses, pagination.skip, - pagination.limit, + pagination.limit ); return response; diff --git a/apps/server/src/modules/learnroom/controller/course-rooms.controller.ts b/apps/server/src/modules/learnroom/controller/course-rooms.controller.ts index c51eec6889..6f5844e780 100644 --- a/apps/server/src/modules/learnroom/controller/course-rooms.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course-rooms.controller.ts @@ -28,13 +28,13 @@ export class CourseRoomsController { private readonly roomsUc: CourseRoomsUc, private readonly mapper: RoomBoardResponseMapper, private readonly courseCopyUc: CourseCopyUC, - private readonly lessonCopyUc: LessonCopyUC, + private readonly lessonCopyUc: LessonCopyUC ) {} @Get(':roomId/board') async getRoomBoard( @Param() urlParams: CourseRoomUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const board = await this.roomsUc.getBoard(urlParams.roomId, currentUser.userId); const mapped = this.mapper.mapToResponse(board); @@ -45,13 +45,13 @@ export class CourseRoomsController { async patchElementVisibility( @Param() urlParams: CourseRoomElementUrlParams, @Body() params: PatchVisibilityParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.roomsUc.updateVisibilityOfLegacyBoardElement( urlParams.roomId, urlParams.elementId, currentUser.userId, - params.visibility, + params.visibility ); } @@ -59,7 +59,7 @@ export class CourseRoomsController { async patchOrderingOfElements( @Param() urlParams: CourseRoomUrlParams, @Body() params: PatchOrderParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { await this.roomsUc.reorderBoardElements(urlParams.roomId, currentUser.userId, params.elements); } @@ -68,7 +68,7 @@ export class CourseRoomsController { @RequestTimeout('INCOMING_REQUEST_TIMEOUT_COPY_API') async copyCourse( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: CourseRoomUrlParams, + @Param() urlParams: CourseRoomUrlParams ): Promise { const copyStatus = await this.courseCopyUc.copyCourse(currentUser.userId, urlParams.roomId); const dto = CopyMapper.mapToResponse(copyStatus); @@ -80,12 +80,12 @@ export class CourseRoomsController { async copyLesson( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: LessonUrlParams, - @Body() params: LessonCopyApiParams, + @Body() params: LessonCopyApiParams ): Promise { const copyStatus = await this.lessonCopyUc.copyLesson( currentUser.userId, urlParams.lessonId, - CopyMapper.mapLessonCopyToDomain(params, currentUser.userId), + CopyMapper.mapLessonCopyToDomain(params, currentUser.userId) ); const dto = CopyMapper.mapToResponse(copyStatus); return dto; diff --git a/apps/server/src/modules/learnroom/controller/course.controller.ts b/apps/server/src/modules/learnroom/controller/course.controller.ts index fcf31214c8..24d0f5fc92 100644 --- a/apps/server/src/modules/learnroom/controller/course.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course.controller.ts @@ -44,13 +44,13 @@ export class CourseController { constructor( private readonly courseUc: CourseUc, private readonly courseImportUc: CourseImportUc, - private readonly courseSyncUc: CourseSyncUc, + private readonly courseSyncUc: CourseSyncUc ) {} @Get() public async findForUser( @CurrentUser() currentUser: ICurrentUser, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { const [courses, total] = await this.courseUc.findAllByUser(currentUser.userId, pagination); const courseResponses = courses.map((course) => CourseMapper.mapToMetadataResponse(course)); @@ -82,7 +82,7 @@ export class CourseController { public async importCourse( @CurrentUser() currentUser: ICurrentUser, @UploadedFile(CommonCartridgeFileValidatorPipe) - file: Express.Multer.File, + file: Express.Multer.File ): Promise { await this.courseImportUc.importFromCommonCartridge(currentUser.userId, file.buffer); } @@ -94,7 +94,7 @@ export class CourseController { @ApiUnprocessableEntityResponse({ description: 'The course is not synchronized with a group.' }) public async stopSynchronization( @CurrentUser() currentUser: ICurrentUser, - @Param() params: CourseUrlParams, + @Param() params: CourseUrlParams ): Promise { await this.courseSyncUc.stopSynchronization(currentUser.userId, params.courseId); } @@ -108,7 +108,7 @@ export class CourseController { public async startSynchronization( @CurrentUser() currentUser: ICurrentUser, @Param() params: CourseUrlParams, - @Body() bodyParams: CourseSyncBodyParams, + @Body() bodyParams: CourseSyncBodyParams ): Promise { await this.courseSyncUc.startSynchronization(currentUser.userId, params.courseId, bodyParams.groupId); } @@ -124,7 +124,7 @@ export class CourseController { }) public async getUserPermissions( @CurrentUser() currentUser: ICurrentUser, - @Param() params: CourseUrlParams, + @Param() params: CourseUrlParams ): Promise<{ [userId: string]: string[] }> { const permissions = await this.courseUc.getUserPermissionByCourseId(currentUser.userId, params.courseId); @@ -138,7 +138,7 @@ export class CourseController { @ApiBadRequestResponse({ description: 'Request data has invalid format.' }) @ApiInternalServerErrorResponse({ description: 'Internal server error.' }) public async getCourseCcMetadataById( - @Param() param: CourseUrlParams, + @Param() param: CourseUrlParams ): Promise { const course = await this.courseUc.findCourseById(param.courseId); diff --git a/apps/server/src/modules/learnroom/controller/dto/course-metadata.response.ts b/apps/server/src/modules/learnroom/controller/dto/course-metadata.response.ts index a9ddda536b..ab9e1cac6c 100644 --- a/apps/server/src/modules/learnroom/controller/dto/course-metadata.response.ts +++ b/apps/server/src/modules/learnroom/controller/dto/course-metadata.response.ts @@ -10,7 +10,7 @@ export class CourseMetadataResponse { displayColor: string, startDate?: Date, untilDate?: Date, - copyingSince?: Date, + copyingSince?: Date ) { this.id = id; this.title = title; diff --git a/apps/server/src/modules/learnroom/repo/mikro-orm/course.repo.ts b/apps/server/src/modules/learnroom/repo/mikro-orm/course.repo.ts index 9f41618049..763641ac82 100644 --- a/apps/server/src/modules/learnroom/repo/mikro-orm/course.repo.ts +++ b/apps/server/src/modules/learnroom/repo/mikro-orm/course.repo.ts @@ -40,7 +40,7 @@ export class CourseMikroOrmRepo extends BaseDomainObjectRepo CourseEntityMapper.mapEntityToDo(entity)); @@ -65,7 +65,7 @@ export class CourseMikroOrmRepo extends BaseDomainObjectRepo CourseEntityMapper.mapEntityToDo(entity)); diff --git a/apps/server/src/modules/learnroom/service/board-copy.service.spec.ts b/apps/server/src/modules/learnroom/service/board-copy.service.spec.ts index df74013599..d11b796c8c 100644 --- a/apps/server/src/modules/learnroom/service/board-copy.service.spec.ts +++ b/apps/server/src/modules/learnroom/service/board-copy.service.spec.ts @@ -223,7 +223,7 @@ describe('board copy service', () => { destinationCourse, }); const taskStatus = status.elements?.find( - (el) => el.type === CopyElementType.TASK && el.title === originalTask.name, + (el) => el.type === CopyElementType.TASK && el.title === originalTask.name ); expect(taskStatus).toBeDefined(); }); diff --git a/apps/server/src/modules/learnroom/service/board-copy.service.ts b/apps/server/src/modules/learnroom/service/board-copy.service.ts index a5d95cdbf7..081d343685 100644 --- a/apps/server/src/modules/learnroom/service/board-copy.service.ts +++ b/apps/server/src/modules/learnroom/service/board-copy.service.ts @@ -43,7 +43,7 @@ export class BoardCopyService { private readonly columnBoardService: ColumnBoardService, private readonly copyHelperService: CopyHelperService, // TODO comment this, legacy! - private readonly columnBoardNodeRepo: ColumnBoardNodeRepo, + private readonly columnBoardNodeRepo: ColumnBoardNodeRepo ) {} async copyBoard(params: BoardCopyParams): Promise { @@ -85,7 +85,7 @@ export class BoardCopyService { boardElements: LegacyBoardElement[], user: User, originalCourse: Course, - destinationCourse: Course, + destinationCourse: Course ): Promise { const promises: Promise<[number, CopyStatus]>[] = boardElements.map((element, pos) => { if (element.target === undefined) { @@ -142,7 +142,7 @@ export class BoardCopyService { columnBoard: ColumnBoardNode, user: User, originalCourse: Course, - destinationCourse: Course, + destinationCourse: Course ): Promise { return this.columnBoardService.copyColumnBoard({ originalColumnBoardId: columnBoard.id, @@ -211,7 +211,7 @@ export class BoardCopyService { el.copyEntity = await this.columnBoardService.swapLinkedIds(el.copyEntity?.id, map); } return el; - }), + }) ); copyStatus.elements = updatedElements; diff --git a/apps/server/src/modules/learnroom/service/course-copy.service.spec.ts b/apps/server/src/modules/learnroom/service/course-copy.service.spec.ts index 64e2dcf5cf..d129517cac 100644 --- a/apps/server/src/modules/learnroom/service/course-copy.service.spec.ts +++ b/apps/server/src/modules/learnroom/service/course-copy.service.spec.ts @@ -191,7 +191,7 @@ describe('course copy service', () => { await service.copyCourse({ userId: user.id, courseId: course.id }); const expectedDestinationCourse = expect.objectContaining({ name: courseCopyName }) as Course; expect(boardCopyService.copyBoard).toBeCalledWith( - expect.objectContaining({ originalBoard, destinationCourse: expectedDestinationCourse, user }), + expect.objectContaining({ originalBoard, destinationCourse: expectedDestinationCourse, user }) ); }); @@ -203,7 +203,7 @@ describe('course copy service', () => { title: courseCopyName, type: CopyElementType.COURSE, status: CopyStatusEnum.SUCCESS, - }), + }) ); }); @@ -364,12 +364,12 @@ describe('course copy service', () => { expect(contextExternalToolService.copyContextExternalTool).toHaveBeenCalledWith( tools[0], courseCopy.id, - tools[0].schoolToolRef.schoolId, + tools[0].schoolToolRef.schoolId ); expect(contextExternalToolService.copyContextExternalTool).toHaveBeenCalledWith( tools[1], courseCopy.id, - tools[0].schoolToolRef.schoolId, + tools[0].schoolToolRef.schoolId ); }); @@ -378,7 +378,7 @@ describe('course copy service', () => { const { course, user } = setup(); const status = await service.copyCourse({ userId: user.id, courseId: course.id }); const courseToolCopyStatus: CopyStatus | undefined = status.elements?.find( - (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL, + (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL ); expect(courseToolCopyStatus).not.toBeUndefined(); @@ -392,7 +392,7 @@ describe('course copy service', () => { const copyRejectData = copyContextExternalToolRejectDataFactory.build(); const mockWithCorrectType = Object.create( - CopyContextExternalToolRejectData.prototype, + CopyContextExternalToolRejectData.prototype ) as CopyContextExternalToolRejectData; Object.assign(mockWithCorrectType, { ...copyRejectData }); @@ -408,7 +408,7 @@ describe('course copy service', () => { const { course, user } = setupPartialCopySuccessTools(); const status = await service.copyCourse({ userId: user.id, courseId: course.id }); const courseToolCopyStatus: CopyStatus | undefined = status.elements?.find( - (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL, + (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL ); expect(courseToolCopyStatus).not.toBeUndefined(); @@ -422,7 +422,7 @@ describe('course copy service', () => { const copyRejectData = copyContextExternalToolRejectDataFactory.build(); const mockWithCorrectType = Object.create( - CopyContextExternalToolRejectData.prototype, + CopyContextExternalToolRejectData.prototype ) as CopyContextExternalToolRejectData; Object.assign(mockWithCorrectType, { ...copyRejectData }); @@ -438,7 +438,7 @@ describe('course copy service', () => { const { course, user } = setupAllCopyFailedTools(); const status = await service.copyCourse({ userId: user.id, courseId: course.id }); const courseToolCopyStatus: CopyStatus | undefined = status.elements?.find( - (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL, + (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL ); expect(courseToolCopyStatus).not.toBeUndefined(); @@ -462,7 +462,7 @@ describe('course copy service', () => { const status = await service.copyCourse({ userId: user.id, courseId: course.id }); const courseToolCopyStatus: CopyStatus | undefined = status.elements?.find( - (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL, + (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL ); expect(courseToolCopyStatus).toBeUndefined(); @@ -525,7 +525,7 @@ describe('course copy service', () => { const status = await service.copyCourse({ userId: user.id, courseId: course.id }); const courseToolCopyStatus: CopyStatus | undefined = status.elements?.find( - (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL, + (copyStatus: CopyStatus) => copyStatus.type === CopyElementType.EXTERNAL_TOOL ); expect(courseToolCopyStatus).toBeUndefined(); diff --git a/apps/server/src/modules/learnroom/service/course-copy.service.ts b/apps/server/src/modules/learnroom/service/course-copy.service.ts index 451fedbc8c..f3465bf6f3 100644 --- a/apps/server/src/modules/learnroom/service/course-copy.service.ts +++ b/apps/server/src/modules/learnroom/service/course-copy.service.ts @@ -33,7 +33,7 @@ export class CourseCopyService { private readonly boardCopyService: BoardCopyService, private readonly copyHelperService: CopyHelperService, private readonly userRepo: UserRepo, - private readonly contextExternalToolService: ContextExternalToolService, + private readonly contextExternalToolService: ContextExternalToolService ) {} async copyCourse({ @@ -73,8 +73,8 @@ export class CourseCopyService { await this.contextExternalToolService.copyContextExternalTool(tool, courseCopy.id, user.school.id); return copiedResult; - }, - ), + } + ) ); courseToolsCopyStatus = this.deriveCourseToolCopyStatus(copyCourseToolsResult); @@ -92,7 +92,7 @@ export class CourseCopyService { originalCourse, finishedCourseCopy, boardStatus, - courseToolsCopyStatus, + courseToolsCopyStatus ); return courseStatus; @@ -124,7 +124,7 @@ export class CourseCopyService { originalCourse: Course, courseCopy: Course, boardStatus: CopyStatus, - courseToolsCopyStatus: CopyStatus | null, + courseToolsCopyStatus: CopyStatus | null ): CopyStatus { const elements = [ { @@ -170,14 +170,14 @@ export class CourseCopyService { } private deriveCourseToolCopyStatus( - copyCourseToolsResult: (ContextExternalTool | CopyContextExternalToolRejectData)[], + copyCourseToolsResult: (ContextExternalTool | CopyContextExternalToolRejectData)[] ): CopyStatus | null { if (!copyCourseToolsResult.length) { return null; } const rejectedCopies: CopyContextExternalToolRejectData[] = copyCourseToolsResult.filter( - (result) => result instanceof CopyContextExternalToolRejectData, + (result) => result instanceof CopyContextExternalToolRejectData ); let status: CopyStatusEnum; diff --git a/apps/server/src/modules/learnroom/service/course-rooms.service.ts b/apps/server/src/modules/learnroom/service/course-rooms.service.ts index 7ad19c40f0..a7e06c37b5 100644 --- a/apps/server/src/modules/learnroom/service/course-rooms.service.ts +++ b/apps/server/src/modules/learnroom/service/course-rooms.service.ts @@ -16,7 +16,7 @@ export class CourseRoomsService { private readonly taskService: TaskService, private readonly lessonService: LessonService, private readonly boardRepo: LegacyBoardRepo, - private readonly columnBoardNodeRepo: ColumnBoardNodeRepo, + private readonly columnBoardNodeRepo: ColumnBoardNodeRepo ) {} async updateLegacyBoard(board: LegacyBoard, roomId: EntityId, userId: EntityId): Promise { diff --git a/apps/server/src/modules/learnroom/service/course.service.ts b/apps/server/src/modules/learnroom/service/course.service.ts index 40044a97f1..569b3f7fac 100644 --- a/apps/server/src/modules/learnroom/service/course.service.ts +++ b/apps/server/src/modules/learnroom/service/course.service.ts @@ -25,7 +25,7 @@ export class CourseService implements DeletionService, IEventHandler { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(userSpy).toHaveBeenCalledWith(user.id); }); @@ -258,7 +258,7 @@ describe('rooms usecase', () => { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(roomSpy).toHaveBeenCalledWith(room.id, user.id); }); @@ -269,7 +269,7 @@ describe('rooms usecase', () => { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(boardSpy).toHaveBeenCalledWith(room.id); }); @@ -280,7 +280,7 @@ describe('rooms usecase', () => { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(reorderSpy).toHaveBeenCalledWith(tasks.map((task) => task.id)); }); @@ -291,7 +291,7 @@ describe('rooms usecase', () => { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(saveSpy).toHaveBeenCalledWith(board); }); @@ -302,7 +302,7 @@ describe('rooms usecase', () => { await uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); expect(authorisationSpy).toHaveBeenCalledWith(user, room); }); @@ -314,7 +314,7 @@ describe('rooms usecase', () => { uc.reorderBoardElements( room.id, user.id, - tasks.map((task) => task.id), + tasks.map((task) => task.id) ); await expect(call).rejects.toThrow(ForbiddenException); }); diff --git a/apps/server/src/modules/learnroom/uc/course-rooms.uc.ts b/apps/server/src/modules/learnroom/uc/course-rooms.uc.ts index 6ecc47f5e4..1fb3ce5c4f 100644 --- a/apps/server/src/modules/learnroom/uc/course-rooms.uc.ts +++ b/apps/server/src/modules/learnroom/uc/course-rooms.uc.ts @@ -16,7 +16,7 @@ export class CourseRoomsUc { private readonly legacyBoardRepo: LegacyBoardRepo, private readonly factory: RoomBoardDTOFactory, private readonly authorisationService: CourseRoomsAuthorisationService, - private readonly roomsService: CourseRoomsService, + private readonly roomsService: CourseRoomsService ) {} async getBoard(roomId: EntityId, userId: EntityId): Promise { @@ -36,7 +36,7 @@ export class CourseRoomsUc { roomId: EntityId, elementId: EntityId, userId: EntityId, - visibility: boolean, + visibility: boolean ): Promise { const user = await this.userRepo.findById(userId); const course = await this.courseRepo.findOne(roomId, userId); diff --git a/apps/server/src/modules/learnroom/uc/course.uc.ts b/apps/server/src/modules/learnroom/uc/course.uc.ts index 0373b67ab5..baad3103bf 100644 --- a/apps/server/src/modules/learnroom/uc/course.uc.ts +++ b/apps/server/src/modules/learnroom/uc/course.uc.ts @@ -16,7 +16,7 @@ export class CourseUc { private readonly courseRepo: CourseRepo, private readonly courseService: CourseService, private readonly authService: AuthorizationService, - private readonly roleService: RoleService, + private readonly roleService: RoleService ) {} public findAllByUser(userId: EntityId, options?: PaginationParams): Promise> { diff --git a/apps/server/src/modules/learnroom/uc/dashboard.uc.spec.ts b/apps/server/src/modules/learnroom/uc/dashboard.uc.spec.ts index cdccb3f9aa..5cf3f8613f 100644 --- a/apps/server/src/modules/learnroom/uc/dashboard.uc.spec.ts +++ b/apps/server/src/modules/learnroom/uc/dashboard.uc.spec.ts @@ -8,6 +8,7 @@ import { CourseRepo } from '@shared/repo/course'; import { IDashboardRepo } from '@shared/repo/dashboard'; import { setupEntities } from '@testing/setup-entities'; import { DashboardUc } from './dashboard.uc'; + const learnroomMock = (id: string, name: string) => { return { getMetadata(): LearnroomMetadata { @@ -78,7 +79,7 @@ describe('dashboard uc', () => { const dashboardRepoSpy = jest .spyOn(repo, 'getUsersDashboard') .mockImplementation(() => Promise.resolve(dashboard)); - const courses = new Array(5).map(() => ({}) as Course); + const courses = new Array(5).map(() => ({} as Course)); const courseRepoSpy = jest .spyOn(courseRepo, 'findAllByUserId') .mockImplementation(() => Promise.resolve([courses, 5])); @@ -92,7 +93,7 @@ describe('dashboard uc', () => { expect(courseRepoSpy).toHaveBeenCalledWith( userId, { onlyActiveCourses: true }, - { order: { name: SortOrder.asc } }, + { order: { name: SortOrder.asc } } ); expect(syncSpy).toHaveBeenCalledWith(courses); expect(persistSpy).toHaveBeenCalledWith(result); @@ -130,7 +131,7 @@ describe('dashboard uc', () => { }, ], userId: 'userId', - }), + }) ); throw new Error('not found'); }); @@ -150,8 +151,8 @@ describe('dashboard uc', () => { }, ], userId: 'differentId', - }), - ), + }) + ) ); const callFut = () => service.moveElementOnDashboard('dashboardId', { x: 1, y: 2 }, { x: 2, y: 1 }, 'userId'); @@ -197,7 +198,7 @@ describe('dashboard uc', () => { }, ], userId: 'userId', - }), + }) ); throw new Error('not found'); }); @@ -220,8 +221,8 @@ describe('dashboard uc', () => { }, ], userId: 'differentUserId', - }), - ), + }) + ) ); const callFut = () => service.renameGroupOnDashboard('dashboardId', { x: 3, y: 4 }, 'groupTitle', 'userId'); diff --git a/apps/server/src/modules/learnroom/uc/dashboard.uc.ts b/apps/server/src/modules/learnroom/uc/dashboard.uc.ts index 6cd8b894d8..f68421b62b 100644 --- a/apps/server/src/modules/learnroom/uc/dashboard.uc.ts +++ b/apps/server/src/modules/learnroom/uc/dashboard.uc.ts @@ -10,7 +10,7 @@ import { IDashboardRepo } from '@shared/repo/dashboard'; export class DashboardUc { constructor( @Inject('DASHBOARD_REPO') private readonly dashboardRepo: IDashboardRepo, - private readonly courseRepo: CourseRepo, + private readonly courseRepo: CourseRepo ) {} async getUsersDashboard(userId: EntityId): Promise { @@ -18,7 +18,7 @@ export class DashboardUc { const [courses] = await this.courseRepo.findAllByUserId( userId, { onlyActiveCourses: true }, - { order: { name: SortOrder.asc } }, + { order: { name: SortOrder.asc } } ); dashboard.setLearnRooms(courses); @@ -30,7 +30,7 @@ export class DashboardUc { dashboardId: EntityId, from: GridPositionWithGroupIndex, to: GridPositionWithGroupIndex, - userId: EntityId, + userId: EntityId ): Promise { const dashboard = await this.dashboardRepo.getDashboardById(dashboardId); this.validateUsersMatch(dashboard, userId); @@ -45,7 +45,7 @@ export class DashboardUc { dashboardId: EntityId, position: GridPosition, params: string, - userId: EntityId, + userId: EntityId ): Promise { const dashboard = await this.dashboardRepo.getDashboardById(dashboardId); this.validateUsersMatch(dashboard, userId); diff --git a/apps/server/src/modules/learnroom/uc/lesson-copy.uc.spec.ts b/apps/server/src/modules/learnroom/uc/lesson-copy.uc.spec.ts index bfddea1aeb..2698c75aba 100644 --- a/apps/server/src/modules/learnroom/uc/lesson-copy.uc.spec.ts +++ b/apps/server/src/modules/learnroom/uc/lesson-copy.uc.spec.ts @@ -101,7 +101,7 @@ describe('lesson copy uc', () => { const { userId, lessonId, parentParams } = setup(); await expect(uc.copyLesson(userId, lessonId, parentParams)).rejects.toThrowError( - new InternalServerErrorException('Copy Feature not enabled'), + new InternalServerErrorException('Copy Feature not enabled') ); }); }); @@ -315,7 +315,7 @@ describe('lesson copy uc', () => { const { parentParams, userId, lessonId } = setup(); await expect(uc.copyLesson(userId, lessonId, parentParams)).rejects.toThrowError( - new ForbiddenException('could not find lesson to copy'), + new ForbiddenException('could not find lesson to copy') ); }); }); diff --git a/apps/server/src/modules/learnroom/uc/lesson-copy.uc.ts b/apps/server/src/modules/learnroom/uc/lesson-copy.uc.ts index d7c84ed341..6a24215337 100644 --- a/apps/server/src/modules/learnroom/uc/lesson-copy.uc.ts +++ b/apps/server/src/modules/learnroom/uc/lesson-copy.uc.ts @@ -15,7 +15,7 @@ export class LessonCopyUC { private readonly lessonCopyService: LessonCopyService, private readonly lessonService: LessonService, private readonly courseRepo: CourseRepo, - private readonly copyHelperService: CopyHelperService, + private readonly copyHelperService: CopyHelperService ) {} async copyLesson(userId: EntityId, lessonId: EntityId, parentParams: LessonCopyParentParams): Promise { diff --git a/apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts b/apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts index e31f9d616f..23de424289 100644 --- a/apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts +++ b/apps/server/src/modules/legacy-school/service/legacy-school.service.spec.ts @@ -176,7 +176,7 @@ describe('LegacySchoolService', () => { expect(schoolRepo.save).toHaveBeenCalledWith( expect.objectContaining({ features: [SchoolFeature.VIDEOCONFERENCE], - }), + }) ); }); }); @@ -216,7 +216,7 @@ describe('LegacySchoolService', () => { const schoolDO: LegacySchoolDo | null = await schoolService.getSchoolByExternalId( schoolSavedExternalId, - systems[0], + systems[0] ); expect(schoolDO).toBeInstanceOf(LegacySchoolDo); @@ -439,7 +439,7 @@ describe('LegacySchoolService', () => { const { name, federalStateName } = setup(); await expect(schoolService.createSchool({ name, federalStateName })).rejects.toThrowError( - 'No storage providers found', + 'No storage providers found' ); }); }); diff --git a/apps/server/src/modules/legacy-school/service/legacy-school.service.ts b/apps/server/src/modules/legacy-school/service/legacy-school.service.ts index 186fe2b4a9..c779bcba98 100644 --- a/apps/server/src/modules/legacy-school/service/legacy-school.service.ts +++ b/apps/server/src/modules/legacy-school/service/legacy-school.service.ts @@ -18,7 +18,7 @@ export class LegacySchoolService { private readonly schoolValidationService: SchoolValidationService, private readonly federalStateService: FederalStateService, private readonly schoolYearService: SchoolYearService, - private readonly storageProviderRepo: StorageProviderRepo, + private readonly storageProviderRepo: StorageProviderRepo ) {} async hasFeature(schoolId: EntityId, feature: SchoolFeature): Promise { diff --git a/apps/server/src/modules/lesson/repository/lesson.repo.ts b/apps/server/src/modules/lesson/repository/lesson.repo.ts index b3fd63d9c3..dedfb5ed80 100644 --- a/apps/server/src/modules/lesson/repository/lesson.repo.ts +++ b/apps/server/src/modules/lesson/repository/lesson.repo.ts @@ -57,7 +57,7 @@ export class LessonRepo extends BaseRepo { const rawLessonsDocuments = await this._em.aggregate(LessonEntity, pipeline); const lessons = rawLessonsDocuments.map((rawLessonDocument) => - this._em.map(LessonEntity, rawLessonDocument as EntityDictionary), + this._em.map(LessonEntity, rawLessonDocument as EntityDictionary) ); return lessons; diff --git a/apps/server/src/modules/news/controller/dto/news.response.ts b/apps/server/src/modules/news/controller/dto/news.response.ts index ba5ab5da98..e7b1c7b5f2 100644 --- a/apps/server/src/modules/news/controller/dto/news.response.ts +++ b/apps/server/src/modules/news/controller/dto/news.response.ts @@ -8,7 +8,7 @@ import { UserInfoResponse } from './user-info.response'; const NEWS_SOURCES = ['internal', 'rss'] as const; const TARGET_MODEL_VALUES = Object.values(NewsTargetModel); -type SourceType = (typeof NEWS_SOURCES)[number]; +type SourceType = typeof NEWS_SOURCES[number]; export class NewsResponse { constructor({ id, diff --git a/apps/server/src/modules/news/controller/news.controller.ts b/apps/server/src/modules/news/controller/news.controller.ts index 5826967eeb..882c47e794 100644 --- a/apps/server/src/modules/news/controller/news.controller.ts +++ b/apps/server/src/modules/news/controller/news.controller.ts @@ -27,7 +27,7 @@ export class NewsController { const news = await this.newsUc.create( currentUser.userId, currentUser.schoolId, - NewsMapper.mapCreateNewsToDomain(params), + NewsMapper.mapCreateNewsToDomain(params) ); const dto = NewsMapper.mapToResponse(news); return dto; @@ -40,12 +40,12 @@ export class NewsController { async findAll( @CurrentUser() currentUser: ICurrentUser, @Query() scope: FilterNewsParams, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { const [newsList, count] = await this.newsUc.findAllForUser( currentUser.userId, NewsMapper.mapNewsScopeToDomain(scope), - { pagination }, + { pagination } ); const dtoList = newsList.map((news) => NewsMapper.mapToResponse(news)); const response = new NewsListResponse(dtoList, count); @@ -71,12 +71,12 @@ export class NewsController { async update( @Param() urlParams: NewsUrlParams, @CurrentUser() currentUser: ICurrentUser, - @Body() params: UpdateNewsParams, + @Body() params: UpdateNewsParams ): Promise { const news = await this.newsUc.update( urlParams.newsId, currentUser.userId, - NewsMapper.mapUpdateNewsToDomain(params), + NewsMapper.mapUpdateNewsToDomain(params) ); const dto = NewsMapper.mapToResponse(news); return dto; diff --git a/apps/server/src/modules/news/controller/team-news.controller.ts b/apps/server/src/modules/news/controller/team-news.controller.ts index 22f1eaa8ef..127653797c 100644 --- a/apps/server/src/modules/news/controller/team-news.controller.ts +++ b/apps/server/src/modules/news/controller/team-news.controller.ts @@ -20,7 +20,7 @@ export class TeamNewsController { @Param() urlParams: TeamUrlParams, @CurrentUser() currentUser: ICurrentUser, @Query() scope: FilterNewsParams, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { // enforce filter by a given team, used in team tab scope.targetId = urlParams.teamId; @@ -28,7 +28,7 @@ export class TeamNewsController { const [newsList, count] = await this.newsUc.findAllForUser( currentUser.userId, NewsMapper.mapNewsScopeToDomain(scope), - { pagination }, + { pagination } ); const dtoList = newsList.map((news) => NewsMapper.mapToResponse(news)); const response = new NewsListResponse(dtoList, count); diff --git a/apps/server/src/modules/news/loggable/news-crud-operation.loggable.ts b/apps/server/src/modules/news/loggable/news-crud-operation.loggable.ts index ba8b9a12ae..60c2182d2f 100644 --- a/apps/server/src/modules/news/loggable/news-crud-operation.loggable.ts +++ b/apps/server/src/modules/news/loggable/news-crud-operation.loggable.ts @@ -8,7 +8,7 @@ export class NewsCrudOperationLoggable implements Loggable { constructor( private readonly operation: CrudOperation, private readonly userId: EntityId, - private readonly news: News, + private readonly news: News ) {} getLogMessage(): LogMessage { diff --git a/apps/server/src/modules/news/service/news.service.ts b/apps/server/src/modules/news/service/news.service.ts index b442740c9a..fc09c675e8 100644 --- a/apps/server/src/modules/news/service/news.service.ts +++ b/apps/server/src/modules/news/service/news.service.ts @@ -25,7 +25,7 @@ export class NewsService implements DeletionService, IEventHandler, + options?: IFindOptions ): Promise> { const unpublished = !!scope?.unpublished; // default is only published news const permissions: [NewsPermission] = NewsUc.getRequiredPermissions(unpublished); @@ -76,7 +76,7 @@ export class NewsUc { await Promise.all( newsList.map(async (news: News) => { news.permissions = await this.getNewsPermissions(userId, news); - }), + }) ); return [newsList, newsCount]; @@ -96,7 +96,7 @@ export class NewsUc { userId, news.targetModel, news.target.id, - requiredPermissions, + requiredPermissions ); news.permissions = await this.getNewsPermissions(userId, news); @@ -171,7 +171,7 @@ export class NewsUc { private async getTargetFilters( userId: EntityId, targetModels: NewsTargetModel[], - permissions: string[], + permissions: string[] ): Promise { const targets = await Promise.all( targetModels.map(async (targetModel) => { @@ -179,7 +179,7 @@ export class NewsUc { targetModel, targetIds: await this.authorizationService.getPermittedEntities(userId, targetModel, permissions), }; - }), + }) ); const nonEmptyTargets = targets.filter((target) => target.targetIds.length > 0); diff --git a/apps/server/src/modules/oauth-provider/domain/service/id-token.service.ts b/apps/server/src/modules/oauth-provider/domain/service/id-token.service.ts index b7a49d3275..74323b86e6 100644 --- a/apps/server/src/modules/oauth-provider/domain/service/id-token.service.ts +++ b/apps/server/src/modules/oauth-provider/domain/service/id-token.service.ts @@ -15,7 +15,7 @@ export class IdTokenService { private readonly oauthProviderLoginFlowService: OauthProviderLoginFlowService, private readonly pseudonymService: PseudonymService, private readonly teamsRepo: TeamsRepo, - private readonly userService: UserService, + private readonly userService: UserService ) {} async createIdToken(userId: string, scopes: string[], clientId: string): Promise { diff --git a/apps/server/src/modules/oauth/loggable/id-token-extraction-failure-loggable-exception.ts b/apps/server/src/modules/oauth/loggable/id-token-extraction-failure-loggable-exception.ts index 5a67c47888..199c9171be 100644 --- a/apps/server/src/modules/oauth/loggable/id-token-extraction-failure-loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/id-token-extraction-failure-loggable-exception.ts @@ -10,7 +10,7 @@ export class IdTokenExtractionFailureLoggableException extends BusinessError imp title: 'Id token extraction failure', defaultMessage: 'Failed to extract field', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/oauth/loggable/id-token-user-not-found-loggable-exception.ts b/apps/server/src/modules/oauth/loggable/id-token-user-not-found-loggable-exception.ts index d42f286e26..e336a45b1d 100644 --- a/apps/server/src/modules/oauth/loggable/id-token-user-not-found-loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/id-token-user-not-found-loggable-exception.ts @@ -3,17 +3,14 @@ import { BusinessError } from '@shared/common/error'; import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; export class IdTokenUserNotFoundLoggableException extends BusinessError implements Loggable { - constructor( - private readonly uuid: string, - private readonly additionalInfo?: string, - ) { + constructor(private readonly uuid: string, private readonly additionalInfo?: string) { super( { type: 'USER_NOT_FOUND', title: 'User not found', defaultMessage: 'Failed to find user with uuid from id token.', }, - HttpStatus.NOT_FOUND, + HttpStatus.NOT_FOUND ); } diff --git a/apps/server/src/modules/oauth/loggable/multiple-users-found.loggable-exception.ts b/apps/server/src/modules/oauth/loggable/multiple-users-found.loggable-exception.ts index bc95cc03f5..1333b12b86 100644 --- a/apps/server/src/modules/oauth/loggable/multiple-users-found.loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/multiple-users-found.loggable-exception.ts @@ -10,7 +10,7 @@ export class MultipleUsersFoundLoggableException extends BusinessError implement title: 'Multiple users found', defaultMessage: 'Multiple users found with this externalId', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/oauth/loggable/oauth-config-missing-loggable-exception.ts b/apps/server/src/modules/oauth/loggable/oauth-config-missing-loggable-exception.ts index 55def7d781..6646e2a12b 100644 --- a/apps/server/src/modules/oauth/loggable/oauth-config-missing-loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/oauth-config-missing-loggable-exception.ts @@ -10,7 +10,7 @@ export class OauthConfigMissingLoggableException extends BusinessError implement title: 'Oauth config missing', defaultMessage: 'Requested system has no oauth configured', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/oauth/loggable/token-invalid-loggable-exception.ts b/apps/server/src/modules/oauth/loggable/token-invalid-loggable-exception.ts index 905ce758f9..23ebc89848 100644 --- a/apps/server/src/modules/oauth/loggable/token-invalid-loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/token-invalid-loggable-exception.ts @@ -10,7 +10,7 @@ export class TokenInvalidLoggableException extends BusinessError implements Logg title: 'token invalid', defaultMessage: 'Failed to validate token', }, - HttpStatus.UNAUTHORIZED, + HttpStatus.UNAUTHORIZED ); } diff --git a/apps/server/src/modules/oauth/loggable/user-not-found-after-provisioning.loggable-exception.ts b/apps/server/src/modules/oauth/loggable/user-not-found-after-provisioning.loggable-exception.ts index 953cafc5ee..8cc1b509a6 100644 --- a/apps/server/src/modules/oauth/loggable/user-not-found-after-provisioning.loggable-exception.ts +++ b/apps/server/src/modules/oauth/loggable/user-not-found-after-provisioning.loggable-exception.ts @@ -7,7 +7,7 @@ export class UserNotFoundAfterProvisioningLoggableException extends BusinessErro constructor( private readonly externalUserId: string, private readonly systemId: EntityId, - private readonly officialSchoolNumber?: string, + private readonly officialSchoolNumber?: string ) { super( { @@ -16,7 +16,7 @@ export class UserNotFoundAfterProvisioningLoggableException extends BusinessErro defaultMessage: 'Unable to find user after provisioning. The feature for OAuth2 provisioning might be disabled for this school.', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/oauth/service/hydra.service.spec.ts b/apps/server/src/modules/oauth/service/hydra.service.spec.ts index 752ad0716a..d19e8a143e 100644 --- a/apps/server/src/modules/oauth/service/hydra.service.spec.ts +++ b/apps/server/src/modules/oauth/service/hydra.service.spec.ts @@ -120,7 +120,7 @@ describe('HydraService', () => { // Assert expect(httpService.get).toHaveBeenCalledWith( `http://hydra.mock/oauth2/auth?response_type=code&scope=openid%20uuid&client_id=12345&redirect_uri=localhost%2Fapi%2Fv3%2Fsso%2Fhydra%2F12345&state=mockNanoId`, - {}, + {} ); expect(result.data).toEqual(responseData); }); @@ -167,7 +167,7 @@ describe('HydraService', () => { // Assert expect(httpService.get).toHaveBeenCalledWith( `${apiHost}${axiosResponse1.headers.location as string}`, - axiosConfig, + axiosConfig ); expect(resDto.response.data).toEqual(expectedAuthParams); }); diff --git a/apps/server/src/modules/oauth/service/hydra.service.ts b/apps/server/src/modules/oauth/service/hydra.service.ts index 61b76407ae..6cc58df1b3 100644 --- a/apps/server/src/modules/oauth/service/hydra.service.ts +++ b/apps/server/src/modules/oauth/service/hydra.service.ts @@ -24,7 +24,7 @@ export class HydraSsoService { private readonly ltiRepo: LtiToolRepo, private readonly httpService: HttpService, @Inject(DefaultEncryptionService) private readonly oAuthEncryptionService: EncryptionService, - private readonly logger: LegacyLogger, + private readonly logger: LegacyLogger ) {} private readonly HOST: string = Configuration.get('HOST') as string; diff --git a/apps/server/src/modules/provisioning/loggable/bad-data.loggable-exception.ts b/apps/server/src/modules/provisioning/loggable/bad-data.loggable-exception.ts index 712d86839f..d08f3324dc 100644 --- a/apps/server/src/modules/provisioning/loggable/bad-data.loggable-exception.ts +++ b/apps/server/src/modules/provisioning/loggable/bad-data.loggable-exception.ts @@ -11,7 +11,7 @@ export class BadDataLoggableException extends BusinessError implements Loggable defaultMessage: message || 'Request data is invalid and cannot be processed', }, HttpStatus.BAD_REQUEST, - details, + details ); } diff --git a/apps/server/src/modules/provisioning/loggable/school-missing.loggable-exception.ts b/apps/server/src/modules/provisioning/loggable/school-missing.loggable-exception.ts index 13ab7e2ad1..4a44f14dca 100644 --- a/apps/server/src/modules/provisioning/loggable/school-missing.loggable-exception.ts +++ b/apps/server/src/modules/provisioning/loggable/school-missing.loggable-exception.ts @@ -11,7 +11,7 @@ export class SchoolMissingLoggableException extends BusinessError implements Log title: 'Invalid school data', defaultMessage: 'Unable to create new external user without a school', }, - HttpStatus.UNPROCESSABLE_ENTITY, + HttpStatus.UNPROCESSABLE_ENTITY ); } diff --git a/apps/server/src/modules/provisioning/loggable/school-name-required-loggable-exception.ts b/apps/server/src/modules/provisioning/loggable/school-name-required-loggable-exception.ts index 0d84fd3854..8f252c8247 100644 --- a/apps/server/src/modules/provisioning/loggable/school-name-required-loggable-exception.ts +++ b/apps/server/src/modules/provisioning/loggable/school-name-required-loggable-exception.ts @@ -10,7 +10,7 @@ export class SchoolNameRequiredLoggableException extends BusinessError implement title: 'School name is required', defaultMessage: 'External school name is required', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/provisioning/loggable/user-role-unknown.loggable-exception.ts b/apps/server/src/modules/provisioning/loggable/user-role-unknown.loggable-exception.ts index a780fa3f6a..63bc4296ff 100644 --- a/apps/server/src/modules/provisioning/loggable/user-role-unknown.loggable-exception.ts +++ b/apps/server/src/modules/provisioning/loggable/user-role-unknown.loggable-exception.ts @@ -11,7 +11,7 @@ export class UserRoleUnknownLoggableException extends BusinessError implements L title: 'Invalid user role', defaultMessage: 'External user has no or no known role assigned to them', }, - HttpStatus.UNPROCESSABLE_ENTITY, + HttpStatus.UNPROCESSABLE_ENTITY ); } diff --git a/apps/server/src/modules/pseudonym/loggable/too-many-pseudonyms.loggable-exception.ts b/apps/server/src/modules/pseudonym/loggable/too-many-pseudonyms.loggable-exception.ts index b97f229adc..2fea718755 100644 --- a/apps/server/src/modules/pseudonym/loggable/too-many-pseudonyms.loggable-exception.ts +++ b/apps/server/src/modules/pseudonym/loggable/too-many-pseudonyms.loggable-exception.ts @@ -11,7 +11,7 @@ export class TooManyPseudonymsLoggableException extends BusinessError implements title: 'Too many pseudonyms where found.', defaultMessage: 'Too many pseudonyms where found.', }, - HttpStatus.BAD_REQUEST, + HttpStatus.BAD_REQUEST ); } diff --git a/apps/server/src/modules/room/api/room.controller.ts b/apps/server/src/modules/room/api/room.controller.ts index 25b0fc65e7..319227d9a4 100644 --- a/apps/server/src/modules/room/api/room.controller.ts +++ b/apps/server/src/modules/room/api/room.controller.ts @@ -30,9 +30,9 @@ import { RoomBoardListResponse } from './dto/response/room-board-list.response'; import { RoomDetailsResponse } from './dto/response/room-details.response'; import { RoomItemResponse } from './dto/response/room-item.response'; import { RoomListResponse } from './dto/response/room-list.response'; +import { RoomMemberListResponse } from './dto/response/room-member-list.response'; import { RoomMapper } from './mapper/room.mapper'; import { RoomUc } from './room.uc'; -import { RoomMemberListResponse } from './dto/response/room-member-list.response'; @ApiTags('Room') @JwtAuthentication() @@ -49,7 +49,7 @@ export class RoomController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async getRooms( @CurrentUser() currentUser: ICurrentUser, - @Query() pagination: RoomPaginationParams, + @Query() pagination: RoomPaginationParams ): Promise { const findOptions: IFindOptions = { pagination }; @@ -69,7 +69,7 @@ export class RoomController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async createRoom( @CurrentUser() currentUser: ICurrentUser, - @Body() createRoomParams: CreateRoomBodyParams, + @Body() createRoomParams: CreateRoomBodyParams ): Promise { const room = await this.roomUc.createRoom(currentUser.userId, createRoomParams); @@ -88,7 +88,7 @@ export class RoomController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async getRoomDetails( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: RoomUrlParams, + @Param() urlParams: RoomUrlParams ): Promise { const { room, permissions } = await this.roomUc.getSingleRoom(currentUser.userId, urlParams.roomId); @@ -107,7 +107,7 @@ export class RoomController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async getRoomBoards( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: RoomUrlParams, + @Param() urlParams: RoomUrlParams ): Promise { const boards = await this.roomUc.getRoomBoards(currentUser.userId, urlParams.roomId); @@ -127,7 +127,7 @@ export class RoomController { public async updateRoom( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: RoomUrlParams, - @Body() updateRoomParams: UpdateRoomBodyParams, + @Body() updateRoomParams: UpdateRoomBodyParams ): Promise { const { room, permissions } = await this.roomUc.updateRoom(currentUser.userId, urlParams.roomId, updateRoomParams); @@ -159,7 +159,7 @@ export class RoomController { public async addMembers( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: RoomUrlParams, - @Body() bodyParams: AddRoomMembersBodyParams, + @Body() bodyParams: AddRoomMembersBodyParams ): Promise { await this.roomUc.addMembersToRoom(currentUser.userId, urlParams.roomId, bodyParams.userIds); } @@ -174,7 +174,7 @@ export class RoomController { public async removeMembers( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: RoomUrlParams, - @Body() bodyParams: RemoveRoomMembersBodyParams, + @Body() bodyParams: RemoveRoomMembersBodyParams ): Promise { await this.roomUc.removeMembersFromRoom(currentUser.userId, urlParams.roomId, bodyParams.userIds); } @@ -192,7 +192,7 @@ export class RoomController { @ApiResponse({ status: '5XX', type: ErrorResponse }) public async getMembers( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: RoomUrlParams, + @Param() urlParams: RoomUrlParams ): Promise { const members = await this.roomUc.getRoomMembers(currentUser.userId, urlParams.roomId); const response = new RoomMemberListResponse(members); diff --git a/apps/server/src/modules/room/domain/service/room.service.ts b/apps/server/src/modules/room/domain/service/room.service.ts index 67fc943883..3526f54e59 100644 --- a/apps/server/src/modules/room/domain/service/room.service.ts +++ b/apps/server/src/modules/room/domain/service/room.service.ts @@ -68,7 +68,7 @@ export class RoomService { private validateTimeSpan(props: RoomCreateProps | RoomUpdateProps, roomId: string): void { if (props.startDate != null && props.endDate != null && props.startDate > props.endDate) { throw new ValidationError( - `Invalid room timespan. Start date '${props.startDate.toISOString()}' has to be before end date: '${props.endDate.toISOString()}'. Room id='${roomId}'`, + `Invalid room timespan. Start date '${props.startDate.toISOString()}' has to be before end date: '${props.endDate.toISOString()}'. Room id='${roomId}'` ); } } diff --git a/apps/server/src/modules/school/api/school.controller.ts b/apps/server/src/modules/school/api/school.controller.ts index 019ad8250b..51644e46c1 100644 --- a/apps/server/src/modules/school/api/school.controller.ts +++ b/apps/server/src/modules/school/api/school.controller.ts @@ -18,7 +18,7 @@ export class SchoolController { @JwtAuthentication() public async getSchoolById( @Param() urlParams: SchoolUrlParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const res = await this.schoolUc.getSchoolById(urlParams.schoolId, user.userId); @@ -29,7 +29,7 @@ export class SchoolController { @JwtAuthentication() public async getSchoolListForExternalInvite( @Query() query: SchoolQueryParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const res = await this.schoolUc.getSchoolListForExternalInvite(query, user.schoolId); @@ -59,7 +59,7 @@ export class SchoolController { @Get('/:schoolId/systems') public async getSchoolSystems( @Param() urlParams: SchoolUrlParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const { schoolId } = urlParams; const res = await this.schoolUc.getSchoolSystems(schoolId, user.userId); @@ -77,7 +77,7 @@ export class SchoolController { public async updateSchool( @Param() urlParams: SchoolUrlParams, @Body() body: SchoolUpdateBodyParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const res = await this.schoolUc.updateSchool(user.userId, urlParams.schoolId, body); @@ -88,7 +88,7 @@ export class SchoolController { @JwtAuthentication() public async removeSystemFromSchool( @Param() urlParams: SchoolRemoveSystemUrlParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { await this.schoolUc.removeSystemFromSchool(urlParams.schoolId, urlParams.systemId, user.userId); } @@ -97,7 +97,7 @@ export class SchoolController { @JwtAuthentication() public async getTeachers( @Param() urlParams: SchoolUrlParams, - @CurrentUser() user: ICurrentUser, + @CurrentUser() user: ICurrentUser ): Promise { const res = await this.schoolUc.getSchoolTeachers(urlParams.schoolId, user.userId); return res; diff --git a/apps/server/src/modules/school/domain/service/school.service.ts b/apps/server/src/modules/school/domain/service/school.service.ts index 67753f4208..a4fb57c8f5 100644 --- a/apps/server/src/modules/school/domain/service/school.service.ts +++ b/apps/server/src/modules/school/domain/service/school.service.ts @@ -22,7 +22,7 @@ export class SchoolService { constructor( @Inject(SCHOOL_REPO) private readonly schoolRepo: SchoolRepo, private readonly systemService: SystemService, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) {} public async getSchoolById(schoolId: EntityId): Promise { @@ -50,7 +50,7 @@ export class SchoolService { public async getSchoolsForExternalInvite( query: SchoolQuery, ownSchoolId: EntityId, - options?: IFindOptions, + options?: IFindOptions ): Promise { const schools = await this.getSchools(query, options); @@ -97,7 +97,7 @@ export class SchoolService { const schoolsWithLdapLoginSystems = await this.schoolRepo.getSchoolsBySystemIds(ldapLoginSystemsIds); const schoolsForLdapLogin = schoolsWithLdapLoginSystems.map((school) => - this.mapToSchoolForLdapLogin(school, ldapLoginSystems), + this.mapToSchoolForLdapLogin(school, ldapLoginSystems) ); return schoolsForLdapLogin; @@ -162,7 +162,7 @@ export class SchoolService { private addLdapLoginSystems( schoolProps: SchoolProps, ldapLoginSystems: System[], - schoolForLdapLoginProps: SchoolForLdapLoginProps, + schoolForLdapLoginProps: SchoolForLdapLoginProps ): void { schoolProps.systemIds?.forEach((systemIdInSchool) => { const relatedSystem = ldapLoginSystems.find((system) => system.id === systemIdInSchool); diff --git a/apps/server/src/modules/sharing/controller/share-token.controller.ts b/apps/server/src/modules/sharing/controller/share-token.controller.ts index d601ce32e1..876677a7f7 100644 --- a/apps/server/src/modules/sharing/controller/share-token.controller.ts +++ b/apps/server/src/modules/sharing/controller/share-token.controller.ts @@ -38,7 +38,7 @@ export class ShareTokenController { @Post() public async createShareToken( @CurrentUser() currentUser: ICurrentUser, - @Body() body: ShareTokenBodyParams, + @Body() body: ShareTokenBodyParams ): Promise { const shareToken = await this.shareTokenUC.createShareToken( currentUser.userId, @@ -49,7 +49,7 @@ export class ShareTokenController { { schoolExclusive: body.schoolExclusive, expiresInDays: body.expiresInDays, - }, + } ); const response = ShareTokenResponseMapper.mapToResponse(shareToken); @@ -65,7 +65,7 @@ export class ShareTokenController { @Get(':token') public async lookupShareToken( @CurrentUser() currentUser: ICurrentUser, - @Param() urlParams: ShareTokenUrlParams, + @Param() urlParams: ShareTokenUrlParams ): Promise { const shareTokenInfo = await this.shareTokenUC.lookupShareToken(currentUser.userId, urlParams.token); @@ -85,13 +85,13 @@ export class ShareTokenController { public async importShareToken( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: ShareTokenUrlParams, - @Body() body: ShareTokenImportBodyParams, + @Body() body: ShareTokenImportBodyParams ): Promise { const copyStatus = await this.shareTokenUC.importShareToken( currentUser.userId, urlParams.token, body.newName, - body.destinationId, + body.destinationId ); const response = CopyMapper.mapToResponse(copyStatus); diff --git a/apps/server/src/modules/task/controller/task.controller.ts b/apps/server/src/modules/task/controller/task.controller.ts index 9301ce8461..63532bef43 100644 --- a/apps/server/src/modules/task/controller/task.controller.ts +++ b/apps/server/src/modules/task/controller/task.controller.ts @@ -14,15 +14,12 @@ import { TaskCopyApiParams } from './dto/task-copy.params'; @JwtAuthentication() @Controller('tasks') export class TaskController { - constructor( - private readonly taskUc: TaskUC, - private readonly taskCopyUc: TaskCopyUC, - ) {} + constructor(private readonly taskUc: TaskUC, private readonly taskCopyUc: TaskCopyUC) {} @Get() async findAll( @CurrentUser() currentUser: ICurrentUser, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { return this.findAllTasks(currentUser, pagination); } @@ -30,7 +27,7 @@ export class TaskController { @Get('finished') async findAllFinished( @CurrentUser() currentUser: ICurrentUser, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { return this.findAllTasks(currentUser, pagination, true); } @@ -38,7 +35,7 @@ export class TaskController { private async findAllTasks( @CurrentUser() currentUser: ICurrentUser, @Query() pagination: PaginationParams, - finished = false, + finished = false ): Promise { const [tasksWithStatus, total] = finished ? await this.taskUc.findAllFinished(currentUser.userId, pagination) @@ -72,7 +69,7 @@ export class TaskController { @Patch(':taskId/revertPublished') async revertPublished( @Param() urlParams: TaskUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const task = await this.taskUc.revertPublished(currentUser.userId, urlParams.taskId); @@ -86,12 +83,12 @@ export class TaskController { async copyTask( @CurrentUser() currentUser: ICurrentUser, @Param() urlParams: TaskUrlParams, - @Body() params: TaskCopyApiParams, + @Body() params: TaskCopyApiParams ): Promise { const copyStatus = await this.taskCopyUc.copyTask( currentUser.userId, urlParams.taskId, - CopyMapper.mapTaskCopyToDomain(params, currentUser.userId), + CopyMapper.mapTaskCopyToDomain(params, currentUser.userId) ); const dto = CopyMapper.mapToResponse(copyStatus); return dto; diff --git a/apps/server/src/modules/task/service/submission.service.ts b/apps/server/src/modules/task/service/submission.service.ts index 676ba76343..db5b839d5f 100644 --- a/apps/server/src/modules/task/service/submission.service.ts +++ b/apps/server/src/modules/task/service/submission.service.ts @@ -28,7 +28,7 @@ export class SubmissionService implements DeletionService, IEventHandler { @@ -30,7 +30,7 @@ export class TaskCopyService { const { fileUrlReplacements, fileCopyStatus } = await this.copyFilesService.copyFilesOfEntity( originalTask, taskCopy, - user.id, + user.id ); await this.updateFileUrls(taskCopy, fileUrlReplacements); @@ -43,7 +43,7 @@ export class TaskCopyService { originalTask: Task, user: User, destinationCourse: Course | undefined, - destinationLesson: LessonEntity | undefined, + destinationLesson: LessonEntity | undefined ) { const taskCopy = new Task({ name: params.copyName || originalTask.name, diff --git a/apps/server/src/modules/task/service/task.service.ts b/apps/server/src/modules/task/service/task.service.ts index 6deec50a4b..f71fb1f469 100644 --- a/apps/server/src/modules/task/service/task.service.ts +++ b/apps/server/src/modules/task/service/task.service.ts @@ -31,7 +31,7 @@ export class TaskService implements DeletionService, IEventHandler, + options?: IFindOptions ): Promise> { return this.taskRepo.findBySingleParent(creatorId, courseId, filters, options); } @@ -94,8 +94,8 @@ export class TaskService implements DeletionService, IEventHandler 0) { tasksWithUserInFinished.forEach((task: Task) => task.removeUserFromFinished(userId)); @@ -182,7 +183,7 @@ export class TaskService implements DeletionService, IEventHandler { Configuration.set('FEATURE_COPY_SERVICE_ENABLED', false); await expect(uc.copyTask(user.id, task.id, { courseId: course.id, userId })).rejects.toThrowError( - InternalServerErrorException, + InternalServerErrorException ); }); }); @@ -284,7 +284,7 @@ describe('task copy uc', () => { const { user, task, parentParams } = setupWithTaskForbidden(); await expect(uc.copyTask(user.id, task.id, parentParams)).rejects.toThrowError( - new NotFoundException('could not find task to copy'), + new NotFoundException('could not find task to copy') ); }); }); @@ -389,7 +389,7 @@ describe('task copy uc', () => { const { userId, taskId, parentParams } = setupWithLessonForbidden(); await expect(uc.copyTask(userId, taskId, parentParams)).rejects.toThrowError( - new ForbiddenException('you dont have permission to add to this lesson'), + new ForbiddenException('you dont have permission to add to this lesson') ); }); }); diff --git a/apps/server/src/modules/task/uc/task-copy.uc.ts b/apps/server/src/modules/task/uc/task-copy.uc.ts index 2a4e67fad5..11e034327f 100644 --- a/apps/server/src/modules/task/uc/task-copy.uc.ts +++ b/apps/server/src/modules/task/uc/task-copy.uc.ts @@ -18,7 +18,7 @@ export class TaskCopyUC { private readonly authorisation: AuthorizationService, private readonly taskCopyService: TaskCopyService, private readonly taskRepo: TaskRepo, - private readonly copyHelperService: CopyHelperService, + private readonly copyHelperService: CopyHelperService ) {} async copyTask(userId: EntityId, taskId: EntityId, parentParams: TaskCopyParentParams): Promise { diff --git a/apps/server/src/modules/task/uc/task.uc.spec.ts b/apps/server/src/modules/task/uc/task.uc.spec.ts index f7a2bf2c43..3f253fc1e3 100644 --- a/apps/server/src/modules/task/uc/task.uc.spec.ts +++ b/apps/server/src/modules/task/uc/task.uc.spec.ts @@ -532,7 +532,7 @@ describe('TaskUC', () => { const task2 = taskFactory.build({ course }); const task3 = taskFactory.build({ course }); task2.submissions.add( - submissionFactory.submitted().build({ task: task2, student: user, teamMembers: [user], graded: true }), + submissionFactory.submitted().build({ task: task2, student: user, teamMembers: [user], graded: true }) ); authorizationService.getUserWithPermissions.mockResolvedValueOnce(user); diff --git a/apps/server/src/modules/task/uc/task.uc.ts b/apps/server/src/modules/task/uc/task.uc.ts index e8bd0a7e0f..d1e68f2e00 100644 --- a/apps/server/src/modules/task/uc/task.uc.ts +++ b/apps/server/src/modules/task/uc/task.uc.ts @@ -15,7 +15,7 @@ export class TaskUC { private readonly authorizationService: AuthorizationService, private readonly courseRepo: CourseRepo, private readonly lessonService: LessonService, - private readonly taskService: TaskService, + private readonly taskService: TaskService ) {} async findAllFinished(userId: EntityId, pagination?: Pagination): Promise> { @@ -42,7 +42,7 @@ export class TaskUC { lessonIdsOfOpenCourses, lessonIdsOfFinishedCourses, }, - { pagination, order: { dueDate: SortOrder.desc } }, + { pagination, order: { dueDate: SortOrder.desc } } ); const taskWithStatusVos = tasks.map((task) => { @@ -134,7 +134,7 @@ export class TaskUC { { pagination, order: { dueDate: SortOrder.asc }, - }, + } ); const taskWithStatusVos = tasks.map((task) => { @@ -162,7 +162,7 @@ export class TaskUC { { pagination, order: { dueDate: SortOrder.desc }, - }, + } ); const taskWithStatusVos = tasks.map((task) => { @@ -189,7 +189,7 @@ export class TaskUC { private async getPermittedLessons(user: User, courses: Course[]): Promise { const writeCourses = courses.filter((c) => - this.authorizationService.hasPermission(user, c, AuthorizationContextBuilder.write([])), + this.authorizationService.hasPermission(user, c, AuthorizationContextBuilder.write([])) ); const readCourses = courses.filter((c) => !writeCourses.includes(c)); diff --git a/apps/server/src/modules/teams/service/team-authorisable.service.ts b/apps/server/src/modules/teams/service/team-authorisable.service.ts index fa0e0a33dd..a64a3f95ee 100644 --- a/apps/server/src/modules/teams/service/team-authorisable.service.ts +++ b/apps/server/src/modules/teams/service/team-authorisable.service.ts @@ -9,10 +9,7 @@ import { TeamsRepo } from '@shared/repo/teams'; @Injectable() export class TeamAuthorisableService implements AuthorizationLoaderServiceGeneric { - constructor( - private readonly teamsRepo: TeamsRepo, - injectionService: AuthorizationInjectionService, - ) { + constructor(private readonly teamsRepo: TeamsRepo, injectionService: AuthorizationInjectionService) { injectionService.injectReferenceLoader(AuthorizableReferenceType.Team, this); } diff --git a/apps/server/src/modules/teams/service/team.service.ts b/apps/server/src/modules/teams/service/team.service.ts index c4d3032590..3576235743 100644 --- a/apps/server/src/modules/teams/service/team.service.ts +++ b/apps/server/src/modules/teams/service/team.service.ts @@ -25,7 +25,7 @@ export class TeamService implements DeletionService, IEventHandler { id: contextExternalTool.id, title: displayName, description: 'description', - }), + }) ); }); }); @@ -203,7 +203,7 @@ describe(CommonToolDeleteService.name, () => { id: contextExternalTool.id, title: externalTool.name, description: undefined, - }), + }) ); }); }); @@ -259,7 +259,7 @@ describe(CommonToolDeleteService.name, () => { id: contextExternalTool.id, title: externalTool.name, description: externalTool.description, - }), + }) ); }); }); diff --git a/apps/server/src/modules/tool/common/service/common-tool-delete.service.ts b/apps/server/src/modules/tool/common/service/common-tool-delete.service.ts index 3e7ca14d21..3ce5c4ba62 100644 --- a/apps/server/src/modules/tool/common/service/common-tool-delete.service.ts +++ b/apps/server/src/modules/tool/common/service/common-tool-delete.service.ts @@ -15,14 +15,14 @@ export class CommonToolDeleteService { private readonly externalToolRepo: ExternalToolRepo, private readonly schoolExternalToolRepo: SchoolExternalToolRepo, private readonly contextExternalToolRepo: ContextExternalToolRepo, - private readonly eventBus: EventBus, + private readonly eventBus: EventBus ) {} public async deleteExternalTool(externalTool: ExternalTool): Promise { await this.externalToolRepo.deleteById(externalTool.id); const schoolExternalTools: SchoolExternalTool[] = await this.schoolExternalToolRepo.findByExternalToolId( - externalTool.id, + externalTool.id ); const promises: Promise[] = schoolExternalTools.map(async (schoolExternalTool) => { @@ -40,7 +40,7 @@ export class CommonToolDeleteService { public async deleteContextExternalTool(contextExternalTool: ContextExternalTool): Promise { const schoolExternalTool: SchoolExternalTool = await this.schoolExternalToolRepo.findById( - contextExternalTool.schoolToolRef.schoolToolId, + contextExternalTool.schoolToolRef.schoolToolId ); const externalTool: ExternalTool = await this.externalToolRepo.findById(schoolExternalTool.toolId); @@ -58,7 +58,7 @@ export class CommonToolDeleteService { private async deleteSchoolExternalToolInternal( externalTool: ExternalTool, - schoolExternalTool: SchoolExternalTool, + schoolExternalTool: SchoolExternalTool ): Promise { await this.schoolExternalToolRepo.deleteById(schoolExternalTool.id); @@ -75,7 +75,7 @@ export class CommonToolDeleteService { private async deleteContextExternalToolInternal( externalTool: ExternalTool, - contextExternalTool: ContextExternalTool, + contextExternalTool: ContextExternalTool ): Promise { await this.contextExternalToolRepo.delete(contextExternalTool); @@ -84,7 +84,7 @@ export class CommonToolDeleteService { id: contextExternalTool.id, title: contextExternalTool.displayName ?? externalTool.name, description: externalTool.description, - }), + }) ); } } diff --git a/apps/server/src/modules/tool/common/service/common-tool-metadata.service.spec.ts b/apps/server/src/modules/tool/common/service/common-tool-metadata.service.spec.ts index 0f33962633..91a0d6ec23 100644 --- a/apps/server/src/modules/tool/common/service/common-tool-metadata.service.spec.ts +++ b/apps/server/src/modules/tool/common/service/common-tool-metadata.service.spec.ts @@ -116,7 +116,7 @@ describe(CommonToolMetadataService.name, () => { setup(); const result: SchoolExternalToolMetadata = await service.getMetadataForSchoolExternalTool( - new ObjectId().toHexString(), + new ObjectId().toHexString() ); expect(result).toEqual({ @@ -143,7 +143,7 @@ describe(CommonToolMetadataService.name, () => { setup(); const result: SchoolExternalToolMetadata = await service.getMetadataForSchoolExternalTool( - new ObjectId().toHexString(), + new ObjectId().toHexString() ); expect(result).toEqual({ diff --git a/apps/server/src/modules/tool/common/service/common-tool-metadata.service.ts b/apps/server/src/modules/tool/common/service/common-tool-metadata.service.ts index fb3a3d3a17..e963a72d75 100644 --- a/apps/server/src/modules/tool/common/service/common-tool-metadata.service.ts +++ b/apps/server/src/modules/tool/common/service/common-tool-metadata.service.ts @@ -16,14 +16,14 @@ export class CommonToolMetadataService { private readonly schoolToolRepo: SchoolExternalToolRepo, private readonly contextToolRepo: ContextExternalToolRepo, @Inject(forwardRef(() => BoardCommonToolService)) - private readonly boardCommonToolService: BoardCommonToolService, + private readonly boardCommonToolService: BoardCommonToolService ) {} async getMetadataForExternalTool(toolId: EntityId): Promise { const schoolExternalTools: SchoolExternalTool[] = await this.schoolToolRepo.findByExternalToolId(toolId); const schoolExternalToolIds: string[] = schoolExternalTools.map( - (schoolExternalTool: SchoolExternalTool): string => schoolExternalTool.id, + (schoolExternalTool: SchoolExternalTool): string => schoolExternalTool.id ); const externalToolMetadata: ExternalToolMetadata = await this.getMetadata(schoolExternalToolIds); @@ -62,7 +62,7 @@ export class CommonToolMetadataService { const count: number = await this.countUsageForType(contextExternalTools, type); externalToolMetadata.contextExternalToolCountPerContext[type] = count; - }), + }) ); } @@ -71,14 +71,14 @@ export class CommonToolMetadataService { private async countUsageForType( contextExternalTools: ContextExternalTool[], - contextType: ContextExternalToolType, + contextType: ContextExternalToolType ): Promise { let count = 0; if (contextType === ContextExternalToolType.BOARD_ELEMENT) { count = await this.boardCommonToolService.countBoardUsageForExternalTools(contextExternalTools); } else { const contextIds: EntityId[] = contextExternalTools.map( - (contextExternalTool: ContextExternalTool): EntityId => contextExternalTool.contextRef.id, + (contextExternalTool: ContextExternalTool): EntityId => contextExternalTool.contextRef.id ); count = new Set(contextIds).size; diff --git a/apps/server/src/modules/tool/common/service/validation/common-tool-validation.service.ts b/apps/server/src/modules/tool/common/service/validation/common-tool-validation.service.ts index bdec595418..e079421275 100644 --- a/apps/server/src/modules/tool/common/service/validation/common-tool-validation.service.ts +++ b/apps/server/src/modules/tool/common/service/validation/common-tool-validation.service.ts @@ -27,14 +27,14 @@ export class CommonToolValidationService { const parametersForScope: CustomParameter[] = this.filterParametersForScope( externalTool.parameters, - validatableTool, + validatableTool ); this.arrayValidators.forEach((validator: ParameterArrayValidator) => { const entryErrors: ValidationError[] = validator.validate( validatableTool.parameters, parametersForScope, - validatableTool.id, + validatableTool.id ); errors.push(...entryErrors); @@ -45,12 +45,12 @@ export class CommonToolValidationService { private filterParametersForScope( params: CustomParameter[] | undefined, - validatableTool: ValidatableTool, + validatableTool: ValidatableTool ): CustomParameter[] { const parametersForScope: CustomParameter[] = (params ?? []).filter( (param: CustomParameter) => (validatableTool instanceof SchoolExternalTool && param.scope === CustomParameterScope.SCHOOL) || - (validatableTool instanceof ContextExternalTool && param.scope === CustomParameterScope.CONTEXT), + (validatableTool instanceof ContextExternalTool && param.scope === CustomParameterScope.CONTEXT) ); return parametersForScope; diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-duplicate-key-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-duplicate-key-validator.ts index f736b7b5bc..08b0a9fc08 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-duplicate-key-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-duplicate-key-validator.ts @@ -8,18 +8,18 @@ export class ParameterArrayDuplicateKeyValidator implements ParameterArrayValida validate( entries: CustomParameterEntry[], declarations: CustomParameter[], - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[] { const caseInsensitiveNames: string[] = entries.map(({ name }: CustomParameterEntry) => name.toLowerCase()); const duplicates: string[] = caseInsensitiveNames.filter( - (item, index) => caseInsensitiveNames.indexOf(item) !== index, + (item, index) => caseInsensitiveNames.indexOf(item) !== index ); const uniqueDuplicates: Set = new Set(duplicates); const errors: ValidationError[] = Array.from(uniqueDuplicates).map( - (parameterName: string) => new ToolParameterDuplicateLoggableException(toolId, parameterName), + (parameterName: string) => new ToolParameterDuplicateLoggableException(toolId, parameterName) ); return errors; diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-entry-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-entry-validator.ts index 9e4630d48c..2e67cf6898 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-entry-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-entry-validator.ts @@ -17,13 +17,13 @@ export class ParameterArrayEntryValidator implements ParameterArrayValidator { validate( entries: CustomParameterEntry[], declarations: CustomParameter[], - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[] { const errors: ValidationError[] = []; for (const param of declarations) { const foundEntry: CustomParameterEntry | undefined = entries.find( - ({ name }: CustomParameterEntry): boolean => name === param.name, + ({ name }: CustomParameterEntry): boolean => name === param.name ); if (foundEntry) { diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.spec.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.spec.ts index c8ee3436f9..9ea5718b8b 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.spec.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.spec.ts @@ -28,7 +28,7 @@ describe(ParameterArrayUnknownKeyValidator.name, () => { const result: ValidationError[] = new ParameterArrayUnknownKeyValidator().validate( entries, declarations, - undefined, + undefined ); expect(result).toHaveLength(0); @@ -58,7 +58,7 @@ describe(ParameterArrayUnknownKeyValidator.name, () => { const result: ValidationError[] = new ParameterArrayUnknownKeyValidator().validate( entries, declarations, - undefined, + undefined ); expect(result[0]).toBeInstanceOf(ToolParameterUnknownLoggableException); diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.ts index 124fd71b56..01ae34426c 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-unknown-key-validator.ts @@ -7,13 +7,13 @@ export class ParameterArrayUnknownKeyValidator implements ParameterArrayValidato validate( entries: CustomParameterEntry[], declarations: CustomParameter[], - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[] { const errors: ValidationError[] = []; for (const entry of entries) { const foundParameter: CustomParameter | undefined = declarations.find( - ({ name }: CustomParameter): boolean => name === entry.name, + ({ name }: CustomParameter): boolean => name === entry.name ); if (!foundParameter) { diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-validator.ts index 0753ec6898..f10bf00484 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-array-validator.ts @@ -6,6 +6,6 @@ export interface ParameterArrayValidator { validate( entries: CustomParameterEntry[], declarations: CustomParameter[], - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[]; } diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-regex-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-regex-validator.ts index a0d0f38004..b5a0141514 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-regex-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-regex-validator.ts @@ -7,7 +7,7 @@ export class ParameterEntryRegexValidator implements ParameterEntryValidator { public validate( entry: CustomParameterEntry, declaration: CustomParameter, - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[] { if (entry.value !== undefined && declaration.regex && !new RegExp(declaration.regex).test(entry.value)) { return [new ToolParameterValueRegexLoggableException(toolId, declaration)]; diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-type-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-type-validator.ts index 8afbe26e99..62bd65c193 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-type-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-type-validator.ts @@ -8,7 +8,7 @@ export class ParameterEntryTypeValidator implements ParameterEntryValidator { public validate( entry: CustomParameterEntry, declaration: CustomParameter, - toolId: EntityId | undefined, + toolId: EntityId | undefined ): BusinessError[] { if ( entry.value !== undefined && diff --git a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-value-validator.ts b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-value-validator.ts index 19a5b64b25..7a2495d9f2 100644 --- a/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-value-validator.ts +++ b/apps/server/src/modules/tool/common/service/validation/rules/parameter-entry-value-validator.ts @@ -12,7 +12,7 @@ export class ParameterEntryValueValidator implements ParameterEntryValidator { public validate( entry: CustomParameterEntry, declaration: CustomParameter, - toolId: EntityId | undefined, + toolId: EntityId | undefined ): ValidationError[] { if (entry.value === undefined || entry.value === '') { if (declaration.isOptional) { diff --git a/apps/server/src/modules/tool/context-external-tool/controller/tool-context.controller.ts b/apps/server/src/modules/tool/context-external-tool/controller/tool-context.controller.ts index 533332e03d..5e67000d43 100644 --- a/apps/server/src/modules/tool/context-external-tool/controller/tool-context.controller.ts +++ b/apps/server/src/modules/tool/context-external-tool/controller/tool-context.controller.ts @@ -29,10 +29,7 @@ import { @JwtAuthentication() @Controller('tools/context-external-tools') export class ToolContextController { - constructor( - private readonly contextExternalToolUc: ContextExternalToolUc, - private readonly logger: LegacyLogger, - ) {} + constructor(private readonly contextExternalToolUc: ContextExternalToolUc, private readonly logger: LegacyLogger) {} @Post() @ApiCreatedResponse({ @@ -46,14 +43,14 @@ export class ToolContextController { @ApiOperation({ summary: 'Creates a ContextExternalTool' }) public async createContextExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Body() body: ContextExternalToolPostParams, + @Body() body: ContextExternalToolPostParams ): Promise { const contextExternalTool: ContextExternalToolDto = ContextExternalToolRequestMapper.mapContextExternalToolRequest(body); const createdTool: ContextExternalTool = await this.contextExternalToolUc.createContextExternalTool( currentUser.userId, - contextExternalTool, + contextExternalTool ); const response: ContextExternalToolResponse = @@ -71,12 +68,12 @@ export class ToolContextController { @HttpCode(HttpStatus.NO_CONTENT) public async deleteContextExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: ContextExternalToolIdParams, + @Param() params: ContextExternalToolIdParams ): Promise { await this.contextExternalToolUc.deleteContextExternalTool(currentUser.userId, params.contextExternalToolId); this.logger.debug( - `ContextExternalTool with id ${params.contextExternalToolId} was deleted by user with id ${currentUser.userId}`, + `ContextExternalTool with id ${params.contextExternalToolId} was deleted by user with id ${currentUser.userId}` ); } @@ -90,22 +87,22 @@ export class ToolContextController { @ApiOperation({ summary: 'Returns a list of ContextExternalTools for the given context' }) public async getContextExternalToolsForContext( @CurrentUser() currentUser: ICurrentUser, - @Param() params: ContextExternalToolContextParams, + @Param() params: ContextExternalToolContextParams ): Promise { const contextExternalTools: ContextExternalTool[] = await this.contextExternalToolUc.getContextExternalToolsForContext( currentUser.userId, params.contextType, - params.contextId, + params.contextId ); const mappedTools: ContextExternalToolResponse[] = contextExternalTools.map( (tool: ContextExternalTool): ContextExternalToolResponse => - ContextExternalToolResponseMapper.mapContextExternalToolResponse(tool), + ContextExternalToolResponseMapper.mapContextExternalToolResponse(tool) ); this.logger.debug( - `User with id ${currentUser.userId} fetched ContextExternalTools for contextType: ${params.contextType} and contextId: ${params.contextId}`, + `User with id ${currentUser.userId} fetched ContextExternalTools for contextType: ${params.contextType} and contextId: ${params.contextId}` ); const response: ContextExternalToolSearchListResponse = new ContextExternalToolSearchListResponse(mappedTools); @@ -123,11 +120,11 @@ export class ToolContextController { @ApiOperation({ summary: 'Searches a ContextExternalTool for the given id' }) public async getContextExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: ContextExternalToolIdParams, + @Param() params: ContextExternalToolIdParams ): Promise { const contextExternalTool: ContextExternalTool = await this.contextExternalToolUc.getContextExternalTool( currentUser.userId, - params.contextExternalToolId, + params.contextExternalToolId ); const response: ContextExternalToolResponse = @@ -148,7 +145,7 @@ export class ToolContextController { public async updateContextExternalTool( @CurrentUser() currentUser: ICurrentUser, @Param() params: ContextExternalToolIdParams, - @Body() body: ContextExternalToolPostParams, + @Body() body: ContextExternalToolPostParams ): Promise { const contextExternalTool: ContextExternalToolDto = ContextExternalToolRequestMapper.mapContextExternalToolRequest(body); @@ -157,7 +154,7 @@ export class ToolContextController { currentUser.userId, currentUser.schoolId, params.contextExternalToolId, - contextExternalTool, + contextExternalTool ); const response: ContextExternalToolResponse = diff --git a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.ts b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.ts index d641065252..cedbd8dccd 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-authorizable.service.ts @@ -12,7 +12,7 @@ import { ContextExternalTool } from '../domain'; export class ContextExternalToolAuthorizableService implements AuthorizationLoaderService { constructor( private readonly contextExternalToolRepo: ContextExternalToolRepo, - injectionService: AuthorizationInjectionService, + injectionService: AuthorizationInjectionService ) { injectionService.injectReferenceLoader(AuthorizableReferenceType.ContextExternalToolEntity, this); } diff --git a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-validation.service.ts b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-validation.service.ts index 6dc2b3c2c4..5d57cec63c 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-validation.service.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/context-external-tool-validation.service.ts @@ -12,19 +12,19 @@ export class ContextExternalToolValidationService { constructor( private readonly externalToolService: ExternalToolService, private readonly schoolExternalToolService: SchoolExternalToolService, - private readonly commonToolValidationService: CommonToolValidationService, + private readonly commonToolValidationService: CommonToolValidationService ) {} async validate(contextExternalTool: ContextExternalTool): Promise { const loadedSchoolExternalTool: SchoolExternalTool = await this.schoolExternalToolService.findById( - contextExternalTool.schoolToolRef.schoolToolId, + contextExternalTool.schoolToolRef.schoolToolId ); const loadedExternalTool: ExternalTool = await this.externalToolService.findById(loadedSchoolExternalTool.toolId); const errors: ValidationError[] = this.commonToolValidationService.validateParameters( loadedExternalTool, - contextExternalTool, + contextExternalTool ); if (errors.length) { 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 a510c492b3..ee945cfe84 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 @@ -318,7 +318,7 @@ describe(ContextExternalToolService.name, () => { expect(commonToolService.isContextRestricted).toHaveBeenCalledWith( externalTool, - contextExternalTool.contextRef.type, + contextExternalTool.contextRef.type ); }); @@ -387,7 +387,7 @@ describe(ContextExternalToolService.name, () => { const { contextExternalTool, externalTool } = setup(); await expect(service.checkContextRestrictions(contextExternalTool)).rejects.toThrow( - new RestrictedContextMismatchLoggableException(externalTool.name, contextExternalTool.contextRef.type), + new RestrictedContextMismatchLoggableException(externalTool.name, contextExternalTool.contextRef.type) ); }); }); @@ -456,7 +456,7 @@ describe(ContextExternalToolService.name, () => { let copiedTool: ContextExternalTool | CopyContextExternalToolRejectData = await service.copyContextExternalTool( contextExternalTool, contextCopyId, - schoolExternalTool.schoolId, + schoolExternalTool.schoolId ); expect(copiedTool instanceof ContextExternalTool).toEqual(true); @@ -478,7 +478,7 @@ describe(ContextExternalToolService.name, () => { value: contextExternalTool.parameters[1].value, }, ], - }), + }) ); }); @@ -488,7 +488,7 @@ describe(ContextExternalToolService.name, () => { let copiedTool: ContextExternalTool | CopyContextExternalToolRejectData = await service.copyContextExternalTool( contextExternalTool, contextCopyId, - schoolExternalTool.schoolId, + schoolExternalTool.schoolId ); expect(copiedTool instanceof ContextExternalTool).toEqual(true); @@ -504,7 +504,7 @@ describe(ContextExternalToolService.name, () => { await service.copyContextExternalTool(contextExternalTool, contextCopyId, schoolExternalTool.schoolId); expect(contextExternalToolRepo.save).toHaveBeenCalledWith( - new ContextExternalTool({ ...contextExternalTool.getProps(), id: expect.any(String) }), + new ContextExternalTool({ ...contextExternalTool.getProps(), id: expect.any(String) }) ); }); }); @@ -579,7 +579,7 @@ describe(ContextExternalToolService.name, () => { ...contextExternalTool.getProps(), schoolToolRef: expectedSchoolToolRef, id: expect.any(String), - }), + }) ); }); }); diff --git a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts index dcbf5cf842..304b4bcb28 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.spec.ts @@ -87,7 +87,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -146,7 +146,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -205,7 +205,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -264,7 +264,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -328,7 +328,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -375,7 +375,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -423,7 +423,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -467,7 +467,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -510,7 +510,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ @@ -576,7 +576,7 @@ describe(ToolConfigurationStatusService.name, () => { externalTool, schoolExternalTool, contextExternalTool, - userId, + userId ); expect(status).toEqual({ diff --git a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.ts b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.ts index 0761decac8..0b7f188427 100644 --- a/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.ts +++ b/apps/server/src/modules/tool/context-external-tool/service/tool-configuration-status.service.ts @@ -19,14 +19,14 @@ export class ToolConfigurationStatusService { constructor( private readonly commonToolValidationService: CommonToolValidationService, private readonly mediaUserLicenseService: MediaUserLicenseService, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) {} public async determineToolConfigurationStatus( externalTool: ExternalTool, schoolExternalTool: SchoolExternalTool, contextExternalTool: ContextExternalToolLaunchable, - userId: EntityId, + userId: EntityId ): Promise { const configurationStatus: ContextExternalToolConfigurationStatus = new ContextExternalToolConfigurationStatus({ isOutdatedOnScopeContext: false, @@ -39,7 +39,7 @@ export class ToolConfigurationStatusService { const schoolParameterErrors: ValidationError[] = this.commonToolValidationService.validateParameters( externalTool, - schoolExternalTool, + schoolExternalTool ); if (schoolParameterErrors.length) { @@ -48,7 +48,7 @@ export class ToolConfigurationStatusService { const contextParameterErrors: ValidationError[] = this.commonToolValidationService.validateParameters( externalTool, - contextExternalTool, + contextExternalTool ); if (contextParameterErrors.length) { @@ -56,7 +56,7 @@ export class ToolConfigurationStatusService { if ( contextParameterErrors.some( - (error: ValidationError) => error instanceof ToolParameterMandatoryValueMissingLoggableException, + (error: ValidationError) => error instanceof ToolParameterMandatoryValueMissingLoggableException ) ) { configurationStatus.isIncompleteOnScopeContext = true; @@ -77,8 +77,9 @@ export class ToolConfigurationStatusService { private async isToolLicensed(externalTool: ExternalTool, userId: EntityId): Promise { if (this.configService.get('FEATURE_SCHULCONNEX_MEDIA_LICENSE_ENABLED')) { - const mediaUserLicenses: MediaUserLicense[] = - await this.mediaUserLicenseService.getMediaUserLicensesForUser(userId); + const mediaUserLicenses: MediaUserLicense[] = await this.mediaUserLicenseService.getMediaUserLicensesForUser( + userId + ); const externalToolMedium = externalTool.medium; if (externalToolMedium) { @@ -94,7 +95,7 @@ export class ToolConfigurationStatusService { private isOutdated(contextParameterErrors: ValidationError[]): boolean { const parameterWithoutOptional: ValidationError[] = contextParameterErrors.filter( - (error: ValidationError) => !this.isOptional(error), + (error: ValidationError) => !this.isOptional(error) ); return parameterWithoutOptional.length > 0; diff --git a/apps/server/src/modules/tool/external-tool/controller/tool.controller.ts b/apps/server/src/modules/tool/external-tool/controller/tool.controller.ts index 11b92f7b87..28947fbc29 100644 --- a/apps/server/src/modules/tool/external-tool/controller/tool.controller.ts +++ b/apps/server/src/modules/tool/external-tool/controller/tool.controller.ts @@ -59,7 +59,7 @@ export class ToolController { private readonly externalToolUc: ExternalToolUc, private readonly externalToolDOMapper: ExternalToolRequestMapper, private readonly logger: LegacyLogger, - private readonly externalToolLogoService: ExternalToolLogoService, + private readonly externalToolLogoService: ExternalToolLogoService ) {} @Post() @@ -72,7 +72,7 @@ export class ToolController { async createExternalTool( @JWT() jwt: string, @CurrentUser() currentUser: ICurrentUser, - @Body() externalToolParams: ExternalToolCreateParams, + @Body() externalToolParams: ExternalToolCreateParams ): Promise { const externalTool: ExternalToolCreate = this.externalToolDOMapper.mapCreateRequest(externalToolParams); @@ -94,14 +94,14 @@ export class ToolController { async importExternalTools( @JWT() jwt: string, @CurrentUser() currentUser: ICurrentUser, - @Body() externalToolBulkParams: ExternalToolBulkCreateParams, + @Body() externalToolBulkParams: ExternalToolBulkCreateParams ): Promise { const externalTools: ExternalToolCreate[] = this.externalToolDOMapper.mapBulkCreateRequest(externalToolBulkParams); const results: ExternalToolImportResult[] = await this.externalToolUc.importExternalTools( currentUser.userId, externalTools, - jwt, + jwt ); const response: ExternalToolImportResultListResponse = ExternalToolResponseMapper.mapToImportResponse(results); @@ -118,7 +118,7 @@ export class ToolController { @CurrentUser() currentUser: ICurrentUser, @Query() filterQuery: ExternalToolSearchParams, @Query() pagination: PaginationParams, - @Query() sortingQuery: SortExternalToolParams, + @Query() sortingQuery: SortExternalToolParams ): Promise { const options: IFindOptions = { pagination }; options.order = this.externalToolDOMapper.mapSortingQueryToDomain(sortingQuery); @@ -128,13 +128,13 @@ export class ToolController { const tools: Page = await this.externalToolUc.findExternalTool(currentUser.userId, query, options); const dtoList: ExternalToolResponse[] = tools.data.map( - (tool: ExternalTool): ExternalToolResponse => ExternalToolResponseMapper.mapToExternalToolResponse(tool), + (tool: ExternalTool): ExternalToolResponse => ExternalToolResponseMapper.mapToExternalToolResponse(tool) ); const response: ExternalToolSearchListResponse = new ExternalToolSearchListResponse( dtoList, tools.total, pagination.skip, - pagination.limit, + pagination.limit ); return response; @@ -144,11 +144,11 @@ export class ToolController { @ApiOperation({ summary: 'Returns an ExternalTool for the given id' }) async getExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: ExternalToolIdParams, + @Param() params: ExternalToolIdParams ): Promise { const externalTool: ExternalTool = await this.externalToolUc.getExternalTool( currentUser.userId, - params.externalToolId, + params.externalToolId ); const mapped: ExternalToolResponse = ExternalToolResponseMapper.mapToExternalToolResponse(externalTool); @@ -165,14 +165,14 @@ export class ToolController { @JWT() jwt: string, @CurrentUser() currentUser: ICurrentUser, @Param() params: ExternalToolIdParams, - @Body() externalToolParams: ExternalToolUpdateParams, + @Body() externalToolParams: ExternalToolUpdateParams ): Promise { const externalTool: ExternalToolUpdate = this.externalToolDOMapper.mapUpdateRequest(externalToolParams); const updated: ExternalTool = await this.externalToolUc.updateExternalTool( currentUser.userId, params.externalToolId, externalTool, - jwt, + jwt ); const mapped: ExternalToolResponse = ExternalToolResponseMapper.mapToExternalToolResponse(updated); this.logger.debug(`ExternalTool with id ${mapped.id} was updated by user with id ${currentUser.userId}`); @@ -188,15 +188,15 @@ export class ToolController { async deleteExternalTool( @JWT() jwt: string, @CurrentUser() currentUser: ICurrentUser, - @Param() params: ExternalToolIdParams, + @Param() params: ExternalToolIdParams ): Promise { const promise: Promise = this.externalToolUc.deleteExternalTool( currentUser.userId, params.externalToolId, - jwt, + jwt ); this.logger.debug( - `ExternalTool with id ${params.externalToolId} was deleted by user with id ${currentUser.userId}`, + `ExternalTool with id ${params.externalToolId} was deleted by user with id ${currentUser.userId}` ); return promise; @@ -210,7 +210,7 @@ export class ToolController { @ApiUnauthorizedResponse({ description: 'User is not logged in.' }) async getExternalToolLogo(@Param() params: ExternalToolIdParams, @Res() res: Response): Promise { const externalToolLogo: ExternalToolLogo = await this.externalToolLogoService.getExternalToolBinaryLogo( - params.externalToolId, + params.externalToolId ); res.setHeader('Content-Type', externalToolLogo.contentType); res.setHeader('Cache-Control', 'must-revalidate'); @@ -226,11 +226,11 @@ export class ToolController { @ApiUnauthorizedResponse({ description: 'User is not logged in.' }) async getMetaDataForExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: ExternalToolIdParams, + @Param() params: ExternalToolIdParams ): Promise { const externalToolMetadata: ExternalToolMetadata = await this.externalToolUc.getMetadataForExternalTool( currentUser.userId, - params.externalToolId, + params.externalToolId ); const mapped: ExternalToolMetadataResponse = @@ -246,7 +246,7 @@ export class ToolController { async getDatasheet( @CurrentUser() currentUser: ICurrentUser, @Param() params: ExternalToolIdParams, - @Res({ passthrough: true }) res: Response, + @Res({ passthrough: true }) res: Response ): Promise { const datasheetBuffer: Buffer = await this.externalToolUc.getDatasheet(currentUser.userId, params.externalToolId); diff --git a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-fetch-failed-loggable-exception.ts b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-fetch-failed-loggable-exception.ts index 183644c341..0f7d1ae272 100644 --- a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-fetch-failed-loggable-exception.ts +++ b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-fetch-failed-loggable-exception.ts @@ -3,17 +3,14 @@ import { BusinessError } from '@shared/common/error'; import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; export class ExternalToolLogoFetchFailedLoggableException extends BusinessError implements Loggable { - constructor( - private readonly logoUrl: string, - private readonly httpStatus?: HttpStatus, - ) { + constructor(private readonly logoUrl: string, private readonly httpStatus?: HttpStatus) { super( { type: 'EXTERNAL_TOOL_LOGO_FETCH_FAILED', title: 'External tool logo fetch failed.', defaultMessage: 'External tool logo could not been fetched.', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-size-exceeded-loggable-exception.ts b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-size-exceeded-loggable-exception.ts index 05523c9743..26b90ed093 100644 --- a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-size-exceeded-loggable-exception.ts +++ b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-size-exceeded-loggable-exception.ts @@ -5,7 +5,7 @@ import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from export class ExternalToolLogoSizeExceededLoggableException extends BusinessError implements Loggable { constructor( private readonly externalToolId: string | undefined, - private readonly maxExternalToolLogoSizeInBytes: number, + private readonly maxExternalToolLogoSizeInBytes: number ) { super( { @@ -13,7 +13,7 @@ export class ExternalToolLogoSizeExceededLoggableException extends BusinessError title: 'External tool logo size exceeded.', defaultMessage: 'External tool logo size exceeded.', }, - HttpStatus.BAD_REQUEST, + HttpStatus.BAD_REQUEST ); } diff --git a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-wrong-file-type-loggable-exception.ts b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-wrong-file-type-loggable-exception.ts index 9bcb0d631c..7046cda143 100644 --- a/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-wrong-file-type-loggable-exception.ts +++ b/apps/server/src/modules/tool/external-tool/loggable/external-tool-logo-wrong-file-type-loggable-exception.ts @@ -10,7 +10,7 @@ export class ExternalToolLogoWrongFileTypeLoggableException extends BusinessErro title: 'External tool logo wrong file type.', defaultMessage: 'External tool logo has the wrong file type. Only JPEG and PNG files are supported.', }, - HttpStatus.BAD_REQUEST, + HttpStatus.BAD_REQUEST ); } diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool-authorizable.service.ts b/apps/server/src/modules/tool/external-tool/service/external-tool-authorizable.service.ts index 433ae2b624..778ea7b9f2 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool-authorizable.service.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool-authorizable.service.ts @@ -10,10 +10,7 @@ import { ExternalTool } from '../domain'; @Injectable() export class ExternalToolAuthorizableService implements AuthorizationLoaderService { - constructor( - private readonly externalToolRepo: ExternalToolRepo, - injectionService: AuthorizationInjectionService, - ) { + constructor(private readonly externalToolRepo: ExternalToolRepo, injectionService: AuthorizationInjectionService) { injectionService.injectReferenceLoader(AuthorizableReferenceType.ExternalTool, this); } diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.spec.ts b/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.spec.ts index 43b591cee8..689e44221c 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.spec.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.spec.ts @@ -65,7 +65,7 @@ describe('ExternalToolParameterValidationService', () => { const result: Promise = service.validateCommon(externalTool); await expect(result).rejects.toThrow( - new ValidationError(`tool_name_duplicate: The tool name "${externalTool.name}" is already used.`), + new ValidationError(`tool_name_duplicate: The tool name "${externalTool.name}" is already used.`) ); }); @@ -90,7 +90,7 @@ describe('ExternalToolParameterValidationService', () => { const func = () => service.validateCommon(externalTool); await expect(func()).rejects.toThrow( - new ValidationError(`tool_param_name: A custom parameter is missing a name.`), + new ValidationError(`tool_param_name: A custom parameter is missing a name.`) ); }); }); @@ -109,8 +109,8 @@ describe('ExternalToolParameterValidationService', () => { await expect(func()).rejects.toThrow( new ValidationError( - `tool_param_duplicate: The tool ${externalTool.name} contains multiple of the same custom parameters.`, - ), + `tool_param_duplicate: The tool ${externalTool.name} contains multiple of the same custom parameters.` + ) ); }); @@ -127,8 +127,8 @@ describe('ExternalToolParameterValidationService', () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_param_duplicate: The tool ${externalTool.name} contains multiple of the same custom parameters.`, - ), + `tool_param_duplicate: The tool ${externalTool.name} contains multiple of the same custom parameters.` + ) ); }); }); @@ -146,8 +146,8 @@ describe('ExternalToolParameterValidationService', () => { new ValidationError( `tool_param_regex_invalid: The custom Parameter "${ externalTool.parameters?.[0].name ?? '' - }" has an invalid regex.`, - ), + }" has an invalid regex.` + ) ); }); }); @@ -178,8 +178,8 @@ describe('ExternalToolParameterValidationService', () => { new ValidationError( `tool_param_regexComment: The custom parameter "${ externalTool.parameters?.[0].name ?? '' - }" parameter is missing a regex comment.`, - ), + }" parameter is missing a regex comment.` + ) ); }); }); @@ -235,8 +235,8 @@ describe('ExternalToolParameterValidationService', () => { new ValidationError( `tool_param_default_required: The custom parameter "${ externalTool.parameters?.[0].name ?? '' - }" is a global parameter and requires a default value.`, - ), + }" is a global parameter and requires a default value.` + ) ); }); }); @@ -266,8 +266,8 @@ describe('ExternalToolParameterValidationService', () => { new ValidationError( `tool_param_default_required: The custom parameter "${ externalTool.parameters?.[0].name ?? '' - }" is a global parameter and requires a default value.`, - ), + }" is a global parameter and requires a default value.` + ) ); }); }); @@ -323,8 +323,8 @@ describe('ExternalToolParameterValidationService', () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_param_auto_requires_global: The custom parameter "${parameter.name}" with type "${parameter.type}" must have the scope "global", since it is automatically filled.`, - ), + `tool_param_auto_requires_global: The custom parameter "${parameter.name}" with type "${parameter.type}" must have the scope "global", since it is automatically filled.` + ) ); }); }); @@ -349,8 +349,8 @@ describe('ExternalToolParameterValidationService', () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_param_type_mismatch: The default value of the custom parameter "${parameter.name}" should be of type "${parameter.type}".`, - ), + `tool_param_type_mismatch: The default value of the custom parameter "${parameter.name}" should be of type "${parameter.type}".` + ) ); }); }); @@ -382,8 +382,8 @@ describe('ExternalToolParameterValidationService', () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_param_auto_medium_id: The custom parameter "${parameter.name}" with type "${parameter.type}" must have the mediumId set.`, - ), + `tool_param_auto_medium_id: The custom parameter "${parameter.name}" with type "${parameter.type}" must have the mediumId set.` + ) ); }); }); diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.ts b/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.ts index 2bc432e061..9de764766b 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool-parameter-validation.service.ts @@ -18,7 +18,7 @@ export class ExternalToolParameterValidationService { if (externalTool.parameters) { if (this.hasDuplicateAttributes(externalTool.parameters)) { throw new ValidationError( - `tool_param_duplicate: The tool ${externalTool.name || ''} contains multiple of the same custom parameters.`, + `tool_param_duplicate: The tool ${externalTool.name || ''} contains multiple of the same custom parameters.` ); } @@ -29,43 +29,43 @@ export class ExternalToolParameterValidationService { if (!this.isGlobalParameterValid(param)) { throw new ValidationError( - `tool_param_default_required: The custom parameter "${param.name}" is a global parameter and requires a default value.`, + `tool_param_default_required: The custom parameter "${param.name}" is a global parameter and requires a default value.` ); } if (!this.isAutoParameterGlobal(param)) { throw new ValidationError( - `tool_param_auto_requires_global: The custom parameter "${param.name}" with type "${param.type}" must have the scope "global", since it is automatically filled.`, + `tool_param_auto_requires_global: The custom parameter "${param.name}" with type "${param.type}" must have the scope "global", since it is automatically filled.` ); } if (!this.isAutoParameterMediumIdValid(param, externalTool)) { throw new ValidationError( - `tool_param_auto_medium_id: The custom parameter "${param.name}" with type "${param.type}" must have the mediumId set.`, + `tool_param_auto_medium_id: The custom parameter "${param.name}" with type "${param.type}" must have the mediumId set.` ); } if (!this.isRegexCommentMandatoryAndFilled(param)) { throw new ValidationError( - `tool_param_regexComment: The custom parameter "${param.name}" parameter is missing a regex comment.`, + `tool_param_regexComment: The custom parameter "${param.name}" parameter is missing a regex comment.` ); } if (!this.isRegexValid(param)) { throw new ValidationError( - `tool_param_regex_invalid: The custom Parameter "${param.name}" has an invalid regex.`, + `tool_param_regex_invalid: The custom Parameter "${param.name}" has an invalid regex.` ); } if (!this.isDefaultValueOfValidType(param)) { throw new ValidationError( - `tool_param_type_mismatch: The default value of the custom parameter "${param.name}" should be of type "${param.type}".`, + `tool_param_type_mismatch: The default value of the custom parameter "${param.name}" should be of type "${param.type}".` ); } if (!this.isDefaultValueOfValidRegex(param)) { throw new ValidationError( - `tool_param_default_regex: The default value of a the custom parameter "${param.name}" does not match its regex.`, + `tool_param_default_regex: The default value of a the custom parameter "${param.name}" does not match its regex.` ); } }); @@ -90,8 +90,8 @@ export class ExternalToolParameterValidationService { return customParameter.some((item, itemIndex) => customParameter.some( (other, otherIndex) => - itemIndex !== otherIndex && item.name.toLocaleLowerCase() === other.name.toLocaleLowerCase(), - ), + itemIndex !== otherIndex && item.name.toLocaleLowerCase() === other.name.toLocaleLowerCase() + ) ); } diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.spec.ts b/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.spec.ts index 1446ca5771..d10e43a807 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.spec.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.spec.ts @@ -133,8 +133,8 @@ describe(ExternalToolValidationService.name, () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_clientId_duplicate: The Client Id of the tool ${externalOauthTool.name} is already used.`, - ), + `tool_clientId_duplicate: The Client Id of the tool ${externalOauthTool.name} is already used.` + ) ); }); }); @@ -154,8 +154,8 @@ describe(ExternalToolValidationService.name, () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_clientSecret_missing: The Client Secret of the tool ${externalOauthToolDOWithoutSecret.name} is missing.`, - ), + `tool_clientSecret_missing: The Client Secret of the tool ${externalOauthToolDOWithoutSecret.name} is missing.` + ) ); }); }); @@ -179,8 +179,8 @@ describe(ExternalToolValidationService.name, () => { new ValidationError( `tool_secret_missing: The secret of the LTI tool ${ externalLti11ToolDOWithoutSecret.name || '' - } is missing.`, - ), + } is missing.` + ) ); }); }); @@ -242,7 +242,7 @@ describe(ExternalToolValidationService.name, () => { configService.get.mockReturnValue(10); const expectedError = new ValidationError( - `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${externalTool.name} is missing.`, + `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${externalTool.name} is missing.` ); return { @@ -273,7 +273,7 @@ describe(ExternalToolValidationService.name, () => { configService.get.mockReturnValue(10); const expectedError = new ValidationError( - `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${externalTool.name} is missing.`, + `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${externalTool.name} is missing.` ); return { @@ -300,14 +300,14 @@ describe(ExternalToolValidationService.name, () => { const mockedPreferredToolsPage: Page = new Page( externalToolFactory.buildList(3), - 3, + 3 ); externalToolService.findExternalTools.mockResolvedValue(mockedPreferredToolsPage); configService.get.mockReturnValue(3); const expectedError = new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); return { @@ -334,14 +334,14 @@ describe(ExternalToolValidationService.name, () => { const mockedPreferredToolsPage: Page = new Page( externalToolFactory.buildList(5), - 3, + 3 ); externalToolService.findExternalTools.mockResolvedValue(mockedPreferredToolsPage); configService.get.mockReturnValue(3); const expectedError = new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); return { @@ -402,7 +402,7 @@ describe(ExternalToolValidationService.name, () => { const func = () => service.validateUpdate('notMatchToolId', externalOauthTool); await expect(func).rejects.toThrow( - new ValidationError(`tool_id_mismatch: The tool has no id or it does not match the path parameter.`), + new ValidationError(`tool_id_mismatch: The tool has no id or it does not match the path parameter.`) ); }); @@ -440,8 +440,8 @@ describe(ExternalToolValidationService.name, () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_type_immutable: The Config Type of the tool ${newExternalTool.name} is immutable.`, - ), + `tool_type_immutable: The Config Type of the tool ${newExternalTool.name} is immutable.` + ) ); }); }); @@ -488,8 +488,8 @@ describe(ExternalToolValidationService.name, () => { await expect(result).rejects.toThrow( new ValidationError( - `tool_clientId_immutable: The Client Id of the tool ${externalOauthTool.name} is immutable.`, - ), + `tool_clientId_immutable: The Client Id of the tool ${externalOauthTool.name} is immutable.` + ) ); }); }); @@ -587,7 +587,7 @@ describe(ExternalToolValidationService.name, () => { configService.get.mockReturnValue(10); const expectedError = new ValidationError( - `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolWithNewParams.name} is missing.`, + `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolWithNewParams.name} is missing.` ); return { @@ -625,7 +625,7 @@ describe(ExternalToolValidationService.name, () => { configService.get.mockReturnValue(10); const expectedError = new ValidationError( - `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolWithNewParams.name} is missing.`, + `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolWithNewParams.name} is missing.` ); return { @@ -662,14 +662,14 @@ describe(ExternalToolValidationService.name, () => { isPreferred: true, iconName: 'mdiFlag', }), - 3, + 3 ); externalToolService.findExternalTools.mockResolvedValue(existingPreferredTools); configService.get.mockReturnValue(3); const expectedError = new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); return { @@ -707,14 +707,14 @@ describe(ExternalToolValidationService.name, () => { isPreferred: true, iconName: 'mdiFlag', }), - 5, + 5 ); externalToolService.findExternalTools.mockResolvedValue(existingPreferredTools); configService.get.mockReturnValue(3); const expectedError = new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); return { @@ -757,7 +757,7 @@ describe(ExternalToolValidationService.name, () => { const existingTools: Page = new Page( [existingToolToUpdate, ...existingOtherPreferredTools], - 4, + 4 ); externalToolService.findExternalTools.mockResolvedValue(existingTools); @@ -799,14 +799,14 @@ describe(ExternalToolValidationService.name, () => { const existingTools: Page = new Page( [existingToolToUpdate, ...existingOtherPreferredTools], - 4, + 4 ); externalToolService.findExternalTools.mockResolvedValue(existingTools); configService.get.mockReturnValue(2); const expectedError = new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); return { diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.ts b/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.ts index 2ff1a346d5..f2d26a9dd1 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool-validation.service.ts @@ -14,7 +14,7 @@ export class ExternalToolValidationService { private readonly externalToolService: ExternalToolService, private readonly externalToolParameterValidationService: ExternalToolParameterValidationService, private readonly externalToolLogoService: ExternalToolLogoService, - private readonly configService: ConfigService, + private readonly configService: ConfigService ) {} async validateCreate(externalTool: ExternalTool): Promise { @@ -45,7 +45,7 @@ export class ExternalToolValidationService { externalTool.config.type !== loadedTool.config.type ) { throw new ValidationError( - `tool_type_immutable: The Config Type of the tool ${externalTool.name || ''} is immutable.`, + `tool_type_immutable: The Config Type of the tool ${externalTool.name || ''} is immutable.` ); } @@ -56,7 +56,7 @@ export class ExternalToolValidationService { externalTool.config.clientId !== loadedTool.config.clientId ) { throw new ValidationError( - `tool_clientId_immutable: The Client Id of the tool ${externalTool.name || ''} is immutable.`, + `tool_clientId_immutable: The Client Id of the tool ${externalTool.name || ''} is immutable.` ); } @@ -71,13 +71,13 @@ export class ExternalToolValidationService { if (ExternalTool.isOauth2Config(externalTool.config)) { if (!externalTool.config.clientSecret) { throw new ValidationError( - `tool_clientSecret_missing: The Client Secret of the tool ${externalTool.name || ''} is missing.`, + `tool_clientSecret_missing: The Client Secret of the tool ${externalTool.name || ''} is missing.` ); } if (!(await this.isClientIdUnique(externalTool))) { throw new ValidationError( - `tool_clientId_duplicate: The Client Id of the tool ${externalTool.name || ''} is already used.`, + `tool_clientId_duplicate: The Client Id of the tool ${externalTool.name || ''} is already used.` ); } } @@ -87,7 +87,7 @@ export class ExternalToolValidationService { if (ExternalTool.isLti11Config(externalTool.config)) { if (!externalTool.config.secret) { throw new ValidationError( - `tool_secret_missing: The secret of the LTI tool ${externalTool.name || ''} is missing.`, + `tool_secret_missing: The secret of the LTI tool ${externalTool.name || ''} is missing.` ); } } @@ -104,7 +104,7 @@ export class ExternalToolValidationService { private async validatePreferredTool(toolToValidate: ExternalTool): Promise { if (!toolToValidate.iconName) { throw new ValidationError( - `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolToValidate.name} is missing.`, + `tool_preferred_tools_missing_icon_name: The icon name of the preferred tool ${toolToValidate.name} is missing.` ); } @@ -113,7 +113,7 @@ export class ExternalToolValidationService { }); const isToolToValidateAlreadyPreferred: boolean = preferredTools.data.some( - (existingPreferredTool: ExternalTool) => existingPreferredTool.id === toolToValidate.id, + (existingPreferredTool: ExternalTool) => existingPreferredTool.id === toolToValidate.id ); if (isToolToValidateAlreadyPreferred) { return; @@ -121,7 +121,7 @@ export class ExternalToolValidationService { if (preferredTools.total >= this.configService.get('CTL_TOOLS__PREFERRED_TOOLS_LIMIT')) { throw new ValidationError( - `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.`, + `tool_preferred_tools_limit_reached: Unable to add a new preferred tool, the total limit had been reached.` ); } } diff --git a/apps/server/src/modules/tool/external-tool/service/external-tool.service.spec.ts b/apps/server/src/modules/tool/external-tool/service/external-tool.service.spec.ts index cb12e3f6d0..f434456191 100644 --- a/apps/server/src/modules/tool/external-tool/service/external-tool.service.spec.ts +++ b/apps/server/src/modules/tool/external-tool/service/external-tool.service.spec.ts @@ -316,7 +316,7 @@ describe(ExternalToolService.name, () => { ...externalTool, config: oauth2ToolConfig, id: expect.any(String), - }), + }) ); }); }); @@ -328,7 +328,7 @@ describe(ExternalToolService.name, () => { externalTool.config = oauth2ToolConfigWithoutExternalData; externalToolRepo.findById.mockResolvedValue(externalTool); oauthProviderService.getOAuth2Client.mockRejectedValueOnce( - new Error('some error occurred during fetching data'), + new Error('some error occurred during fetching data') ); return { externalTool }; diff --git a/apps/server/src/modules/tool/school-external-tool/controller/tool-school.controller.ts b/apps/server/src/modules/tool/school-external-tool/controller/tool-school.controller.ts index 70325e213a..ca67fb0246 100644 --- a/apps/server/src/modules/tool/school-external-tool/controller/tool-school.controller.ts +++ b/apps/server/src/modules/tool/school-external-tool/controller/tool-school.controller.ts @@ -35,10 +35,7 @@ import { @JwtAuthentication() @Controller('tools/school-external-tools') export class ToolSchoolController { - constructor( - private readonly schoolExternalToolUc: SchoolExternalToolUc, - private readonly logger: LegacyLogger, - ) {} + constructor(private readonly schoolExternalToolUc: SchoolExternalToolUc, private readonly logger: LegacyLogger) {} @Get() @ApiFoundResponse({ description: 'SchoolExternalTools has been found.', type: ExternalToolSearchListResponse }) @@ -47,7 +44,7 @@ export class ToolSchoolController { @ApiOperation({ summary: 'Returns a list of SchoolExternalTools for a given school' }) async getSchoolExternalTools( @CurrentUser() currentUser: ICurrentUser, - @Query() schoolExternalToolParams: SchoolExternalToolSearchParams, + @Query() schoolExternalToolParams: SchoolExternalToolSearchParams ): Promise { const found: SchoolExternalTool[] = await this.schoolExternalToolUc.findSchoolExternalTools(currentUser.userId, { schoolId: schoolExternalToolParams.schoolId, @@ -63,11 +60,11 @@ export class ToolSchoolController { @ApiOperation({ summary: 'Returns a SchoolExternalTool for the given id' }) async getSchoolExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: SchoolExternalToolIdParams, + @Param() params: SchoolExternalToolIdParams ): Promise { const schoolExternalTool: SchoolExternalTool = await this.schoolExternalToolUc.getSchoolExternalTool( currentUser.userId, - params.schoolExternalToolId, + params.schoolExternalToolId ); const mapped: SchoolExternalToolResponse = SchoolExternalToolResponseMapper.mapToSchoolExternalToolResponse(schoolExternalTool); @@ -83,14 +80,14 @@ export class ToolSchoolController { async updateSchoolExternalTool( @CurrentUser() currentUser: ICurrentUser, @Param() params: SchoolExternalToolIdParams, - @Body() body: SchoolExternalToolPostParams, + @Body() body: SchoolExternalToolPostParams ): Promise { const schoolExternalToolDto: SchoolExternalToolProps = SchoolExternalToolRequestMapper.mapSchoolExternalToolRequest(body); const updated: SchoolExternalTool = await this.schoolExternalToolUc.updateSchoolExternalTool( currentUser.userId, params.schoolExternalToolId, - schoolExternalToolDto, + schoolExternalToolDto ); const mapped: SchoolExternalToolResponse = @@ -106,11 +103,11 @@ export class ToolSchoolController { @HttpCode(HttpStatus.NO_CONTENT) async deleteSchoolExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: SchoolExternalToolIdParams, + @Param() params: SchoolExternalToolIdParams ): Promise { await this.schoolExternalToolUc.deleteSchoolExternalTool(currentUser.userId, params.schoolExternalToolId); this.logger.debug( - `SchoolExternalTool with id ${params.schoolExternalToolId} was deleted by user with id ${currentUser.userId}`, + `SchoolExternalTool with id ${params.schoolExternalToolId} was deleted by user with id ${currentUser.userId}` ); } @@ -126,14 +123,14 @@ export class ToolSchoolController { @ApiOperation({ summary: 'Creates a SchoolExternalTool' }) async createSchoolExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Body() body: SchoolExternalToolPostParams, + @Body() body: SchoolExternalToolPostParams ): Promise { const schoolExternalToolDto: SchoolExternalToolProps = SchoolExternalToolRequestMapper.mapSchoolExternalToolRequest(body); const createdSchoolExternalToolDO: SchoolExternalTool = await this.schoolExternalToolUc.createSchoolExternalTool( currentUser.userId, - schoolExternalToolDto, + schoolExternalToolDto ); const response: SchoolExternalToolResponse = @@ -153,7 +150,7 @@ export class ToolSchoolController { @ApiUnauthorizedResponse({ description: 'User is not logged in.' }) async getMetaDataForExternalTool( @CurrentUser() currentUser: ICurrentUser, - @Param() params: SchoolExternalToolIdParams, + @Param() params: SchoolExternalToolIdParams ): Promise { const schoolExternalToolMetadata: SchoolExternalToolMetadata = await this.schoolExternalToolUc.getMetadataForSchoolExternalTool(currentUser.userId, params.schoolExternalToolId); diff --git a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorizable.service.ts b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorizable.service.ts index 876f11b0a9..e40163cce5 100644 --- a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorizable.service.ts +++ b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorizable.service.ts @@ -12,7 +12,7 @@ import { SchoolExternalTool } from '../domain'; export class SchoolExternalToolAuthorizableService implements AuthorizationLoaderServiceGeneric { constructor( private readonly schoolExternalToolRepo: SchoolExternalToolRepo, - injectionService: AuthorizationInjectionService, + injectionService: AuthorizationInjectionService ) { injectionService.injectReferenceLoader(AuthorizableReferenceType.SchoolExternalToolEntity, this); } diff --git a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorization.service.spec.ts b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorization.service.spec.ts index 3bed5109a5..f9aee7ab5d 100644 --- a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorization.service.spec.ts +++ b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-authorization.service.spec.ts @@ -46,7 +46,7 @@ describe('SchoolExternalToolAuthorizableService', () => { it('should inject itself into the AuthorizationInjectionService', () => { expect(injectionService.injectReferenceLoader).toHaveBeenCalledWith( AuthorizableReferenceType.SchoolExternalToolEntity, - service, + service ); }); }); diff --git a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-validation.service.ts b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-validation.service.ts index bde01b627d..3aa20b5ed6 100644 --- a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-validation.service.ts +++ b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool-validation.service.ts @@ -9,7 +9,7 @@ import { SchoolExternalTool } from '../domain'; export class SchoolExternalToolValidationService { constructor( private readonly externalToolService: ExternalToolService, - private readonly commonToolValidationService: CommonToolValidationService, + private readonly commonToolValidationService: CommonToolValidationService ) {} async validate(schoolExternalTool: SchoolExternalTool): Promise { @@ -17,7 +17,7 @@ export class SchoolExternalToolValidationService { const errors: ValidationError[] = this.commonToolValidationService.validateParameters( loadedExternalTool, - schoolExternalTool, + schoolExternalTool ); if (errors.length) { diff --git a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.spec.ts b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.spec.ts index 424cd857a7..49e627a9b5 100644 --- a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.spec.ts +++ b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.spec.ts @@ -171,7 +171,7 @@ describe(SchoolExternalToolService.name, () => { isGloballyDeactivated: externalTool.isDeactivated, isOutdatedOnScopeSchool: true, }), - }), + }) ); }); }); @@ -217,7 +217,7 @@ describe(SchoolExternalToolService.name, () => { isGloballyDeactivated: externalTool.isDeactivated, isOutdatedOnScopeSchool: true, }), - }), + }) ); }); }); diff --git a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.ts b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.ts index 13b61aaf3f..3bc015c1d8 100644 --- a/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.ts +++ b/apps/server/src/modules/tool/school-external-tool/service/school-external-tool.service.ts @@ -14,7 +14,7 @@ export class SchoolExternalToolService { private readonly schoolExternalToolRepo: SchoolExternalToolRepo, private readonly externalToolService: ExternalToolService, private readonly commonToolValidationService: CommonToolValidationService, - private readonly commonToolDeleteService: CommonToolDeleteService, + private readonly commonToolDeleteService: CommonToolDeleteService ) {} public async findById(schoolExternalToolId: EntityId): Promise { @@ -40,8 +40,8 @@ export class SchoolExternalToolService { private async enrichWithDataFromExternalTools(tools: SchoolExternalTool[]): Promise { const enrichedTools: SchoolExternalTool[] = await Promise.all( tools.map( - async (tool: SchoolExternalTool): Promise => this.enrichWithDataFromExternalTool(tool), - ), + async (tool: SchoolExternalTool): Promise => this.enrichWithDataFromExternalTool(tool) + ) ); return enrichedTools; @@ -63,7 +63,7 @@ export class SchoolExternalToolService { private determineSchoolToolStatus( tool: SchoolExternalTool, - externalTool: ExternalTool, + externalTool: ExternalTool ): SchoolExternalToolConfigurationStatus { let isOutdatedOnScopeSchool = false; diff --git a/apps/server/src/modules/tool/tool-launch/error/launch-context-unavailable.loggable-exception.ts b/apps/server/src/modules/tool/tool-launch/error/launch-context-unavailable.loggable-exception.ts index 86955ecfa5..542f66371f 100644 --- a/apps/server/src/modules/tool/tool-launch/error/launch-context-unavailable.loggable-exception.ts +++ b/apps/server/src/modules/tool/tool-launch/error/launch-context-unavailable.loggable-exception.ts @@ -5,17 +5,14 @@ import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from import { ContextExternalToolLaunchable } from '../../context-external-tool/domain'; export class LaunchContextUnavailableLoggableException extends BusinessError implements Loggable { - constructor( - private readonly contextExternalTool: ContextExternalToolLaunchable, - private readonly userId: EntityId, - ) { + constructor(private readonly contextExternalTool: ContextExternalToolLaunchable, private readonly userId: EntityId) { super( { type: 'LAUNCH_CONTEXT_UNAVAILABLE', title: 'Launch context unavailable', defaultMessage: 'The context type cannot launch school external tools', }, - HttpStatus.FORBIDDEN, + HttpStatus.FORBIDDEN ); } diff --git a/apps/server/src/modules/tool/tool-launch/error/missing-licence.loggable-exception.ts b/apps/server/src/modules/tool/tool-launch/error/missing-licence.loggable-exception.ts index 029031fc83..1728d2970e 100644 --- a/apps/server/src/modules/tool/tool-launch/error/missing-licence.loggable-exception.ts +++ b/apps/server/src/modules/tool/tool-launch/error/missing-licence.loggable-exception.ts @@ -9,7 +9,7 @@ export class MissingMediaLicenseLoggableException extends BusinessError implemen constructor( private readonly medium: ExternalToolMedium, private readonly userId: EntityId, - private readonly contextExternalTool: ContextExternalToolLaunchable, + private readonly contextExternalTool: ContextExternalToolLaunchable ) { super( { @@ -17,7 +17,7 @@ export class MissingMediaLicenseLoggableException extends BusinessError implemen title: 'Missing media license', defaultMessage: 'The user does not have the required license to launch this medium.', }, - HttpStatus.FORBIDDEN, + HttpStatus.FORBIDDEN ); } diff --git a/apps/server/src/modules/tool/tool-launch/error/missing-tool-parameter-value.loggable-exception.ts b/apps/server/src/modules/tool/tool-launch/error/missing-tool-parameter-value.loggable-exception.ts index 337b389ddf..8b6720f7a1 100644 --- a/apps/server/src/modules/tool/tool-launch/error/missing-tool-parameter-value.loggable-exception.ts +++ b/apps/server/src/modules/tool/tool-launch/error/missing-tool-parameter-value.loggable-exception.ts @@ -7,7 +7,7 @@ import { ContextExternalToolLaunchable } from '../../context-external-tool/domai export class MissingToolParameterValueLoggableException extends BusinessError implements Loggable { constructor( private readonly contextExternalTool: ContextExternalToolLaunchable, - private readonly parameters: CustomParameter[], + private readonly parameters: CustomParameter[] ) { super( { @@ -19,7 +19,7 @@ export class MissingToolParameterValueLoggableException extends BusinessError im { parameterKeys: parameters.map((param): string => param.name), parameterNames: parameters.map((param): string => param.displayName), - }, + } ); } diff --git a/apps/server/src/modules/user-import/controller/api-test/import-user.api.spec.ts b/apps/server/src/modules/user-import/controller/api-test/import-user.api.spec.ts index 8cf9173e44..f2d4880c7f 100644 --- a/apps/server/src/modules/user-import/controller/api-test/import-user.api.spec.ts +++ b/apps/server/src/modules/user-import/controller/api-test/import-user.api.spec.ts @@ -46,7 +46,7 @@ describe('ImportUser Controller (API)', () => { permissions: Permission[] = [], features: SchoolFeature[] = [], schoolHasExternalId = true, - officialSchoolNumber = 'foo', + officialSchoolNumber = 'foo' ) => { const system = systemEntityFactory.buildWithId(); const school = schoolEntityFactory.build({ @@ -224,7 +224,7 @@ describe('ImportUser Controller (API)', () => { beforeEach(async () => { ({ school, system, account } = await authenticatedUser( [Permission.IMPORT_USER_VIEW], - [SchoolFeature.LDAP_UNIVENTION_MIGRATION], + [SchoolFeature.LDAP_UNIVENTION_MIGRATION] )); testApiClient = await testApiClient.login(account); const config: ServerConfig = serverConfig(); @@ -497,7 +497,7 @@ describe('ImportUser Controller (API)', () => { roleNames: expect.any(Array), classNames: expect.any(Array), flagged: expect.any(Boolean), - } as Partial>), + } as Partial>) ); expect(data.roleNames.length).toBeGreaterThanOrEqual(1); expect(data.classNames.length).toBeGreaterThanOrEqual(1); @@ -1165,7 +1165,7 @@ describe('ImportUser Controller (API)', () => { [Permission.IMPORT_USER_MIGRATE], [], true, - '00100', + '00100' ); setConfig(system._id.toString()); diff --git a/apps/server/src/modules/user-import/controller/import-user.controller.ts b/apps/server/src/modules/user-import/controller/import-user.controller.ts index 5ff29d5547..9e7011cdc3 100644 --- a/apps/server/src/modules/user-import/controller/import-user.controller.ts +++ b/apps/server/src/modules/user-import/controller/import-user.controller.ts @@ -34,17 +34,14 @@ import { PopulateImportUserParams } from './dto/populate-import-user.params'; @JwtAuthentication() @Controller('user/import') export class ImportUserController { - constructor( - private readonly userImportUc: UserImportUc, - private readonly userImportFetchUc: UserImportFetchUc, - ) {} + constructor(private readonly userImportUc: UserImportUc, private readonly userImportFetchUc: UserImportFetchUc) {} @Get() async findAllImportUsers( @CurrentUser() currentUser: ICurrentUser, @Query() scope: FilterImportUserParams, @Query() sortingQuery: SortImportUserParams, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { const options: IFindOptions = { pagination }; options.order = ImportUserMapper.mapSortingQueryToDomain(sortingQuery); @@ -61,7 +58,7 @@ export class ImportUserController { async setMatch( @Param() urlParams: ImportUserUrlParams, @CurrentUser() currentUser: ICurrentUser, - @Body() params: UpdateMatchParams, + @Body() params: UpdateMatchParams ): Promise { const result = await this.userImportUc.setMatch(currentUser.userId, urlParams.importUserId, params.userId); const response = ImportUserMapper.mapToResponse(result); @@ -72,7 +69,7 @@ export class ImportUserController { @Delete(':importUserId/match') async removeMatch( @Param() urlParams: ImportUserUrlParams, - @CurrentUser() currentUser: ICurrentUser, + @CurrentUser() currentUser: ICurrentUser ): Promise { const result = await this.userImportUc.removeMatch(currentUser.userId, urlParams.importUserId); const response = ImportUserMapper.mapToResponse(result); @@ -84,7 +81,7 @@ export class ImportUserController { async updateFlag( @Param() urlParams: ImportUserUrlParams, @CurrentUser() currentUser: ICurrentUser, - @Body() params: UpdateFlagParams, + @Body() params: UpdateFlagParams ): Promise { const result = await this.userImportUc.updateFlag(currentUser.userId, urlParams.importUserId, params.flagged); const response = ImportUserMapper.mapToResponse(result); @@ -96,7 +93,7 @@ export class ImportUserController { async findAllUnmatchedUsers( @CurrentUser() currentUser: ICurrentUser, @Query() scope: FilterUserParams, - @Query() pagination: PaginationParams, + @Query() pagination: PaginationParams ): Promise { const options: IFindOptions = { pagination }; @@ -118,7 +115,7 @@ export class ImportUserController { @Post('startUserMigration') async startSchoolInUserMigration( @CurrentUser() currentUser: ICurrentUser, - @Query('useCentralLdap') useCentralLdap?: boolean, + @Query('useCentralLdap') useCentralLdap?: boolean ): Promise { await this.userImportUc.startSchoolInUserMigration(currentUser.userId, useCentralLdap); } @@ -141,7 +138,7 @@ export class ImportUserController { @ApiForbiddenResponse() async populateImportUsers( @CurrentUser() currentUser: ICurrentUser, - @Query() query: PopulateImportUserParams, + @Query() query: PopulateImportUserParams ): Promise { await this.userImportFetchUc.populateImportUsers(currentUser.userId, query.matchByPreferredName); } diff --git a/apps/server/src/modules/user-import/loggable/user-import-configuration-failure-loggable-exception.ts b/apps/server/src/modules/user-import/loggable/user-import-configuration-failure-loggable-exception.ts index 23783bd4b6..2bc1a59851 100644 --- a/apps/server/src/modules/user-import/loggable/user-import-configuration-failure-loggable-exception.ts +++ b/apps/server/src/modules/user-import/loggable/user-import-configuration-failure-loggable-exception.ts @@ -10,7 +10,7 @@ export class UserImportConfigurationFailureLoggableException extends BusinessErr title: 'The user import configuration has a failure.', defaultMessage: 'Please check the user import configuration.', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/user-import/loggable/user-import-populate-failure-loggable-exception.ts b/apps/server/src/modules/user-import/loggable/user-import-populate-failure-loggable-exception.ts index e38f8246a8..8ce36fdace 100644 --- a/apps/server/src/modules/user-import/loggable/user-import-populate-failure-loggable-exception.ts +++ b/apps/server/src/modules/user-import/loggable/user-import-populate-failure-loggable-exception.ts @@ -10,7 +10,7 @@ export class UserImportPopulateFailureLoggableException extends BusinessError im title: 'Fetching import user failed.', defaultMessage: 'While fetching import users an error occurred.', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } 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 d792f8fe59..fac6e7e8cc 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 @@ -158,7 +158,7 @@ describe('[ImportUserModule]', () => { const createMockSchoolDo = (school?: SchoolEntity): LegacySchoolDo => { const name = school ? school.name : 'testSchool'; const id = school ? school.id : 'someId'; - const features = school ? (school.features ?? [SchoolFeature.LDAP_UNIVENTION_MIGRATION]) : []; + const features = school ? school.features ?? [SchoolFeature.LDAP_UNIVENTION_MIGRATION] : []; const externalId = school ? school.externalId : undefined; const officialSchoolNumber = school ? school.officialSchoolNumber : undefined; const inMaintenanceSince = school ? school.inMaintenanceSince : undefined; @@ -241,7 +241,7 @@ describe('[ImportUserModule]', () => { const importUserSaveSpy = jest.spyOn(importUserRepo, 'save').mockResolvedValueOnce(); await expect(async () => uc.setMatch(user.id, importUser.id, user.id)).rejects.toThrowError( - ForbiddenException, + ForbiddenException ); expect(importUser.flagged).not.toEqual(true); expect(schoolServiceSpy).toHaveBeenCalledWith(user.school.id); @@ -321,7 +321,7 @@ describe('[ImportUserModule]', () => { expect(importUser.matchedBy).toBeUndefined(); await expect(async () => uc.setMatch(currentUser.id, importUser.id, usermatch.id)).rejects.toThrowError( - UserAlreadyAssignedToImportUserError, + UserAlreadyAssignedToImportUserError ); expect(userRepoByIdSpy).toHaveBeenCalledWith(currentUser.id, true); expect(permissionServiceSpy).toHaveBeenCalledWith(currentUser, [Permission.IMPORT_USER_UPDATE]); @@ -355,7 +355,7 @@ describe('[ImportUserModule]', () => { const schoolServiceSpy = jest.spyOn(schoolService, 'getSchoolById').mockResolvedValue(createMockSchoolDo()); await expect(async () => uc.updateFlag(user.id, importUser.id, true)).rejects.toThrowError( - ForbiddenException, + ForbiddenException ); expect(importUser.flagged).not.toEqual(true); expect(schoolServiceSpy).toHaveBeenCalledWith(user.school.id); @@ -551,7 +551,7 @@ describe('[ImportUserModule]', () => { username: currentUser.email, createdAt: new Date(), updatedAt: new Date(), - }), + }) ) .mockResolvedValueOnce(null); importUserRepoDeleteImportUsersBySchoolSpy = importUserRepo.deleteImportUsersBySchool.mockResolvedValue(); @@ -684,7 +684,7 @@ describe('[ImportUserModule]', () => { expect(userMigrationService.migrateUser).toHaveBeenCalledWith( importUser.user?.id, importUser.externalId, - importUser.system.id, + importUser.system.id ); }); @@ -696,7 +696,7 @@ describe('[ImportUserModule]', () => { expect(userMigrationService.migrateUser).not.toHaveBeenCalledWith( importUserWithoutUser.user?.id, importUserWithoutUser.externalId, - importUserWithoutUser.system.id, + importUserWithoutUser.system.id ); }); }); @@ -733,7 +733,7 @@ describe('[ImportUserModule]', () => { userRepo.findById.mockResolvedValueOnce(user); schoolService.getSchoolById.mockResolvedValueOnce(school); userService.findByExternalId.mockResolvedValueOnce( - userDoFactory.buildWithId({ id: user.id, externalId: user.externalId }), + userDoFactory.buildWithId({ id: user.id, externalId: user.externalId }) ); importUserRepo.findImportUsers.mockResolvedValueOnce([[importUser, importUserWithoutUser], 2]); config.FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION = true; @@ -753,7 +753,7 @@ describe('[ImportUserModule]', () => { expect(userMigrationService.migrateUser).not.toHaveBeenCalledWith( importUser.user?.id, importUser.user?.externalId, - importUser.system.id, + importUser.system.id ); }); it('should log information for skipped user ', async () => { @@ -919,7 +919,7 @@ describe('[ImportUserModule]', () => { it('Should save school params', async () => { schoolServiceSaveSpy.mockRestore(); schoolServiceSaveSpy = schoolService.save.mockImplementation((schoolDo: LegacySchoolDo) => - Promise.resolve(schoolDo), + Promise.resolve(schoolDo) ); userImportService.getMigrationSystem.mockResolvedValueOnce(systemDo); @@ -1066,7 +1066,7 @@ describe('[ImportUserModule]', () => { const { user } = setup(); await expect(uc.startSchoolInUserMigration(user.id)).rejects.toThrow( - UserLoginMigrationNotActiveLoggableException, + UserLoginMigrationNotActiveLoggableException ); }); }); 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 4474130c02..05a3e0751a 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 @@ -57,7 +57,7 @@ export class UserImportUc { private readonly logger: Logger, private readonly userImportService: UserImportService, private readonly userLoginMigrationService: UserLoginMigrationService, - private readonly userMigrationService: UserMigrationService, + private readonly userMigrationService: UserMigrationService ) { this.logger.setContext(UserImportUc.name); } @@ -72,7 +72,7 @@ export class UserImportUc { public async findAllImportUsers( currentUserId: EntityId, query: ImportUserFilter, - options?: IFindOptions, + options?: IFindOptions ): Promise> { const currentUser = await this.getCurrentUser(currentUserId, Permission.IMPORT_USER_VIEW); const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); @@ -103,7 +103,7 @@ export class UserImportUc { // check same school if (!school.id || school.id !== userMatch.school.id || school.id !== importUser.school.id) { this.logger.warning( - new SchoolIdDoesNotMatchWithUserSchoolId(userMatch.school.id, importUser.school.id, school.id), + new SchoolIdDoesNotMatchWithUserSchoolId(userMatch.school.id, importUser.school.id, school.id) ); throw new ForbiddenException('not same school'); } @@ -164,7 +164,7 @@ export class UserImportUc { public async findAllUnmatchedUsers( currentUserId: EntityId, query: ImportUserNameMatchFilter, - options?: IFindOptions, + options?: IFindOptions ): Promise> { const currentUser = await this.getCurrentUser(currentUserId, Permission.IMPORT_USER_VIEW); const school: LegacySchoolDo = await this.schoolService.getSchoolById(currentUser.school.id); @@ -246,7 +246,7 @@ export class UserImportUc { public async startSchoolInUserMigration(currentUserId: EntityId, useCentralLdap = true): Promise { const FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION = this.configService.get( - 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION', + 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION' ); if (FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION) { @@ -289,8 +289,9 @@ export class UserImportUc { } private async checkSchoolMigrated(schoolId: EntityId, school: LegacySchoolDo): Promise { - const userLoginMigration: UserLoginMigrationDO | null = - await this.userLoginMigrationService.findMigrationBySchool(schoolId); + const userLoginMigration: UserLoginMigrationDO | null = await this.userLoginMigrationService.findMigrationBySchool( + schoolId + ); if (!userLoginMigration) { throw new NotFoundLoggableException('UserLoginMigration', { schoolId }); @@ -302,8 +303,9 @@ export class UserImportUc { } private async checkMigrationActive(schoolId: EntityId): Promise { - const userLoginMigration: UserLoginMigrationDO | null = - await this.userLoginMigrationService.findMigrationBySchool(schoolId); + const userLoginMigration: UserLoginMigrationDO | null = await this.userLoginMigrationService.findMigrationBySchool( + schoolId + ); if (!userLoginMigration || userLoginMigration?.closedAt) { throw new UserLoginMigrationNotActiveLoggableException(schoolId); @@ -324,7 +326,7 @@ export class UserImportUc { school.inMaintenanceSince = undefined; const isMigrationRestartable: boolean = this.configService.get( - 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION', + 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION' ); if (isMigrationRestartable) { school.inUserMigration = undefined; @@ -353,7 +355,7 @@ export class UserImportUc { const filters: ImportUserFilter = { matches: [ImportUserMatchCreatorScope.AUTO] }; const [autoMatchedUsers]: Counted = await this.importUserRepo.findImportUsers( currentUser.school, - filters, + filters ); for (const autoMatchedUser of autoMatchedUsers) { @@ -372,7 +374,7 @@ export class UserImportUc { private async updateUserAndAccount(importUser: ImportUser, school: LegacySchoolDo): Promise { const FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION = this.configService.get( - 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION', + 'FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION' ); if (FEATURE_MIGRATION_WIZARD_WITH_USER_LOGIN_MIGRATION) { diff --git a/apps/server/src/modules/user-login-migration/loggable/identical-user-login-migration-system.loggable-exception.ts b/apps/server/src/modules/user-login-migration/loggable/identical-user-login-migration-system.loggable-exception.ts index dfd40f9c87..34bceb5aab 100644 --- a/apps/server/src/modules/user-login-migration/loggable/identical-user-login-migration-system.loggable-exception.ts +++ b/apps/server/src/modules/user-login-migration/loggable/identical-user-login-migration-system.loggable-exception.ts @@ -4,10 +4,7 @@ import { EntityId } from '@shared/domain/types'; import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; export class IdenticalUserLoginMigrationSystemLoggableException extends BusinessError implements Loggable { - constructor( - private readonly schoolId: string | undefined, - private readonly targetSystemId: EntityId | undefined, - ) { + constructor(private readonly schoolId: string | undefined, private readonly targetSystemId: EntityId | undefined) { super( { type: 'IDENTICAL_USER_LOGIN_MIGRATION_SYSTEM', @@ -19,7 +16,7 @@ export class IdenticalUserLoginMigrationSystemLoggableException extends Business { schoolId, targetSystemId, - }, + } ); } diff --git a/apps/server/src/modules/user-login-migration/loggable/moin-schule-system-not-found.loggable-exception.ts b/apps/server/src/modules/user-login-migration/loggable/moin-schule-system-not-found.loggable-exception.ts index 9c03f4aad2..0497337cdd 100644 --- a/apps/server/src/modules/user-login-migration/loggable/moin-schule-system-not-found.loggable-exception.ts +++ b/apps/server/src/modules/user-login-migration/loggable/moin-schule-system-not-found.loggable-exception.ts @@ -10,7 +10,7 @@ export class MoinSchuleSystemNotFoundLoggableException extends BusinessError imp title: 'moin.schule system not found', defaultMessage: 'Cannot find moin.schule system', }, - HttpStatus.INTERNAL_SERVER_ERROR, + HttpStatus.INTERNAL_SERVER_ERROR ); } diff --git a/apps/server/src/modules/user-login-migration/loggable/school-number-mismatch.loggable-exception.ts b/apps/server/src/modules/user-login-migration/loggable/school-number-mismatch.loggable-exception.ts index 7501c40867..bf7171a74e 100644 --- a/apps/server/src/modules/user-login-migration/loggable/school-number-mismatch.loggable-exception.ts +++ b/apps/server/src/modules/user-login-migration/loggable/school-number-mismatch.loggable-exception.ts @@ -3,10 +3,7 @@ import { BusinessError } from '@shared/common/error'; import { ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@src/core/logger'; export class SchoolNumberMismatchLoggableException extends BusinessError implements Loggable { - constructor( - private readonly sourceSchoolNumber: string, - private readonly targetSchoolNumber: string, - ) { + constructor(private readonly sourceSchoolNumber: string, private readonly targetSchoolNumber: string) { super( { type: 'SCHOOL_MIGRATION_FAILED', @@ -17,7 +14,7 @@ export class SchoolNumberMismatchLoggableException extends BusinessError impleme { sourceSchoolNumber, targetSchoolNumber, - }, + } ); } diff --git a/apps/server/src/modules/user-login-migration/loggable/user-login-migration-invalid-external-school-id.loggable-exception.ts b/apps/server/src/modules/user-login-migration/loggable/user-login-migration-invalid-external-school-id.loggable-exception.ts index ba2f14afb7..d68180edaa 100644 --- a/apps/server/src/modules/user-login-migration/loggable/user-login-migration-invalid-external-school-id.loggable-exception.ts +++ b/apps/server/src/modules/user-login-migration/loggable/user-login-migration-invalid-external-school-id.loggable-exception.ts @@ -10,7 +10,7 @@ export class UserLoginMigrationInvalidExternalSchoolIdLoggableException extends title: 'The given external school ID is invalid', defaultMessage: 'The given external school ID does not match with the migrated school', }, - HttpStatus.UNPROCESSABLE_ENTITY, + HttpStatus.UNPROCESSABLE_ENTITY ); } diff --git a/apps/server/src/modules/user-login-migration/loggable/user-login-migration-user-already-migrated.loggable-exception.ts b/apps/server/src/modules/user-login-migration/loggable/user-login-migration-user-already-migrated.loggable-exception.ts index 4099d70cf1..ee021e6b0d 100644 --- a/apps/server/src/modules/user-login-migration/loggable/user-login-migration-user-already-migrated.loggable-exception.ts +++ b/apps/server/src/modules/user-login-migration/loggable/user-login-migration-user-already-migrated.loggable-exception.ts @@ -13,7 +13,7 @@ export class UserLoginMigrationUserAlreadyMigratedLoggableException extends Busi HttpStatus.UNPROCESSABLE_ENTITY, { multipleUsersFound: true, - }, + } ); } 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 df0dd3a8bf..d74d9d6eb9 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 @@ -10,13 +10,13 @@ export class MigrationCheckService { constructor( private readonly userService: UserService, private readonly schoolService: LegacySchoolService, - private readonly userLoginMigrationRepo: UserLoginMigrationRepo, + private readonly userLoginMigrationRepo: UserLoginMigrationRepo ) {} public async shouldUserMigrate( externalUserId: string, systemId: EntityId, - officialSchoolNumber: string, + officialSchoolNumber: string ): Promise { const school: LegacySchoolDo | null = await this.schoolService.getSchoolBySchoolNumber(officialSchoolNumber); 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 ef4cc80270..6910e6c1fe 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 @@ -17,13 +17,13 @@ export class SchoolMigrationService { private readonly legacyLogger: LegacyLogger, private readonly logger: Logger, private readonly userService: UserService, - private readonly userLoginMigrationRepo: UserLoginMigrationRepo, + private readonly userLoginMigrationRepo: UserLoginMigrationRepo ) {} public async migrateSchool( existingSchool: LegacySchoolDo, externalId: string, - targetSystemId: string, + targetSystemId: string ): Promise { const schoolDOCopy: LegacySchoolDo = new LegacySchoolDo({ ...existingSchool }); @@ -54,7 +54,7 @@ export class SchoolMigrationService { await this.schoolService.save(originalSchoolDO); } catch (error: unknown) { this.logger.warning( - new SchoolMigrationDatabaseOperationFailedLoggableException(originalSchoolDO, 'rollback', error), + new SchoolMigrationDatabaseOperationFailedLoggableException(originalSchoolDO, 'rollback', error) ); } } @@ -62,7 +62,7 @@ export class SchoolMigrationService { public async getSchoolForMigration( userId: string, externalId: string, - officialSchoolNumber: string, + officialSchoolNumber: string ): Promise { const user: UserDO = await this.userService.findById(userId); const school: LegacySchoolDo = await this.schoolService.getSchoolById(user.schoolId); @@ -82,7 +82,7 @@ export class SchoolMigrationService { if (schoolDO.officialSchoolNumber !== officialExternalSchoolNumber) { throw new SchoolNumberMismatchLoggableException( schoolDO.officialSchoolNumber ?? '', - officialExternalSchoolNumber, + officialExternalSchoolNumber ); } } @@ -95,7 +95,7 @@ export class SchoolMigrationService { public hasSchoolMigratedInMigrationPhase( schoolDO: LegacySchoolDo, - userLoginMigrationDO: UserLoginMigrationDO, + userLoginMigrationDO: UserLoginMigrationDO ): boolean { if (!schoolDO.systems) { return false; @@ -125,7 +125,7 @@ export class SchoolMigrationService { this.legacyLogger.warn( `markUnmigratedUsersAsOutdated for schoolId ${userLoginMigration.schoolId} took ${ endTime - startTime - } milliseconds`, + } milliseconds` ); } @@ -145,7 +145,7 @@ export class SchoolMigrationService { const endTime: number = performance.now(); this.legacyLogger.warn( - `unmarkOutdatedUsers for schoolId ${userLoginMigration.schoolId} took ${endTime - startTime} milliseconds`, + `unmarkOutdatedUsers for schoolId ${userLoginMigration.schoolId} took ${endTime - startTime} milliseconds` ); } 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 b361dbae37..6a0da31f8a 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 @@ -30,7 +30,7 @@ describe(UserLoginMigrationService.name, () => { const mockedDate: Date = new Date('2023-05-02'); const finishDate: Date = new Date( - mockedDate.getTime() + (Configuration.get('MIGRATION_END_GRACE_PERIOD_MS') as number), + mockedDate.getTime() + (Configuration.get('MIGRATION_END_GRACE_PERIOD_MS') as number) ); beforeAll(async () => { @@ -285,7 +285,7 @@ describe(UserLoginMigrationService.name, () => { expect(schoolService.save).toHaveBeenCalledWith( expect.objectContaining>({ features: [existingFeature, SchoolFeature.OAUTH_PROVISIONING_ENABLED], - }), + }) ); }); }); @@ -318,7 +318,7 @@ describe(UserLoginMigrationService.name, () => { expect(schoolService.save).toHaveBeenCalledWith( expect.objectContaining>({ features: [SchoolFeature.OAUTH_PROVISIONING_ENABLED], - }), + }) ); }); }); @@ -373,7 +373,7 @@ describe(UserLoginMigrationService.name, () => { const func = async () => service.startMigration(schoolId); await expect(func).rejects.toThrow( - new IdenticalUserLoginMigrationSystemLoggableException(schoolId, targetSystemId), + new IdenticalUserLoginMigrationSystemLoggableException(schoolId, targetSystemId) ); }); }); @@ -545,7 +545,7 @@ describe(UserLoginMigrationService.name, () => { const { userLoginMigration, dateInThePast } = setup(); await expect(service.restartMigration({ ...userLoginMigration })).rejects.toThrow( - new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast), + new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast) ); }); }); @@ -628,7 +628,7 @@ describe(UserLoginMigrationService.name, () => { const { userLoginMigration, dateInThePast } = setup(); await expect(service.setMigrationMandatory({ ...userLoginMigration }, true)).rejects.toThrow( - new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast), + new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast) ); }); }); @@ -679,7 +679,7 @@ describe(UserLoginMigrationService.name, () => { expect(schoolService.removeFeature).toHaveBeenCalledWith( userLoginMigration.schoolId, - SchoolFeature.ENABLE_LDAP_SYNC_DURING_MIGRATION, + SchoolFeature.ENABLE_LDAP_SYNC_DURING_MIGRATION ); }); @@ -755,7 +755,7 @@ describe(UserLoginMigrationService.name, () => { const { userLoginMigration, dateInThePast } = setup(); await expect(service.closeMigration({ ...userLoginMigration })).rejects.toThrow( - new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast), + new UserLoginMigrationGracePeriodExpiredLoggableException(userLoginMigration.id as string, dateInThePast) ); }); }); 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 e33101a9f4..6d1229eb22 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 @@ -20,7 +20,7 @@ export class UserLoginMigrationService { private readonly userService: UserService, private readonly userLoginMigrationRepo: UserLoginMigrationRepo, private readonly schoolService: LegacySchoolService, - private readonly systemService: SystemService, + private readonly systemService: SystemService ) {} public async startMigration(schoolId: string): Promise { @@ -53,7 +53,7 @@ export class UserLoginMigrationService { public async setMigrationMandatory( userLoginMigration: UserLoginMigrationDO, - mandatory: boolean, + mandatory: boolean ): Promise { this.checkGracePeriod(userLoginMigration); @@ -81,7 +81,7 @@ export class UserLoginMigrationService { await this.schoolService.removeFeature( userLoginMigration.schoolId, - SchoolFeature.ENABLE_LDAP_SYNC_DURING_MIGRATION, + SchoolFeature.ENABLE_LDAP_SYNC_DURING_MIGRATION ); const now: Date = new Date(); @@ -99,7 +99,7 @@ export class UserLoginMigrationService { if (userLoginMigration.finishedAt && this.isGracePeriodExpired(userLoginMigration)) { throw new UserLoginMigrationGracePeriodExpiredLoggableException( userLoginMigration.id as string, - userLoginMigration.finishedAt, + userLoginMigration.finishedAt ); } } diff --git a/apps/server/src/modules/user/legacy/controller/admin-api-students.controller.ts b/apps/server/src/modules/user/legacy/controller/admin-api-students.controller.ts index 7a9d2c5db4..fed53da143 100644 --- a/apps/server/src/modules/user/legacy/controller/admin-api-students.controller.ts +++ b/apps/server/src/modules/user/legacy/controller/admin-api-students.controller.ts @@ -21,7 +21,7 @@ export class AdminApiStudentsController { @ApiResponse({ status: 403, type: ForbiddenOperationError, description: 'Not authorized.' }) async searchStudents( @CurrentUser() currentUser: ICurrentUser, - @Query() params: UsersSearchQueryParams, + @Query() params: UsersSearchQueryParams ): Promise { return this.uc.findUsersByParams(RequestedRoleEnum.STUDENTS, currentUser.userId, params); } @@ -34,7 +34,7 @@ export class AdminApiStudentsController { @ApiResponse({ status: 404, type: EntityNotFoundError, description: 'Student not found.' }) async findStudentById( @CurrentUser() currentUser: ICurrentUser, - @Param() params: UserByIdParams, + @Param() params: UserByIdParams ): Promise { return this.uc.findUserById(RequestedRoleEnum.STUDENTS, currentUser.userId, params); } diff --git a/apps/server/src/modules/user/legacy/controller/admin-api-teachers.controller.ts b/apps/server/src/modules/user/legacy/controller/admin-api-teachers.controller.ts index d5e7712cbd..4cfe022605 100644 --- a/apps/server/src/modules/user/legacy/controller/admin-api-teachers.controller.ts +++ b/apps/server/src/modules/user/legacy/controller/admin-api-teachers.controller.ts @@ -21,7 +21,7 @@ export class AdminApiTeachersController { @ApiResponse({ status: 403, type: ForbiddenOperationError, description: 'Not authorized.' }) async searchTeachers( @CurrentUser() currentUser: ICurrentUser, - @Query() params: UsersSearchQueryParams, + @Query() params: UsersSearchQueryParams ): Promise { return this.uc.findUsersByParams(RequestedRoleEnum.TEACHERS, currentUser.userId, params); } @@ -34,7 +34,7 @@ export class AdminApiTeachersController { @ApiResponse({ status: 404, type: EntityNotFoundError, description: 'Teacher not found.' }) async findTeacherById( @CurrentUser() currentUser: ICurrentUser, - @Param() params: UserByIdParams, + @Param() params: UserByIdParams ): Promise { return this.uc.findUserById(RequestedRoleEnum.TEACHERS, currentUser.userId, params); } diff --git a/apps/server/src/modules/user/legacy/service/users-admin.service.ts b/apps/server/src/modules/user/legacy/service/users-admin.service.ts index 71e1d59a9d..552b2bc0c9 100644 --- a/apps/server/src/modules/user/legacy/service/users-admin.service.ts +++ b/apps/server/src/modules/user/legacy/service/users-admin.service.ts @@ -8,10 +8,7 @@ import { UsersAdminRepo } from '../repo'; @Injectable() export class UsersAdminService { - constructor( - private readonly usersAdminRepo: UsersAdminRepo, - private readonly logger: Logger, - ) { + constructor(private readonly usersAdminRepo: UsersAdminRepo, private readonly logger: Logger) { this.logger.setContext(UsersAdminService.name); } @@ -19,13 +16,13 @@ export class UsersAdminService { roleId: string | undefined, schoolId: EntityId, schoolYearId: EntityId | undefined, - params: UsersSearchQueryParams, + params: UsersSearchQueryParams ): Promise { const usersResponse = (await this.usersAdminRepo.getUsersWithNestedData( roleId, schoolId, schoolYearId, - params, + params )) as UserListResponse[]; return new UserListResponse(usersResponse[0]); } @@ -34,13 +31,13 @@ export class UsersAdminService { roleId: string | undefined, schoolId: EntityId, schoolYearId: EntityId | undefined, - userId?: string, + userId?: string ): Promise { const user = (await this.usersAdminRepo.getUserByIdWithNestedData( roleId, schoolId, schoolYearId, - userId, + userId )) as UserResponse[]; if (user.length < 1) { throw new EntityNotFoundError(User.name); diff --git a/apps/server/src/modules/user/legacy/uc/users-admin-api.uc.ts b/apps/server/src/modules/user/legacy/uc/users-admin-api.uc.ts index cc698a7770..4115b720b8 100644 --- a/apps/server/src/modules/user/legacy/uc/users-admin-api.uc.ts +++ b/apps/server/src/modules/user/legacy/uc/users-admin-api.uc.ts @@ -19,13 +19,13 @@ export class UsersAdminApiUc { private readonly userRepo: UserRepo, private readonly roleService: RoleService, private readonly adminUsersService: UsersAdminService, - private readonly authorizationService: AuthorizationService, + private readonly authorizationService: AuthorizationService ) {} public async findUsersByParams( requestedRole: RequestedRoleEnum, currentUserId: string, - params: UsersSearchQueryParams, + params: UsersSearchQueryParams ): Promise { const currentUser = await this.userRepo.findById(currentUserId, true); this.validateAccessToContext(requestedRole, currentUser); @@ -40,7 +40,7 @@ export class UsersAdminApiUc { public async findUserById( requestedRole: RequestedRoleEnum, currentUserId: string, - params: UserByIdParams, + params: UserByIdParams ): Promise { const currentUser = await this.userRepo.findById(currentUserId, true); this.validateAccessToContext(requestedRole, currentUser); diff --git a/apps/server/src/modules/user/service/user.service.spec.ts b/apps/server/src/modules/user/service/user.service.spec.ts index d1ddd21cff..5f70648ca7 100644 --- a/apps/server/src/modules/user/service/user.service.spec.ts +++ b/apps/server/src/modules/user/service/user.service.spec.ts @@ -476,7 +476,7 @@ describe('UserService', () => { expect(userDORepo.find).toHaveBeenCalledWith( { schoolId: school.id, roleId: role.id, discoverable: UserDiscoverableQuery.NOT_FALSE }, - undefined, + undefined ); }); }); @@ -490,7 +490,7 @@ describe('UserService', () => { expect(userDORepo.find).toHaveBeenCalledWith( { schoolId: school.id, roleId: role.id, discoverable: UserDiscoverableQuery.TRUE }, - undefined, + undefined ); }); }); @@ -586,7 +586,7 @@ describe('UserService', () => { setupGuestRoles(); await expect(() => - service.addSecondarySchoolToUsers([user.id as string], targetSchool.id), + service.addSecondarySchoolToUsers([user.id as string], targetSchool.id) ).rejects.toThrowError(); }); }); @@ -609,7 +609,7 @@ describe('UserService', () => { await service.addSecondarySchoolToUsers([user.id as string], targetSchool.id); expect(userDORepo.saveAll).toHaveBeenCalledWith( - expect.arrayContaining([expect.objectContaining({ id: user.id, secondarySchools: [] })]), + expect.arrayContaining([expect.objectContaining({ id: user.id, secondarySchools: [] })]) ); }); }); @@ -637,9 +637,7 @@ describe('UserService', () => { await service.addSecondarySchoolToUsers([user.id as string], targetSchool.id); expect(userDORepo.saveAll).toHaveBeenCalledWith( - expect.arrayContaining([ - expect.objectContaining({ id: user.id, secondarySchools: expectedSecondarySchools }), - ]), + expect.arrayContaining([expect.objectContaining({ id: user.id, secondarySchools: expectedSecondarySchools })]) ); }); }); @@ -667,7 +665,7 @@ describe('UserService', () => { await service.removeSecondarySchoolFromUsers([user.id as EntityId], targetSchool.id); expect(userDORepo.saveAll).toHaveBeenCalledWith( - expect.arrayContaining([expect.objectContaining({ id: user.id, secondarySchools: [] })]), + expect.arrayContaining([expect.objectContaining({ id: user.id, secondarySchools: [] })]) ); }); }); @@ -844,7 +842,7 @@ describe('UserService', () => { const expectedResult = DomainDeletionReportBuilder.build( DomainName.USER, [DomainOperationReportBuilder.build(OperationType.DELETE, 1, [user.id])], - [registrationPinDeleted, calendarEventsDeleted], + [registrationPinDeleted, calendarEventsDeleted] ); jest.spyOn(service, 'removeUserRegistrationPin').mockResolvedValueOnce(registrationPinDeleted); @@ -897,7 +895,7 @@ describe('UserService', () => { userRepo.deleteUser.mockResolvedValue(0); const expectedError = new DeletionErrorLoggableException( - `Failed to delete user '${user.id}' from User collection`, + `Failed to delete user '${user.id}' from User collection` ); return { diff --git a/apps/server/src/modules/user/service/user.service.ts b/apps/server/src/modules/user/service/user.service.ts index 8a5b5e07ca..61f65c5df4 100644 --- a/apps/server/src/modules/user/service/user.service.ts +++ b/apps/server/src/modules/user/service/user.service.ts @@ -45,7 +45,7 @@ export class UserService implements DeletionService, IEventHandler, + options?: IFindOptions ): Promise> { const role = await this.roleService.findByName(roleName); const query = { schoolId, roleId: role.id }; @@ -201,7 +201,7 @@ export class UserService implements DeletionService, IEventHandler - !!protectedRoles.find((protectedRole: RoleDto): boolean => roleRef.id === protectedRole.id), + !!protectedRoles.find((protectedRole: RoleDto): boolean => roleRef.id === protectedRole.id) ); const displayName: string = isProtectedUser ? user.lastName : `${user.firstName} ${user.lastName}`; @@ -226,7 +226,7 @@ export class UserService implements DeletionService, IEventHandler { this.logger.info( - new DataDeletionDomainOperationLoggable('Deleting user', DomainName.USER, userId, StatusModel.PENDING), + new DataDeletionDomainOperationLoggable('Deleting user', DomainName.USER, userId, StatusModel.PENDING) ); const userToDelete: User | null = await this.userRepo.findByIdOrNull(userId, true); @@ -243,8 +243,8 @@ export class UserService implements DeletionService, IEventHandler 0) { const results = await Promise.all( - emailsToDeletion.map((email) => this.registrationPinService.deleteUserData(email)), + emailsToDeletion.map((email) => this.registrationPinService.deleteUserData(email)) ); extractedOperationReport = OperationReportHelper.extractOperationReports(results); diff --git a/apps/server/src/modules/user/uc/user.uc.ts b/apps/server/src/modules/user/uc/user.uc.ts index 41bcd7c475..893ed6d8c5 100644 --- a/apps/server/src/modules/user/uc/user.uc.ts +++ b/apps/server/src/modules/user/uc/user.uc.ts @@ -9,10 +9,7 @@ import { UserConfig } from '../interfaces'; @Injectable() export class UserUc { - constructor( - private readonly userRepo: UserRepo, - private readonly configService: ConfigService, - ) {} + constructor(private readonly userRepo: UserRepo, private readonly configService: ConfigService) {} async me(userId: EntityId): Promise<[User, string[]]> { const user = await this.userRepo.findById(userId, true); 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 dc58b8242d..8d18ae4ec4 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 @@ -461,7 +461,7 @@ describe(VideoConferenceService.name, () => { expect(authorizationService.hasPermission).toHaveBeenCalledWith( user, entity, - AuthorizationContextBuilder.read([Permission.START_MEETING]), + AuthorizationContextBuilder.read([Permission.START_MEETING]) ); }); @@ -596,7 +596,7 @@ describe(VideoConferenceService.name, () => { expect(authorizationService.hasPermission).toHaveBeenCalledWith( user, entity, - AuthorizationContextBuilder.read([Permission.START_MEETING]), + AuthorizationContextBuilder.read([Permission.START_MEETING]) ); }); @@ -637,13 +637,13 @@ describe(VideoConferenceService.name, () => { 1, user, entity, - AuthorizationContextBuilder.read([Permission.START_MEETING]), + AuthorizationContextBuilder.read([Permission.START_MEETING]) ); expect(authorizationService.hasPermission).toHaveBeenNthCalledWith( 2, user, entity, - AuthorizationContextBuilder.read([Permission.JOIN_MEETING]), + AuthorizationContextBuilder.read([Permission.JOIN_MEETING]) ); }); @@ -1288,7 +1288,7 @@ describe(VideoConferenceService.name, () => { expect(videoConferenceRepo.findByScopeAndScopeId).toHaveBeenCalledWith( videoConference.target, - videoConference.targetModel, + videoConference.targetModel ); }); @@ -1297,7 +1297,7 @@ describe(VideoConferenceService.name, () => { const result: VideoConferenceDO = await service.findVideoConferenceByScopeIdAndScope( videoConference.target, - videoConference.targetModel, + videoConference.targetModel ); expect(result).toBe(videoConference); @@ -1373,7 +1373,7 @@ describe(VideoConferenceService.name, () => { const result: VideoConferenceDO = await service.createOrUpdateVideoConferenceForScopeWithOptions( scope.id, scope.scope, - newOptions, + newOptions ); expect(result).toEqual({ ...videoConference, options: newOptions }); @@ -1405,7 +1405,7 @@ describe(VideoConferenceService.name, () => { const result: VideoConferenceDO = await service.createOrUpdateVideoConferenceForScopeWithOptions( scope.id, scope.scope, - options, + options ); expect(result).toEqual(videoConference); 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 19e863dd8b..1e8d615399 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 @@ -37,7 +37,7 @@ export class VideoConferenceService { private readonly schoolService: LegacySchoolService, private readonly teamsRepo: TeamsRepo, private readonly userService: UserService, - private readonly videoConferenceRepo: VideoConferenceRepo, + private readonly videoConferenceRepo: VideoConferenceRepo ) {} get hostUrl(): string { @@ -58,7 +58,7 @@ export class VideoConferenceService { public async hasExpertRole( userId: EntityId, conferenceScope: VideoConferenceScope, - scopeId: string, + scopeId: string ): Promise { let isExpert = false; switch (conferenceScope) { @@ -73,7 +73,7 @@ export class VideoConferenceService { case VideoConferenceScope.EVENT: { const team: TeamEntity = await this.teamsRepo.findById(scopeId); const teamUser: TeamUserEntity | undefined = team.teamUsers.find( - (userInTeam: TeamUserEntity) => userInTeam.user.id === userId, + (userInTeam: TeamUserEntity) => userInTeam.user.id === userId ); if (teamUser === undefined) { @@ -200,7 +200,7 @@ export class VideoConferenceService { if (!this.isVideoConferenceFeatureEnabled) { throw new ForbiddenException( ErrorStatus.SCHOOL_FEATURE_DISABLED, - 'feature FEATURE_VIDEOCONFERENCE_ENABLED is disabled', + 'feature FEATURE_VIDEOCONFERENCE_ENABLED is disabled' ); } @@ -264,7 +264,7 @@ export class VideoConferenceService { public async getUserRoleAndGuestStatusByUserIdForBbb( userId: string, scopeId: EntityId, - scope: VideoConferenceScope, + scope: VideoConferenceScope ): Promise<{ role: BBBRole; isGuest: boolean }> { const scopeInfo: ScopeInfo = await this.getScopeInfo(userId, scopeId, scope); @@ -277,7 +277,7 @@ export class VideoConferenceService { public async findVideoConferenceByScopeIdAndScope( scopeId: EntityId, - scope: VideoConferenceScope, + scope: VideoConferenceScope ): Promise { const videoConference: VideoConferenceDO = await this.videoConferenceRepo.findByScopeAndScopeId(scopeId, scope); @@ -287,7 +287,7 @@ export class VideoConferenceService { public async createOrUpdateVideoConferenceForScopeWithOptions( scopeId: EntityId, scope: VideoConferenceScope, - options: VideoConferenceOptions, + options: VideoConferenceOptions ): Promise { let vcDo: VideoConferenceDO; 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 fbe699c024..7f067e67f9 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 @@ -41,7 +41,7 @@ class VideoConferenceDeprecatedUcSpec extends VideoConferenceDeprecatedUc { async getScopeInfoSpec( userId: EntityId, conferenceScope: VideoConferenceScope, - refId: string, + refId: string ): Promise<{ scopeInfo: ScopeInfo; object: AuthorizableObject }> { return this.getScopeInfo(userId, conferenceScope, refId); } @@ -219,7 +219,7 @@ describe('VideoConferenceUc', () => { it('should throw on unknown scope', async () => { // Act & Assert await expect( - useCase.getScopeInfoSpec('userId', 'unknown' as VideoConferenceScope, 'someScopeId'), + useCase.getScopeInfoSpec('userId', 'unknown' as VideoConferenceScope, 'someScopeId') ).rejects.toThrow(BadRequestException); }); }); @@ -255,7 +255,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.checkPermissionSpec('userId', course)).rejects.toThrow( - new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION), + new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION) ); }); }); @@ -272,7 +272,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.throwOnFeaturesDisabledSpec('schoolId')).rejects.toThrow( - new ForbiddenException(ErrorStatus.SCHOOL_FEATURE_DISABLED), + new ForbiddenException(ErrorStatus.SCHOOL_FEATURE_DISABLED) ); }); @@ -282,7 +282,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.throwOnFeaturesDisabledSpec('schoolId')).rejects.toThrow( - new ForbiddenException(ErrorStatus.SCHOOL_FEATURE_DISABLED), + new ForbiddenException(ErrorStatus.SCHOOL_FEATURE_DISABLED) ); }); }); @@ -320,7 +320,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect( - useCase.create(defaultCurrentUser, VideoConferenceScope.COURSE, course.id, defaultOptions), + useCase.create(defaultCurrentUser, VideoConferenceScope.COURSE, course.id, defaultOptions) ).rejects.toThrow(new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION)); }); @@ -334,7 +334,7 @@ describe('VideoConferenceUc', () => { defaultCurrentUser, VideoConferenceScope.COURSE, course.id, - defaultOptions, + defaultOptions ); // Assert @@ -343,7 +343,7 @@ describe('VideoConferenceUc', () => { target: course.id, targetModel: VideoConferenceScope.COURSE, options: defaultOptions, - }), + }) ); expect(bbbService.create).toHaveBeenCalledWith(builder.build()); @@ -362,7 +362,7 @@ describe('VideoConferenceUc', () => { defaultCurrentUser, VideoConferenceScope.COURSE, course.id, - defaultOptions, + defaultOptions ); // Assert @@ -389,7 +389,7 @@ describe('VideoConferenceUc', () => { defaultCurrentUser, VideoConferenceScope.COURSE, course.id, - defaultOptions, + defaultOptions ); // Assert @@ -409,7 +409,7 @@ describe('VideoConferenceUc', () => { authorizationService.hasPermission.mockReturnValueOnce(false); await expect( - useCase.create(defaultCurrentUser, VideoConferenceScope.COURSE, course.id, defaultOptions), + useCase.create(defaultCurrentUser, VideoConferenceScope.COURSE, course.id, defaultOptions) ).rejects.toThrow(new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION)); }); }); @@ -461,7 +461,7 @@ describe('VideoConferenceUc', () => { const result: VideoConferenceJoin = await useCase.join( defaultCurrentUser, VideoConferenceScope.COURSE, - course.id, + course.id ); // Assert @@ -510,7 +510,7 @@ describe('VideoConferenceUc', () => { const result: VideoConferenceJoin = await useCase.join( defaultCurrentUser, VideoConferenceScope.COURSE, - course.id, + course.id ); // Assert @@ -557,14 +557,14 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.join(defaultCurrentUser, VideoConferenceScope.EVENT, eventId)).rejects.toThrow( - new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE), + new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE) ); }); it('should throw on unknown scope', async () => { // Act & Assert await expect( - useCase.join(defaultCurrentUser, 'unknown scope' as VideoConferenceScope, course.id), + useCase.join(defaultCurrentUser, 'unknown scope' as VideoConferenceScope, course.id) ).rejects.toThrow(BadRequestException); }); @@ -574,7 +574,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.join(defaultCurrentUser, VideoConferenceScope.EVENT, eventId)).rejects.toThrow( - new ForbiddenException(ErrorStatus.UNKNOWN_USER), + new ForbiddenException(ErrorStatus.UNKNOWN_USER) ); }); @@ -591,7 +591,7 @@ describe('VideoConferenceUc', () => { const result: VideoConferenceJoin = await useCase.join( defaultCurrentUser, VideoConferenceScope.COURSE, - course.id, + course.id ); // Assert @@ -625,7 +625,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.end(defaultCurrentUser, VideoConferenceScope.COURSE, course.id)).rejects.toThrow( - new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION), + new ForbiddenException(ErrorStatus.INSUFFICIENT_PERMISSION) ); }); @@ -637,7 +637,7 @@ describe('VideoConferenceUc', () => { const result: VideoConference = await useCase.end( defaultCurrentUser, VideoConferenceScope.COURSE, - course.id, + course.id ); // Assert @@ -741,7 +741,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.getMeetingInfo(defaultCurrentUser, VideoConferenceScope.EVENT, course.id)).rejects.toThrow( - new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE), + new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE) ); }); @@ -753,7 +753,7 @@ describe('VideoConferenceUc', () => { // Act & Assert await expect(useCase.getMeetingInfo(defaultCurrentUser, VideoConferenceScope.EVENT, course.id)).rejects.toThrow( - new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE), + new ForbiddenException(ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE) ); }); }); 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 12a7e2dff0..1a35ef35e8 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 @@ -50,7 +50,7 @@ export class VideoConferenceDeprecatedUc { private readonly courseService: CourseService, private readonly userService: UserService, private readonly calendarService: CalendarService, - private readonly schoolService: LegacySchoolService, + private readonly schoolService: LegacySchoolService ) { this.hostURL = Configuration.get('HOST') as string; } @@ -67,7 +67,7 @@ export class VideoConferenceDeprecatedUc { currentUser: ICurrentUser, conferenceScope: VideoConferenceScope, refId: EntityId, - options: VideoConferenceOptions, + options: VideoConferenceOptions ): Promise> { const { userId, schoolId } = currentUser; @@ -79,7 +79,7 @@ export class VideoConferenceDeprecatedUc { if (bbbRole !== BBBRole.MODERATOR) { throw new ForbiddenException( ErrorStatus.INSUFFICIENT_PERMISSION, - 'you are not allowed to start the videoconference. ask a moderator.', + 'you are not allowed to start the videoconference. ask a moderator.' ); } @@ -130,7 +130,7 @@ export class VideoConferenceDeprecatedUc { async join( currentUser: ICurrentUser, conferenceScope: VideoConferenceScope, - refId: EntityId, + refId: EntityId ): Promise { const { userId, schoolId } = currentUser; @@ -162,7 +162,7 @@ export class VideoConferenceDeprecatedUc { if (!vcDO.options.moderatorMustApproveJoinRequests && isGuest) { throw new ForbiddenException( ErrorStatus.GUESTS_CANNOT_JOIN_CONFERENCE, - 'Guests cannot join this conference, since the waiting room is not enabled.', + 'Guests cannot join this conference, since the waiting room is not enabled.' ); } @@ -185,7 +185,7 @@ export class VideoConferenceDeprecatedUc { async getMeetingInfo( currentUser: ICurrentUser, conferenceScope: VideoConferenceScope, - refId: EntityId, + refId: EntityId ): Promise { const { userId, schoolId } = currentUser; @@ -213,7 +213,7 @@ export class VideoConferenceDeprecatedUc { permission: PermissionMapping[bbbRole], bbbResponse, options: bbbRole === BBBRole.MODERATOR ? options : ({} as VideoConferenceOptions), - }), + }) ) .catch( () => @@ -221,7 +221,7 @@ export class VideoConferenceDeprecatedUc { state: VideoConferenceState.NOT_STARTED, permission: PermissionMapping[bbbRole], options: bbbRole === BBBRole.MODERATOR ? options : ({} as VideoConferenceOptions), - }), + }) ); const isGuest: boolean = await this.isExpert(currentUser, conferenceScope, scopeInfo.scopeId); @@ -262,7 +262,7 @@ export class VideoConferenceDeprecatedUc { async end( currentUser: ICurrentUser, conferenceScope: VideoConferenceScope, - refId: EntityId, + refId: EntityId ): Promise> { const { userId, schoolId } = currentUser; @@ -292,7 +292,7 @@ export class VideoConferenceDeprecatedUc { protected async isExpert( currentUser: ICurrentUser, conferenceScope: VideoConferenceScope, - scopeId: string, + scopeId: string ): Promise { switch (conferenceScope) { case VideoConferenceScope.COURSE: { @@ -303,7 +303,7 @@ export class VideoConferenceDeprecatedUc { case VideoConferenceScope.EVENT: { const team: TeamEntity = await this.teamsRepo.findById(scopeId); const teamUser: TeamUserEntity | undefined = team.teamUsers.find( - (userInTeam: TeamUserEntity) => userInTeam.user.id === currentUser.userId, + (userInTeam: TeamUserEntity) => userInTeam.user.id === currentUser.userId ); if (teamUser === undefined) { @@ -328,7 +328,7 @@ export class VideoConferenceDeprecatedUc { protected async getScopeInfo( userId: EntityId, conferenceScope: VideoConferenceScope, - refId: string, + refId: string ): Promise<{ scopeInfo: ScopeInfo; object: AuthorizableObject }> { switch (conferenceScope) { case VideoConferenceScope.COURSE: { @@ -391,7 +391,7 @@ export class VideoConferenceDeprecatedUc { private hasReadPermissions( user: User, object: AuthorizableObject, - permissions: Permission[], + permissions: Permission[] ): Map { const returnMap: Map = new Map(); permissions.forEach((permission) => { @@ -414,7 +414,7 @@ export class VideoConferenceDeprecatedUc { if (!Configuration.get('FEATURE_VIDEOCONFERENCE_ENABLED')) { throw new ForbiddenException( ErrorStatus.SCHOOL_FEATURE_DISABLED, - 'feature FEATURE_VIDEOCONFERENCE_ENABLED is disabled', + 'feature FEATURE_VIDEOCONFERENCE_ENABLED is disabled' ); } // throw, if the current users school does not have the feature enabled diff --git a/apps/server/src/shared/controller/transformer/polymorphic-array.transformer.spec.ts b/apps/server/src/shared/controller/transformer/polymorphic-array.transformer.spec.ts index 08ac53aa54..f2813d0a20 100644 --- a/apps/server/src/shared/controller/transformer/polymorphic-array.transformer.spec.ts +++ b/apps/server/src/shared/controller/transformer/polymorphic-array.transformer.spec.ts @@ -13,7 +13,7 @@ describe(PolymorphicArrayTransform.name, () => { class PolymorphicArrayDto { @PolymorphicArrayTransform( (obj: unknown): ClassConstructor => - typeof obj === 'object' && obj !== null && 'str' in obj ? Str : Num, + typeof obj === 'object' && obj !== null && 'str' in obj ? Str : Num ) input!: (Str | Num)[]; } diff --git a/apps/server/src/shared/repo/externaltool/external-tool.repo.ts b/apps/server/src/shared/repo/externaltool/external-tool.repo.ts index 0ae69c4caf..a277e722e4 100644 --- a/apps/server/src/shared/repo/externaltool/external-tool.repo.ts +++ b/apps/server/src/shared/repo/externaltool/external-tool.repo.ts @@ -59,7 +59,7 @@ export class ExternalToolRepo { { name }, { populate: ['thumbnail.fileRecord'], - }, + } ); if (entity !== null) { const domainObject: ExternalTool = this.mapEntityToDomainObject(entity); @@ -74,7 +74,7 @@ export class ExternalToolRepo { { config: { type } }, { populate: ['thumbnail.fileRecord'], - }, + } ); const domainObjects: ExternalTool[] = entities.map((entity: ExternalToolEntity): ExternalTool => { const domainObject: ExternalTool = this.mapEntityToDomainObject(entity); @@ -89,7 +89,7 @@ export class ExternalToolRepo { { config: { clientId } }, { populate: ['thumbnail.fileRecord'], - }, + } ); if (entity !== null) { const domainObject: ExternalTool = this.mapEntityToDomainObject(entity); @@ -106,7 +106,7 @@ export class ExternalToolRepo { }, { populate: ['thumbnail.fileRecord'], - }, + } ); if (entity !== null) { const domainObject: ExternalTool = this.mapEntityToDomainObject(entity); @@ -118,7 +118,7 @@ export class ExternalToolRepo { public async find(query: ExternalToolSearchQuery, options?: IFindOptions): Promise> { const pagination: Pagination = options?.pagination || {}; const order: QueryOrderMap = ExternalToolSortingMapper.mapDOSortOrderToQueryOrder( - options?.order || {}, + options?.order || {} ); const scope: Scope = new ExternalToolScope() .byName(query.name) @@ -140,7 +140,7 @@ export class ExternalToolRepo { limit: pagination?.limit, orderBy: order, populate: ['thumbnail.fileRecord'], - }, + } ); const entityDos: ExternalTool[] = entities.map((entity) => this.mapEntityToDomainObject(entity)); diff --git a/apps/server/src/shared/repo/user/user-do.repo.integration.spec.ts b/apps/server/src/shared/repo/user/user-do.repo.integration.spec.ts index 9a386bc372..c2a6e109f0 100644 --- a/apps/server/src/shared/repo/user/user-do.repo.integration.spec.ts +++ b/apps/server/src/shared/repo/user/user-do.repo.integration.spec.ts @@ -140,7 +140,7 @@ describe('UserRepo', () => { id: user.id, externalId: user.externalId, schoolId: school.id, - }), + }) ); }); @@ -178,7 +178,7 @@ describe('UserRepo', () => { it('should throw error', async () => { await expect(repo.findByExternalId(users[0].externalId as string, system.id)).rejects.toThrow( - new MultipleUsersFoundLoggableException(externalId), + new MultipleUsersFoundLoggableException(externalId) ); }); }); @@ -207,7 +207,7 @@ describe('UserRepo', () => { id: user.id, externalId: user.externalId, schoolId: school.id, - }), + }) ); }); @@ -215,7 +215,7 @@ describe('UserRepo', () => { it('should fail', async () => { await em.nativeDelete(User, {}); await expect(repo.findByExternalIdOrFail(user.externalId as string, system.id)).rejects.toThrow( - EntityNotFoundError, + EntityNotFoundError ); }); }); @@ -284,7 +284,7 @@ describe('UserRepo', () => { name: role.name, }), ], - }), + }) ); }); }); @@ -312,7 +312,7 @@ describe('UserRepo', () => { preferences: { firstLogin: true }, birthday: new Date(), }, - id.toHexString(), + id.toHexString() ); const role: Role = roleFactory.buildWithId(); testEntity.roles.add(role); @@ -364,7 +364,7 @@ describe('UserRepo', () => { lastLoginSystemChange: testEntity.lastLoginSystemChange, previousExternalId: testEntity.previousExternalId, birthday: testEntity.birthday, - }), + }) ); }); }); @@ -396,7 +396,7 @@ describe('UserRepo', () => { previousExternalId: 'someId', birthday: new Date(), }, - 'testId', + 'testId' ); const result: EntityData = repo.mapDOToEntityProperties(testDO); @@ -638,7 +638,7 @@ describe('UserRepo', () => { {}, expect.objectContaining>({ orderBy: expect.objectContaining>({ _id: options.order.id }) as QueryOrderMap, - }), + }) ); }); @@ -653,7 +653,7 @@ describe('UserRepo', () => { {}, expect.objectContaining>({ orderBy: expect.objectContaining>({}) as QueryOrderMap, - }), + }) ); }); }); @@ -681,7 +681,7 @@ describe('UserRepo', () => { expect.objectContaining({ offset: undefined, limit: undefined, - }), + }) ); }); }); @@ -794,7 +794,7 @@ describe('UserRepo', () => { }, expect.objectContaining>({ orderBy: expect.objectContaining>({}) as QueryOrderMap, - }), + }) ); }); }); diff --git a/apps/server/src/shared/repo/user/user-do.repo.ts b/apps/server/src/shared/repo/user/user-do.repo.ts index 0a92f6ac0a..9af2d20470 100644 --- a/apps/server/src/shared/repo/user/user-do.repo.ts +++ b/apps/server/src/shared/repo/user/user-do.repo.ts @@ -32,7 +32,7 @@ export class UserDORepo extends BaseDORepo { .whereLastLoginSystemChangeSmallerThan(query.lastLoginSystemChangeSmallerThan) .whereLastLoginSystemChangeIsBetween( query.lastLoginSystemChangeBetweenStart, - query.lastLoginSystemChangeBetweenEnd, + query.lastLoginSystemChangeBetweenEnd ) .withOutdatedSince(query.outdatedSince) .allowEmptyQuery(true); @@ -73,8 +73,8 @@ export class UserDORepo extends BaseDORepo { 'school.currentYear', 'school.name', 'secondarySchools.role', - ]), - ), + ]) + ) ); await Promise.all(users.map((user) => this.populateRoles(user.roles.getItems()))); } @@ -178,7 +178,7 @@ export class UserDORepo extends BaseDORepo { new SecondarySchoolReference({ schoolId: school.school.id, role: new RoleReference({ id: school.role.id, name: school.role.name }), - }), + }) ); } @@ -198,7 +198,7 @@ export class UserDORepo extends BaseDORepo { new UserSchoolEmbeddable({ school: this._em.getReference(SchoolEntity, secondarySchool.schoolId), role: this._em.getReference(Role, secondarySchool.role.id), - }), + }) ), ldapDn: entityDO.ldapDn, externalId: entityDO.externalId, @@ -223,7 +223,7 @@ export class UserDORepo extends BaseDORepo { }, { populate: ['roles', 'school.systems', 'school.currentYear', 'school.name', 'secondarySchools.role'], - }, + } ); const userDOs = users.map((user) => this.mapEntityToDO(user));