Skip to content

Commit

Permalink
BC-8373 - Naming <name>.app.module.ts (#5427)
Browse files Browse the repository at this point in the history
  • Loading branch information
bergatco authored Jan 17, 2025
1 parent aa49b91 commit 0a87425
Show file tree
Hide file tree
Showing 101 changed files with 121 additions and 126 deletions.
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.
9 changes: 4 additions & 5 deletions apps/server/src/apps/management.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ import { NestFactory } from '@nestjs/core';
import { ExpressAdapter, NestExpressApplication } from '@nestjs/platform-express';
import express from 'express';

import { install as sourceMapInstall } from 'source-map-support';
import { LegacyLogger } from '@src/core/logger';
import { ManagementServerModule } from '@modules/management';
import { MikroORM } from '@mikro-orm/core';
import { ManagementServerModule } from '@modules/management/management-server.app.module';
import { LegacyLogger } from '@src/core/logger';
import { install as sourceMapInstall } from 'source-map-support';
import { createRequestLoggerMiddleware, enableOpenApiDocs } from './helpers';
import legacyAppPromise = require('../../../../src/app');
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import { enableOpenApiDocs } from './helpers';

async function bootstrap(): Promise<void> {
sourceMapInstall();
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/apps/preview-generator-consumer.app.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* istanbul ignore file */
/* eslint-disable no-console */
import { PreviewGeneratorAMQPModule } from '@modules/files-storage/files-preview-amqp.module';
import { PreviewGeneratorAMQPModule } from '@modules/files-storage/files-preview-amqp.app.module';
import { NestFactory } from '@nestjs/core';
import { install as sourceMapInstall } from 'source-map-support';

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

const nestApp = await NestFactory.create(PreviewGeneratorAMQPModule);
Expand Down
16 changes: 8 additions & 8 deletions apps/server/src/apps/server.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,35 @@ import { Mail, MailService } from '@infra/mail';
/* eslint-disable no-console */
import { MikroORM } from '@mikro-orm/core';
import { AccountService } from '@modules/account';
import { AccountUc } from '@modules/account/api/account.uc';
import { SystemRule } from '@modules/authorization-rules';
import { ColumnBoardService } from '@modules/board';
import { ContextExternalToolService } from '@modules/tool/context-external-tool';
import { CollaborativeStorageUc } from '@modules/collaborative-storage/uc/collaborative-storage.uc';
import { GroupService } from '@modules/group';
import { InternalServerModule } from '@modules/internal-server';
import { InternalServerModule } from '@modules/internal-server/internal-server.app.module';
import { RocketChatService } from '@modules/rocketchat';
import { FeathersRosterService } from '@modules/roster';
import { ServerModule } from '@modules/server';
import { ServerModule } from '@modules/server/server.app.module';
import { TeamService } from '@modules/teams/service/team.service';
import { ContextExternalToolService } from '@modules/tool/context-external-tool';
import { NestFactory } from '@nestjs/core';
import { ExpressAdapter } from '@nestjs/platform-express';
import { LegacyLogger, Logger } from '@src/core/logger';
import { AccountUc } from '@modules/account/api/account.uc';
import express from 'express';
import { join } from 'path';

// register source-map-support for debugging
import { install as sourceMapInstall } from 'source-map-support';
import { createRequestLoggerMiddleware } from './helpers/request-logger-middleware';
import {
AppStartLoggable,
enableOpenApiDocs,
addPrometheusMetricsMiddlewaresIfEnabled,
AppStartLoggable,
createAndStartPrometheusMetricsAppIfEnabled,
createRequestLoggerMiddleware,
enableOpenApiDocs,
} from './helpers';
import legacyAppPromise = require('../../../../src/app');

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

// create the NestJS application on a separate express instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { KeycloakModule } from '@infra/identity-management/keycloak/keycloak.mod
import KeycloakAdminClient from '@keycloak/keycloak-admin-client-cjs/keycloak-admin-client-cjs-index';
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
import { ObjectId } from '@mikro-orm/mongodb';
import { ServerModule } from '@modules/server';
import { ServerModule } from '@modules/server/server.app.module';
import { HttpModule } from '@nestjs/axios';
import { Test, TestingModule } from '@nestjs/testing';
import { IdmAccount, IdmAccountUpdate } from '@shared/domain/interface';
Expand Down
1 change: 0 additions & 1 deletion apps/server/src/infra/metrics/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { faker } from '@faker-js/faker';
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { User } from '@shared/domain/entity';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { EntityManager } from '@mikro-orm/core';
import { AccountEntity } from '@modules/account/domain/entity/account.entity';
import { accountFactory } from '@modules/account/testing';
import { OauthTokenResponse } from '@modules/oauth/service/dto';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { SystemEntity } from '@modules/system/entity';
import { HttpStatus, INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { EntityManager } from '@mikro-orm/mongodb';
import { OauthSessionTokenEntity } from '@modules/oauth/entity';
import { oauthSessionTokenEntityFactory } from '@modules/oauth/testing';
import { serverConfig, ServerConfig } from '@modules/server';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { systemOauthConfigFactory } from '@modules/system/testing';
import { CACHE_MANAGER } from '@nestjs/cache-manager';
import { ExecutionContext, HttpStatus, INestApplication } from '@nestjs/common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { CopyApiResponse, CopyElementType, CopyStatusEnum } from '@modules/copy-helper';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { accountFactory } from '@modules/account/testing';
import { GroupEntityTypes } from '@modules/group/entity';
import { roomMembershipEntityFactory } from '@modules/room-membership/testing';
import { roomEntityFactory } from '@modules/room/testing';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { Permission } from '@shared/domain/interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager, ObjectId } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager, ObjectId } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { ApiValidationError } from '@shared/common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { ApiValidationError } from '@shared/common';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { cleanupCollections } from '@testing/cleanup-collections';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EntityManager } from '@mikro-orm/mongodb';
import { ServerTestModule } from '@modules/server/server.module';
import { ServerTestModule } from '@modules/server/server.app.module';
import { INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { Permission, RoleName } from '@shared/domain/interface';
Expand Down
Loading

0 comments on commit 0a87425

Please sign in to comment.