Skip to content

Commit

Permalink
Merge branch 'main' into THR-35-library-management-service
Browse files Browse the repository at this point in the history
  • Loading branch information
casparneumann-cap committed Nov 8, 2023
2 parents 477bd25 + 33381e6 commit 05cd866
Show file tree
Hide file tree
Showing 468 changed files with 3,997 additions and 440 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'

end-to-end-tests:
needs:
- build_and_push
Expand Down
2 changes: 1 addition & 1 deletion apps/server/doc/summary.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
},
{
"title": "S3ClientModule",
"file": "../src/shared/infra/s3-client/README.md"
"file": "../src/infra/s3-client/README.md"
}
]
}
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/apps/helpers/prometheus-metrics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PrometheusMetricsConfig,
createAPIResponseTimeMetricMiddleware,
createPrometheusMetricsApp,
} from '@shared/infra/metrics';
} from '@infra/metrics';
import { Logger } from '@src/core/logger';
import express, { Express, NextFunction, Request, RequestHandler, Response } from 'express';
import {
Expand All @@ -15,9 +15,9 @@ import {
createAndStartPrometheusMetricsAppIfEnabled,
} from './prometheus-metrics';

jest.mock('@shared/infra/metrics', () => {
jest.mock('@infra/metrics', () => {
const moduleMock: unknown = {
...jest.requireActual('@shared/infra/metrics'),
...jest.requireActual('@infra/metrics'),
createAPIResponseTimeMetricMiddleware: jest.fn(),
createPrometheusMetricsApp: jest.fn(),
};
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/helpers/prometheus-metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
PrometheusMetricsConfig,
createAPIResponseTimeMetricMiddleware,
createPrometheusMetricsApp,
} from '@shared/infra/metrics';
} from '@infra/metrics';
import { LogMessage, Loggable, Logger } from '@src/core/logger';
import { AppStartLoggable } from './app-start-loggable';

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/server.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MikroORM } from '@mikro-orm/core';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { enableOpenApiDocs } from '@shared/controller/swagger';
import { Mail, MailService } from '@shared/infra/mail';
import { Mail, MailService } from '@infra/mail';
import { LegacyLogger, Logger } from '@src/core/logger';
import { AccountService } from '@modules/account/services/account.service';
import { TeamService } from '@modules/teams/service/team.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { INestApplicationContext } from '@nestjs/common';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { ServerConsoleModule } from '@src/console/console.module';
import { CommanderError } from 'commander';
import { BootstrapConsole, ConsoleService } from 'nestjs-console';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { INestApplicationContext } from '@nestjs/common';

import { BootstrapConsole, ConsoleService } from 'nestjs-console';
import { ServerConsoleModule } from '@src/console/console.module';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { execute, TestBootstrapConsole } from './test-bootstrap.console';

describe('ServerConsole (API)', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/console/api-test/test-bootstrap.console.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createMock } from '@golevelup/ts-jest';
import { Test, TestingModule } from '@nestjs/testing';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { DatabaseManagementUc } from '@modules/management/uc/database-management.uc';
import { AbstractBootstrapConsole, BootstrapConsole } from 'nestjs-console';

Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/console/console.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { MikroOrmModule } from '@mikro-orm/nestjs';
import { Module, NotFoundException } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { ALL_ENTITIES } from '@shared/domain';
import { ConsoleWriterModule } from '@shared/infra/console/console-writer/console-writer.module';
import { KeycloakModule } from '@shared/infra/identity-management/keycloak/keycloak.module';
import { ConsoleWriterModule } from '@infra/console/console-writer/console-writer.module';
import { KeycloakModule } from '@infra/identity-management/keycloak/keycloak.module';
import { DB_PASSWORD, DB_URL, DB_USERNAME, createConfigModuleOptions } from '@src/config';
import { FilesModule } from '@modules/files';
import { FileEntity } from '@modules/files/entity';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/console/server.console.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { ServerConsoleModule } from './console.module';
import { ServerConsole } from './server.console';

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/console/server.console.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */
import { Command, Console } from 'nestjs-console';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';

@Console({ command: 'server', description: 'sample server console' })
export class ServerConsole {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/error/filter/global-error.filter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArgumentsHost, Catch, ExceptionFilter, HttpException, InternalServerErrorException } from '@nestjs/common';
import { ApiValidationError, BusinessError } from '@shared/common';
import { IError, RpcMessage } from '@shared/infra/rabbitmq/rpc-message';
import { IError, RpcMessage } from '@infra/rabbitmq/rpc-message';
import { ErrorLogger, Loggable } from '@src/core/logger';
import { LoggingUtils } from '@src/core/logger/logging.utils';
import { Response } from 'express';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './antivirus';
export * from './antivirus';
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Module } from '@nestjs/common';
import { HttpModule } from '@nestjs/axios';
import { CalendarService } from '@shared/infra/calendar/service/calendar.service';
import { CalendarMapper } from '@shared/infra/calendar/mapper/calendar.mapper';
import { CalendarService } from './service/calendar.service';
import { CalendarMapper } from './mapper/calendar.mapper';

@Module({
imports: [HttpModule],
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ICalendarEvent } from '@shared/infra/calendar/interface/calendar-event.interface';
import { ICalendarEvent } from '@infra/calendar/interface/calendar-event.interface';
import { Test, TestingModule } from '@nestjs/testing';
import { CalendarMapper } from '@shared/infra/calendar/mapper/calendar.mapper';
import { CalendarMapper } from './calendar.mapper';

describe('CalendarMapper', () => {
let module: TestingModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ICalendarEvent } from '@shared/infra/calendar/interface/calendar-event.interface';
import { ICalendarEvent } from '@infra/calendar/interface/calendar-event.interface';
import { Injectable } from '@nestjs/common';
import { CalendarEventDto } from '@shared/infra/calendar/dto/calendar-event.dto';
import { CalendarEventDto } from '../dto/calendar-event.dto';

@Injectable()
export class CalendarMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { HttpService } from '@nestjs/axios';
import { InternalServerErrorException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { CalendarEventDto, CalendarService } from '@shared/infra/calendar';
import { ICalendarEvent } from '@shared/infra/calendar/interface/calendar-event.interface';
import { CalendarMapper } from '@shared/infra/calendar/mapper/calendar.mapper';
import { CalendarEventDto, CalendarService } from '@infra/calendar';
import { axiosResponseFactory } from '@shared/testing';
import { AxiosResponse } from 'axios';
import { of, throwError } from 'rxjs';
import { CalendarMapper } from '../mapper/calendar.mapper';
import { ICalendarEvent } from '../interface/calendar-event.interface';

describe('CalendarServiceSpec', () => {
let module: TestingModule;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { HttpService } from '@nestjs/axios';
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { EntityId } from '@shared/domain';
import { CalendarEventDto } from '@shared/infra/calendar/dto/calendar-event.dto';
import { CalendarMapper } from '@shared/infra/calendar/mapper/calendar.mapper';
import { ErrorUtils } from '@src/core/error/utils';
import { AxiosRequestConfig, AxiosResponse } from 'axios';
import { Observable, firstValueFrom } from 'rxjs';
import { URL, URLSearchParams } from 'url';
import { CalendarMapper } from '../mapper/calendar.mapper';
import { CalendarEventDto } from '../dto/calendar-event.dto';
import { ICalendarEvent } from '../interface/calendar-event.interface';

@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { HttpModule } from '@nestjs/axios';
import { Module, Provider } from '@nestjs/common';
import { CollaborativeStorageAdapterMapper } from '@shared/infra/collaborative-storage/mapper/collaborative-storage-adapter.mapper';
import { NextcloudClient } from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.client';
import { NextcloudStrategy } from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy';
import { LtiToolRepo } from '@shared/repo/ltitool/';
import { LoggerModule } from '@src/core/logger';
import { ToolModule } from '@modules/tool';
import { PseudonymModule } from '@modules/pseudonym';
import { UserModule } from '@modules/user';
import { NextcloudStrategy } from './strategy/nextcloud/nextcloud.strategy';
import { NextcloudClient } from './strategy/nextcloud/nextcloud.client';
import { CollaborativeStorageAdapterMapper } from './mapper';
import { CollaborativeStorageAdapter } from './collaborative-storage.adapter';

const storageStrategy: Provider = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { createMock } from '@golevelup/ts-jest';
import { ObjectId } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
import { RoleName } from '@shared/domain';
import { CollaborativeStorageAdapter } from '@shared/infra/collaborative-storage/collaborative-storage.adapter';
import { CollaborativeStorageAdapterMapper } from '@shared/infra/collaborative-storage/mapper/collaborative-storage-adapter.mapper';
import { ICollaborativeStorageStrategy } from '@shared/infra/collaborative-storage/strategy/base.interface.strategy';
import { LegacyLogger } from '@src/core/logger';
import { TeamDto } from '@modules/collaborative-storage/services/dto/team.dto';
import { TeamDto } from '@modules/collaborative-storage/services/dto/team.dto'; // invalid import please fix
import { CollaborativeStorageAdapter } from './collaborative-storage.adapter';
import { CollaborativeStorageAdapterMapper } from './mapper/collaborative-storage-adapter.mapper';
import { ICollaborativeStorageStrategy } from './strategy/base.interface.strategy';

class TestStrategy implements ICollaborativeStorageStrategy {
baseURL: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { TeamPermissionsDto } from '@modules/collaborative-storage/services/dto/team-permissions.dto';
import { TeamDto } from '@modules/collaborative-storage/services/dto/team.dto';
import { ICollaborativeStorageStrategy } from '@shared/infra/collaborative-storage/strategy/base.interface.strategy';
import { Inject, Injectable } from '@nestjs/common';
import { CollaborativeStorageAdapterMapper } from '@shared/infra/collaborative-storage/mapper/collaborative-storage-adapter.mapper';
import { LegacyLogger } from '@src/core/logger';
import { RoleDto } from '@modules/role/service/dto/role.dto';
import { CollaborativeStorageAdapterMapper } from './mapper/collaborative-storage-adapter.mapper';
import { ICollaborativeStorageStrategy } from './strategy/base.interface.strategy';

/**
* Provides an Adapter to an external collaborative storage.
Expand Down
2 changes: 2 additions & 0 deletions apps/server/src/infra/collaborative-storage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { CollaborativeStorageAdapter } from './collaborative-storage.adapter';
export { CollaborativeStorageAdapterModule } from './collaborative-storage-adapter.module';
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Test, TestingModule } from '@nestjs/testing';
import { RoleName } from '@shared/domain';
import { CollaborativeStorageAdapterMapper } from '@shared/infra/collaborative-storage/mapper/collaborative-storage-adapter.mapper';
import { CollaborativeStorageAdapterMapper } from '@infra/collaborative-storage/mapper/collaborative-storage-adapter.mapper';

describe('TeamStorage Mapper', () => {
let module: TestingModule;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './collaborative-storage-adapter.mapper';
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ObjectId } from '@mikro-orm/mongodb';
import { HttpService } from '@nestjs/axios';
import { NotFoundException, NotImplementedException, UnprocessableEntityException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { NextcloudClient } from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.client';
import { axiosResponseFactory } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AxiosResponse } from 'axios';
import { Observable, of } from 'rxjs';
import { NextcloudClient } from './nextcloud.client';
import {
GroupUsers,
GroupfoldersCreated,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
NextcloudGroups,
OcsResponse,
SuccessfulRes,
} from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.interface';
} from '@infra/collaborative-storage/strategy/nextcloud/nextcloud.interface';
import { ErrorUtils } from '@src/core/error/utils';
import { LegacyLogger } from '@src/core/logger';
import { AxiosRequestConfig, AxiosResponse } from 'axios';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import { UnprocessableEntityException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { LtiPrivacyPermission, LtiRoleType, Pseudonym, RoleName, User, UserDO } from '@shared/domain';
import { LtiToolDO } from '@shared/domain/domainobject/ltitool.do';
import { TeamRolePermissionsDto } from '@shared/infra/collaborative-storage/dto/team-role-permissions.dto';
import { NextcloudClient } from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.client';
import { NextcloudStrategy } from '@shared/infra/collaborative-storage/strategy/nextcloud/nextcloud.strategy';
import { LtiToolRepo } from '@shared/repo';
import { ltiToolDOFactory, pseudonymFactory, setupEntities, userDoFactory, userFactory } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { TeamDto, TeamUserDto } from '@modules/collaborative-storage/services/dto/team.dto';
import { PseudonymService } from '@modules/pseudonym';
import { ExternalToolService } from '@modules/tool/external-tool/service';
import { UserService } from '@modules/user';
import { NextcloudStrategy } from './nextcloud.strategy';
import { NextcloudClient } from './nextcloud.client';
import { TeamRolePermissionsDto } from '../../dto/team-role-permissions.dto';

class NextcloudStrategySpec extends NextcloudStrategy {
static specGenerateGroupId(dto: TeamRolePermissionsDto): string {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { DatabaseManagementModule } from './database-management.module';
import { DatabaseManagementService } from './database-management.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MikroORM } from '@mikro-orm/core';
import { Test, TestingModule } from '@nestjs/testing';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { ObjectId } from 'mongodb';
import { DatabaseManagementService } from './database-management.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from './encryption.module';
export * from './encryption.interface';
export * from './encryption.service';
export * from './encryption.module';
export * from './encryption.interface';
export * from './encryption.service';
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { ConfigModule } from '@nestjs/config';
import { IdentityManagementService } from './identity-management.service';
import { IdentityManagementModule } from './identity-management.module';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { Test, TestingModule } from '@nestjs/testing';
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { LegacyLogger } from '@src/core/logger';
import { KeycloakConfigurationUc } from '../uc/keycloak-configuration.uc';
import { KeycloakConsole } from './keycloak-configuration.console';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConsoleWriterService } from '@shared/infra/console';
import { ConsoleWriterService } from '@infra/console';
import { LegacyLogger } from '@src/core/logger';
import { Command, CommandOption, Console } from 'nestjs-console';
import { KeycloakConfigurationUc } from '../uc/keycloak-configuration.uc';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Test, TestingModule } from '@nestjs/testing';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { ConfigModule } from '@nestjs/config';
import { KeycloakConfigurationModule } from './keycloak-configuration.module';
import { KeycloakConsole } from './console/keycloak-configuration.console';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Module } from '@nestjs/common';
import { LoggerModule } from '@src/core/logger';
import { EncryptionModule } from '@shared/infra/encryption';
import { ConsoleWriterModule } from '@shared/infra/console';
import { EncryptionModule } from '@infra/encryption';
import { ConsoleWriterModule } from '@infra/console';
import { AccountModule } from '@modules/account';
import { SystemModule } from '@modules/system';
import { KeycloakAdministrationModule } from '../keycloak-administration/keycloak-administration.module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createMock } from '@golevelup/ts-jest';
import IdentityProviderRepresentation from '@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation';
import { ObjectId } from '@mikro-orm/mongodb';
import { Test, TestingModule } from '@nestjs/testing';
import { DefaultEncryptionService, SymetricKeyEncryptionService } from '@shared/infra/encryption';
import { DefaultEncryptionService, SymetricKeyEncryptionService } from '@infra/encryption';
import { OidcConfigDto } from '@modules/system/service';
import { OidcIdentityProviderMapper } from './identity-provider.mapper';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import IdentityProviderRepresentation from '@keycloak/keycloak-admin-client/lib/defs/identityProviderRepresentation';
import { Inject } from '@nestjs/common';
import { DefaultEncryptionService, IEncryptionService } from '@shared/infra/encryption';
import { DefaultEncryptionService, IEncryptionService } from '@infra/encryption';
import { OidcConfigDto } from '@modules/system/service';

export class OidcIdentityProviderMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import AuthenticationExecutionExportRepresentation from '@keycloak/keycloak-admi
import AuthenticationFlowRepresentation from '@keycloak/keycloak-admin-client/lib/defs/authenticationFlowRepresentation';
import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { MongoMemoryDatabaseModule } from '@shared/infra/database';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { SystemRepo } from '@shared/repo/system/system.repo';
import { systemFactory } from '@shared/testing/factory';
import { LoggerModule } from '@src/core/logger';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { HttpService } from '@nestjs/axios';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { SystemEntity, SystemTypeEnum } from '@shared/domain';
import { SymetricKeyEncryptionService } from '@shared/infra/encryption';
import { SymetricKeyEncryptionService } from '@infra/encryption';
import { systemFactory } from '@shared/testing';
import { SystemOidcMapper } from '@modules/system/mapper/system-oidc.mapper';
import { SystemOidcService } from '@modules/system/service/system-oidc.service';
Expand Down
Loading

0 comments on commit 05cd866

Please sign in to comment.