Skip to content

Commit

Permalink
Merge branch 'main' into N21-2285-update-media-activations-extension-1
Browse files Browse the repository at this point in the history
  • Loading branch information
sdinkov committed Jan 20, 2025
2 parents 5d6564c + 6768816 commit 163dc29
Show file tree
Hide file tree
Showing 175 changed files with 938 additions and 332 deletions.
40 changes: 33 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,24 @@ module.exports = {
'@typescript-eslint/explicit-member-accessibility': 'off',
},
},
{
files: ['apps/server/src/migrations/**/*.ts'],
rules: {
'@typescript-eslint/no-restricted-imports': [
'warn',
{
patterns: [
{
group: ['@apps/**', '@infra/**', '@shared/**', 'apps/server/src/migrations/**'],
message: 'apps/server/src/migrations may NOT import from @apps, @infra, @shared, or migrations',
},
],
},
],
'filename-rules/match': [1, 'PascalCase'],
'no-console': 'off',
},
},
{
files: ['apps/server/src/apps/**/*.ts'],
rules: {
Expand All @@ -158,8 +176,8 @@ module.exports = {
{
patterns: [
{
group: ['@apps/**', '@infra/**', '@shared/**'],
message: 'apps-modules may NOT import from @apps, @infra or @shared',
group: ['@apps/**', '@infra/**', '@shared/**', 'apps/server/src/migrations/**'],
message: 'apps-modules may NOT import from @apps, @infra, @shared, or migrations',
},
],
},
Expand All @@ -175,7 +193,7 @@ module.exports = {
patterns: [
{
group: ['@apps/**', '@core/**', '@infra/**', '@modules/**'],
message: 'core-modules may NOT import from @apps, @core, @infra or @modules',
message: 'core-modules may NOT import from @apps, @core, @infra, or @modules',
},
],
},
Expand All @@ -190,8 +208,8 @@ module.exports = {
{
patterns: [
{
group: ['@apps/**', '@core/**', '@modules/**'],
message: 'infra-modules may NOT import from @apps, @core or @modules',
group: ['@apps/**', '@core/**', '@modules/**', 'apps/server/src/migrations/**'],
message: 'infra-modules may NOT import from @apps, @core, @modules, or migrations',
},
],
},
Expand Down Expand Up @@ -222,8 +240,16 @@ module.exports = {
{
patterns: [
{
group: ['@apps/**', '@core/**', '@infra/**', '@modules/**', '@shared/**'],
message: 'shared modules may NOT import from @apps, @core, @infra, @modules or @shared',
group: [
'@apps/**',
'@core/**',
'@infra/**',
'@modules/**',
'@shared/**',
'apps/server/src/migrations/**',
],
message:
'shared modules may NOT import from @apps, @core, @infra, @modules, @shared, or migrations',
},
],
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: mongodb setup
uses: supercharge/mongodb-github-action@1.10.0
uses: supercharge/mongodb-github-action@1.12.0
- name: setup
uses: actions/setup-node@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:

- name: Build and push ${{ github.repository }}
if: ${{ env.IMAGE_EXISTS == 0 }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:

- name: Build and push ${{ github.repository }} (file preview)
if: ${{ env.IMAGE_EXISTS == 0 }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
build-args: |
BASE_IMAGE=ghcr.io/${{ github.repository }}:${{ needs.branch_meta.outputs.sha }}
Expand Down Expand Up @@ -172,7 +172,7 @@ jobs:
security-events: write
steps:
- name: run trivy vulnerability scanner
uses: aquasecurity/trivy-action@915b19bbe73b92a6cf82a1bc12b087c9a19a5fe2
uses: aquasecurity/trivy-action@0.29.0
with:
image-ref: 'ghcr.io/${{ github.repository }}:${{ needs.branch_meta.outputs.sha }}'
format: 'sarif'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and push ${{ github.repository }}
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
Expand All @@ -60,7 +60,7 @@ jobs:
labels: |
org.opencontainers.image.title=schulcloud-file-storage
- name: Build and push ${{ github.repository }} (file-storage)
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
build-args: |
BASE_IMAGE=quay.io/schulcloudverbund/schulcloud-server:${{ github.ref_name }}
Expand All @@ -81,14 +81,14 @@ jobs:
contents: write
steps:
- name: create sbom
uses: aquasecurity/trivy-action@1f6384b6ceecbbc6673526f865b818a2a06b07c9
uses: aquasecurity/trivy-action@0.29.0
with:
scan-type: 'image'
format: 'cyclonedx'
image-ref: 'docker.io/schulcloud/schulcloud-server:${{ github.ref_name }}'
output: 'dependency-results.sbom.json'
- name: create release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
body: 'refer to the schulcloud-client release notes https://github.com/hpi-schul-cloud/schulcloud-client/releases/'
files: dependency-results.sbom.json
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
uses: supercharge/mongodb-github-action@1.12.0
with:
mongodb-version: ${{ env.MONGODB_VERSION }}
- name: environment setup
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
uses: supercharge/mongodb-github-action@1.12.0
with:
mongodb-version: ${{ env.MONGODB_VERSION }}
- name: npm ci
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
distribution: 'temurin'
java-version: '17'
- name: SonarCloud upload coverage
uses: SonarSource/sonarcloud-github-action@v2.1.1
uses: SonarSource/sonarcloud-github-action@v4.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion apps/server/doc/file-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ This possibility should not be used for new features in Feathers, but it can hel
```TypeScript
// main.ts
async function bootstrap() {
async function bootstrap(): Promise<void> {
// (...)
feathersExpress.services['nest-rocket-chat'] = nestApp.get(RocketChatService);
// (...)
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/apps/admin-api-server.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { LegacyLogger, Logger } from '@src/core/logger';
import { AdminApiServerModule } from '@modules/server/admin-api.server.module';
import { AdminApiServerModule } from '@src/modules/server/admin-api.server.app.module';
import express from 'express';
import { install as sourceMapInstall } from 'source-map-support';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import {
AppStartLoggable,
enableOpenApiDocs,
addPrometheusMetricsMiddlewaresIfEnabled,
AppStartLoggable,
createAndStartPrometheusMetricsAppIfEnabled,
enableOpenApiDocs,
} from './helpers';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

const nestAdminServerExpress = express();
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/apps/board-collaboration.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { NestFactory } from '@nestjs/core';
import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { LegacyLogger, Logger } from '@src/core/logger';
import { RedisIoAdapter } from '@infra/socketio';

Check warning on line 9 in apps/server/src/apps/board-collaboration.app.ts

View workflow job for this annotation

GitHub Actions / nest_lint

'@infra/socketio' import is restricted from being used by a pattern. apps-modules may NOT import from @apps, @infra, @shared, or migrations
import { BoardCollaborationModule } from '@modules/board/board-collaboration.app.module';
import express from 'express';
import { ExpressAdapter } from '@nestjs/platform-express';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { LegacyLogger, Logger } from '@src/core/logger';
import express from 'express';
import {
enableOpenApiDocs,
addPrometheusMetricsMiddlewaresIfEnabled,
createAndStartPrometheusMetricsAppIfEnabled,
enableOpenApiDocs,
} from './helpers';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

const nestExpress = express();
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/apps/common-cartridge.app.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* istanbul ignore file */
/* eslint-disable no-console */
import { CommonCartridgeApiModule } from '@modules/common-cartridge/common-cartridge-api.app.module';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { LegacyLogger, Logger } from '@src/core/logger';
import { CommonCartridgeApiModule } from '@modules/common-cartridge/common-cartridge-api.module';
import express from 'express';
import { install as sourceMapInstall } from 'source-map-support';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import {
AppStartLoggable,
enableOpenApiDocs,
addPrometheusMetricsMiddlewaresIfEnabled,
AppStartLoggable,
createAndStartPrometheusMetricsAppIfEnabled,
enableOpenApiDocs,
} from './helpers';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

const nestExpress = express();
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/apps/files-storage-consumer.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import { NestFactory } from '@nestjs/core';

// register source-map-support for debugging
import { FilesStorageAMQPModule } from '@modules/files-storage/files-storage-amqp.module';
import { FilesStorageAMQPModule } from '@modules/files-storage/files-storage-amqp.app.module';
import { install as sourceMapInstall } from 'source-map-support';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

const nestApp = await NestFactory.create(FilesStorageAMQPModule);
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/apps/files-storage.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import express from 'express';
import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { FilesStorageApiModule } from '@modules/files-storage/files-storage-api.module';
import { FilesStorageApiModule } from '@modules/files-storage/files-storage-api.app.module';
import { API_VERSION_PATH } from '@modules/files-storage/files-storage.const';
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { LegacyLogger } from '@src/core/logger';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import { enableOpenApiDocs } from './helpers';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

// create the NestJS application on a seperate express instance
Expand Down
7 changes: 3 additions & 4 deletions apps/server/src/apps/fwu-learning-contents.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import express from 'express';
import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { FwuLearningContentsModule } from '@modules/fwu-learning-contents/fwu-learning-contents.app.module';
import { LegacyLogger } from '@src/core/logger';
import { FwuLearningContentsModule } from '@modules/fwu-learning-contents';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import { enableOpenApiDocs } from './helpers';
import { createRequestLoggerMiddleware, enableOpenApiDocs } from './helpers';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

// create the NestJS application on a seperate express instance
Expand Down
7 changes: 3 additions & 4 deletions apps/server/src/apps/h5p-editor.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import express from 'express';
import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { H5PEditorModule } from '@modules/h5p-editor/h5p-editor.app.module';
import { LegacyLogger } from '@src/core/logger';
import { H5PEditorModule } from '@modules/h5p-editor';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import { enableOpenApiDocs } from './helpers';
import { createRequestLoggerMiddleware, enableOpenApiDocs } from './helpers';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

// create the NestJS application on a seperate express instance
Expand Down
7 changes: 4 additions & 3 deletions apps/server/src/apps/h5p-library-management.app.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* istanbul ignore file */
/* eslint-disable no-console */
import { H5PLibraryManagementService } from '@modules/h5p-library-management';

Check warning on line 3 in apps/server/src/apps/h5p-library-management.app.ts

View workflow job for this annotation

GitHub Actions / nest_lint

Filename 'h5p-library-management.app.ts' does not match kebabcase
import { H5PLibraryManagementModule } from '@modules/h5p-library-management/h5p-library-management.app.module';
import { NestFactory } from '@nestjs/core';
import { install as sourceMapInstall } from 'source-map-support';
import { LegacyLogger } from '@src/core/logger';
import { H5PLibraryManagementModule, H5PLibraryManagementService } from '@modules/h5p-library-management';
import { install as sourceMapInstall } from 'source-map-support';

async function bootstrap() {
async function bootstrap(): Promise<void> {
sourceMapInstall();

const nestApp = await NestFactory.createApplicationContext(H5PLibraryManagementModule);
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/apps/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './app-start-loggable';
export * from './prometheus-metrics';
export * from './metrics';
export * from './request-logger-middleware';
export * from './swagger';
1 change: 1 addition & 0 deletions apps/server/src/apps/helpers/metrics/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './prometheus-metrics';
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { createMock } from '@golevelup/ts-jest';
import { Configuration } from '@hpi-schul-cloud/commons';
import { IConfig } from '@hpi-schul-cloud/commons/lib/interfaces/IConfig';
import { Logger } from '@src/core/logger';
import express, { Express, NextFunction, Request, RequestHandler, Response } from 'express';
import {
PrometheusMetricsConfig,
createAPIResponseTimeMetricMiddleware,
createPrometheusMetricsApp,
} from '@infra/metrics';
import { Logger } from '@src/core/logger';
import express, { Express, NextFunction, Request, RequestHandler, Response } from 'express';
} from './prometheus';
import {
PrometheusMetricsSetupState,
PrometheusMetricsSetupStateLoggable,
addPrometheusMetricsMiddlewaresIfEnabled,
createAndStartPrometheusMetricsAppIfEnabled,
} from './prometheus-metrics';

jest.mock('@infra/metrics', () => {
jest.mock('./prometheus', () => {
const moduleMock: unknown = {
...jest.requireActual('@infra/metrics'),
...jest.requireActual('./prometheus'),
createAPIResponseTimeMetricMiddleware: jest.fn(),
createPrometheusMetricsApp: jest.fn(),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Express } from 'express';

import { LogMessage, Loggable, Logger } from '@src/core/logger';
import { AppStartLoggable } from '../app-start-loggable';
import {
PrometheusMetricsConfig,
createAPIResponseTimeMetricMiddleware,
createPrometheusMetricsApp,
} from '@infra/metrics';
import { LogMessage, Loggable, Logger } from '@src/core/logger';
import { AppStartLoggable } from './app-start-loggable';
} from './prometheus';

export const enum PrometheusMetricsSetupState {
FEATURE_DISABLED_MIDDLEWARES_WILL_NOT_BE_CREATED = 'Prometheus metrics feature is disabled - no metrics middlewares will be added to the app',
Expand Down
File renamed without changes.
Loading

0 comments on commit 163dc29

Please sign in to comment.