Skip to content

Commit

Permalink
BC-2804 remap imports modules folder (#4468)
Browse files Browse the repository at this point in the history
* update tsconfig, remove index file
* split imports from bundles import @module
* update jest config to support @modules path
* mass change imports
  • Loading branch information
EzzatOmar authored Oct 20, 2023
1 parent 0ab2dfb commit fc68ac0
Show file tree
Hide file tree
Showing 478 changed files with 1,121 additions and 1,155 deletions.
2 changes: 1 addition & 1 deletion apps/server/src/apps/files-storage-consumer.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { NestFactory } from '@nestjs/core';

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

async function bootstrap() {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/files-storage.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { install as sourceMapInstall } from 'source-map-support';
// application imports
import { SwaggerDocumentOptions } from '@nestjs/swagger';
import { LegacyLogger } from '@src/core/logger';
import { API_VERSION_PATH, FilesStorageApiModule } from '@src/modules/files-storage';
import { API_VERSION_PATH, FilesStorageApiModule } from '@modules/files-storage';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';

async function bootstrap() {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/fwu-learning-contents.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { LegacyLogger } from '@src/core/logger';
import { FwuLearningContentsModule } from '@src/modules/fwu-learning-contents';
import { FwuLearningContentsModule } from '@modules/fwu-learning-contents';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';

async function bootstrap() {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/h5p-editor.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { LegacyLogger } from '@src/core/logger';
import { H5PEditorModule } from '@src/modules/h5p-editor';
import { H5PEditorModule } from '@modules/h5p-editor';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';

async function bootstrap() {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/apps/management.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { install as sourceMapInstall } from 'source-map-support';

// application imports
import { LegacyLogger } from '@src/core/logger';
import { ManagementServerModule } from '@src/modules/management';
import { ManagementServerModule } from '@modules/management';
import { enableOpenApiDocs } from '@src/shared/controller/swagger';

async function bootstrap() {
Expand Down
18 changes: 9 additions & 9 deletions apps/server/src/apps/server.app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import { ExpressAdapter } from '@nestjs/platform-express';
import { enableOpenApiDocs } from '@shared/controller/swagger';
import { Mail, MailService } from '@shared/infra/mail';
import { LegacyLogger, Logger } from '@src/core/logger';
import { AccountService } from '@src/modules/account/services/account.service';
import { TeamService } from '@src/modules/teams/service/team.service';
import { AccountValidationService } from '@src/modules/account/services/account.validation.service';
import { AccountUc } from '@src/modules/account/uc/account.uc';
import { CollaborativeStorageUc } from '@src/modules/collaborative-storage/uc/collaborative-storage.uc';
import { GroupService } from '@src/modules/group';
import { RocketChatService } from '@src/modules/rocketchat';
import { ServerModule } from '@src/modules/server';
import { AccountService } from '@modules/account/services/account.service';
import { TeamService } from '@modules/teams/service/team.service';
import { AccountValidationService } from '@modules/account/services/account.validation.service';
import { AccountUc } from '@modules/account/uc/account.uc';
import { CollaborativeStorageUc } from '@modules/collaborative-storage/uc/collaborative-storage.uc';
import { GroupService } from '@modules/group';
import { RocketChatService } from '@modules/rocketchat';
import { ServerModule } from '@modules/server';
import express from 'express';
import { join } from 'path';

// register source-map-support for debugging
import { install as sourceMapInstall } from 'source-map-support';
import { FeathersRosterService } from '@src/modules/pseudonym';
import { FeathersRosterService } from '@modules/pseudonym';
import legacyAppPromise = require('../../../../src/app');

import { AppStartLoggable } from './helpers/app-start-loggable';
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,7 +1,7 @@
import { createMock } from '@golevelup/ts-jest';
import { Test, TestingModule } from '@nestjs/testing';
import { ConsoleWriterService } from '@shared/infra/console';
import { DatabaseManagementUc } from '@src/modules/management/uc/database-management.uc';
import { DatabaseManagementUc } from '@modules/management/uc/database-management.uc';
import { AbstractBootstrapConsole, BootstrapConsole } from 'nestjs-console';

export class TestBootstrapConsole extends AbstractBootstrapConsole<TestingModule> {
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/console/console.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ 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 { DB_PASSWORD, DB_URL, DB_USERNAME, createConfigModuleOptions } from '@src/config';
import { FilesModule } from '@src/modules/files';
import { FileEntity } from '@src/modules/files/entity';
import { FileRecord } from '@src/modules/files-storage/entity';
import { ManagementModule } from '@src/modules/management/management.module';
import { serverConfig } from '@src/modules/server';
import { FilesModule } from '@modules/files';
import { FileEntity } from '@modules/files/entity';
import { FileRecord } from '@modules/files-storage/entity';
import { ManagementModule } from '@modules/management/management.module';
import { serverConfig } from '@modules/server';
import { ConsoleModule } from 'nestjs-console';
import { ServerConsole } from './server.console';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Body, Controller, Delete, Get, Param, Patch, Query } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { EntityNotFoundError, ForbiddenOperationError, ValidationError } from '@shared/common';
import { ICurrentUser, Authenticate, CurrentUser } from '@src/modules/authentication';
import { ICurrentUser } from '@modules/authentication';
import { Authenticate, CurrentUser } from '@modules/authentication/decorator/auth.decorator';
import { AccountUc } from '../uc/account.uc';
import {
AccountByIdBodyParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
AccountSearchType,
PatchMyAccountParams,
PatchMyPasswordParams,
} from '@src/modules/account/controller/dto';
import { ServerTestModule } from '@src/modules/server/server.module';
} from '@modules/account/controller/dto';
import { ServerTestModule } from '@modules/server/server.module';

describe('Account Controller (API)', () => {
const basePath = '/account';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account } from '@shared/domain';
import { AccountDto } from '@src/modules/account/services/dto/account.dto';
import { AccountDto } from '@modules/account/services/dto/account.dto';
import { accountDtoFactory, accountFactory } from '@shared/testing';
import { AccountResponseMapper } from '.';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Account } from '@shared/domain';
import { AccountDto } from '@src/modules/account/services/dto/account.dto';
import { AccountDto } from '@modules/account/services/dto/account.dto';
import { AccountResponse } from '../controller/dto';

export class AccountResponseMapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { EntityNotFoundError } from '@shared/common';
import { Account, EntityId } from '@shared/domain';
import { IdentityManagementService } from '@shared/infra/identity-management/identity-management.service';
import { accountFactory, setupEntities, userFactory } from '@shared/testing';
import { AccountEntityToDtoMapper } from '@src/modules/account/mapper';
import { AccountDto } from '@src/modules/account/services/dto';
import { IServerConfig } from '@src/modules/server';
import { AccountEntityToDtoMapper } from '@modules/account/mapper';
import { AccountDto } from '@modules/account/services/dto';
import { IServerConfig } from '@modules/server';
import bcrypt from 'bcryptjs';
import { LegacyLogger } from '../../../core/logger';
import { AccountRepo } from '../repo/account.repo';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { IdmAccount } from '@shared/domain';
import { KeycloakAdministrationService } from '@shared/infra/identity-management/keycloak-administration/service/keycloak-administration.service';
import { AccountSaveDto } from '@src/modules/account/services/dto';
import { AccountSaveDto } from '@modules/account/services/dto';
import { LoggerModule } from '@src/core/logger';
import { IdentityManagementModule } from '@shared/infra/identity-management';
import { IdentityManagementService } from '../../../shared/infra/identity-management/identity-management.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { EntityId } from '@shared/domain';
import { IdentityManagementService } from '@shared/infra/identity-management';
import { IServerConfig } from '@src/modules/server/server.config';
import { IServerConfig } from '@modules/server/server.config';
import { ObjectId } from 'bson';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { IServerConfig } from '@src/modules/server';
import { IServerConfig } from '@modules/server';
import { LegacyLogger } from '../../../core/logger';
import { AccountServiceDb } from './account-db.service';
import { AccountServiceIdm } from './account-idm.service';
Expand Down
8 changes: 4 additions & 4 deletions apps/server/src/modules/account/uc/account.uc.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import {
import { UserRepo } from '@shared/repo';
import { accountFactory, schoolFactory, setupEntities, systemFactory, userFactory } from '@shared/testing';
import { BruteForcePrevention } from '@src/imports-from-feathers';
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountSaveDto } from '@src/modules/account/services/dto';
import { AccountDto } from '@src/modules/account/services/dto/account.dto';
import { ICurrentUser } from '@src/modules/authentication';
import { AccountService } from '@modules/account/services/account.service';
import { AccountSaveDto } from '@modules/account/services/dto';
import { AccountDto } from '@modules/account/services/dto/account.dto';
import { ICurrentUser } from '@modules/authentication';
import { ObjectId } from 'bson';
import {
AccountByIdBodyParams,
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/modules/account/uc/account.uc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
import { Account, EntityId, Permission, PermissionService, Role, RoleName, SchoolEntity, User } from '@shared/domain';
import { UserRepo } from '@shared/repo';
// TODO: module internals should be imported with relative paths
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountDto } from '@src/modules/account/services/dto/account.dto';
import { AccountService } from '@modules/account/services/account.service';
import { AccountDto } from '@modules/account/services/dto/account.dto';

import { BruteForcePrevention } from '@src/imports-from-feathers';
import { ICurrentUser } from '@src/modules/authentication';
import { ICurrentUser } from '@modules/authentication';
import { ObjectId } from 'bson';
import { IAccountConfig } from '../account-config';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import { CacheWrapperModule } from '@shared/infra/cache';
import { IdentityManagementModule } from '@shared/infra/identity-management';
import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo';
import { LoggerModule } from '@src/core/logger';
import { AccountModule } from '@src/modules/account';
import { OauthModule } from '@src/modules/oauth/oauth.module';
import { RoleModule } from '@src/modules/role';
import { SystemModule } from '@src/modules/system';
import { AccountModule } from '@modules/account';
import { OauthModule } from '@modules/oauth/oauth.module';
import { RoleModule } from '@modules/role';
import { SystemModule } from '@modules/system';
import { Algorithm, SignOptions } from 'jsonwebtoken';
import { jwtConstants } from './constants';
import { AuthenticationService } from './services/authentication.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { HttpStatus, INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { Account, RoleName, SchoolEntity, SystemEntity, User } from '@shared/domain';
import { accountFactory, roleFactory, schoolFactory, systemFactory, userFactory } from '@shared/testing';
import { SSOErrorCode } from '@src/modules/oauth/loggable';
import { OauthTokenResponse } from '@src/modules/oauth/service/dto';
import { ServerTestModule } from '@src/modules/server/server.module';
import { SSOErrorCode } from '@modules/oauth/loggable';
import { OauthTokenResponse } from '@modules/oauth/service/dto';
import { ServerTestModule } from '@modules/server/server.module';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import crypto, { KeyPairKeyObjectResult } from 'crypto';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { Controller, ExecutionContext, ForbiddenException, Get, INestApplication } from '@nestjs/common';
import request from 'supertest';
import { Test, TestingModule } from '@nestjs/testing';
import { ICurrentUser } from '@src/modules/authentication';
import { ServerTestModule } from '@src/modules/server/server.module';
import { ICurrentUser } from '@modules/authentication';
import { ServerTestModule } from '@modules/server/server.module';
import { JwtAuthGuard } from '../guard/jwt-auth.guard';
import { Authenticate, CurrentUser, JWT } from './auth.decorator';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { JwtService } from '@nestjs/jwt';
import { Test, TestingModule } from '@nestjs/testing';
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountDto } from '@src/modules/account/services/dto';
import { ICurrentUser } from '@src/modules/authentication';
import { AccountService } from '@modules/account/services/account.service';
import { AccountDto } from '@modules/account/services/dto';
import { ICurrentUser } from '@modules/authentication';
import jwt from 'jsonwebtoken';
import { BruteForceError } from '../errors/brute-force.error';
import { JwtValidationAdapter } from '../strategy/jwt-validation.adapter';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { JwtService } from '@nestjs/jwt';
import { AccountService } from '@src/modules/account';
import { AccountService } from '@modules/account';
// invalid import
import { AccountDto } from '@src/modules/account/services/dto';
import { AccountDto } from '@modules/account/services/dto';
// invalid import, can produce dependency cycles
import type { IServerConfig } from '@src/modules/server';
import type { IServerConfig } from '@modules/server';
import { randomUUID } from 'crypto';
import jwt, { JwtPayload } from 'jsonwebtoken';
import { JwtValidationAdapter } from '../strategy/jwt-validation.adapter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
userFactory,
} from '@shared/testing';
import { Logger } from '@src/core/logger';
import { AccountDto } from '@src/modules/account/services/dto';
import { AccountDto } from '@modules/account/services/dto';
import { LdapAuthorizationBodyParams } from '../controllers/dto';
import { ICurrentUser } from '../interface';
import { AuthenticationService } from '../services/authentication.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { LegacySchoolDo, SystemEntity, User } from '@shared/domain';
import { LegacySchoolRepo, SystemRepo, UserRepo } from '@shared/repo';
import { ErrorLoggable } from '@src/core/error/loggable/error.loggable';
import { Logger } from '@src/core/logger';
import { AccountDto } from '@src/modules/account/services/dto';
import { AccountDto } from '@modules/account/services/dto';
import { Strategy } from 'passport-custom';
import { LdapAuthorizationBodyParams } from '../controllers/dto';
import { ICurrentUser } from '../interface';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { RoleName, User } from '@shared/domain';
import { IdentityManagementOauthService } from '@shared/infra/identity-management';
import { UserRepo } from '@shared/repo';
import { accountFactory, setupEntities, userFactory } from '@shared/testing';
import { AccountEntityToDtoMapper } from '@src/modules/account/mapper';
import { AccountDto } from '@src/modules/account/services/dto';
import { IServerConfig } from '@src/modules/server';
import { AccountEntityToDtoMapper } from '@modules/account/mapper';
import { AccountDto } from '@modules/account/services/dto';
import { IServerConfig } from '@modules/server';
import bcrypt from 'bcryptjs';
import { AuthenticationService } from '../services/authentication.service';
import { LocalStrategy } from './local.strategy';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { PassportStrategy } from '@nestjs/passport';
import { Injectable, UnauthorizedException } from '@nestjs/common';
import bcrypt from 'bcryptjs';
import { UserRepo } from '@shared/repo';
import { AccountDto } from '@src/modules/account/services/dto';
import { AccountDto } from '@modules/account/services/dto';
import { GuardAgainst } from '@shared/common/utils/guard-against';
import { IdentityManagementOauthService, IIdentityManagementConfig } from '@shared/infra/identity-management';
import { CurrentUserMapper } from '../mapper';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { Test, TestingModule } from '@nestjs/testing';
import { EntityId, RoleName } from '@shared/domain';
import { UserDO } from '@shared/domain/domainobject/user.do';
import { userDoFactory } from '@shared/testing';
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountDto } from '@src/modules/account/services/dto';
import { OAuthTokenDto } from '@src/modules/oauth';
import { OAuthService } from '@src/modules/oauth/service/oauth.service';
import { AccountService } from '@modules/account/services/account.service';
import { AccountDto } from '@modules/account/services/dto';
import { OAuthTokenDto } from '@modules/oauth';
import { OAuthService } from '@modules/oauth/service/oauth.service';
import { SchoolInMigrationError } from '../errors/school-in-migration.error';
import { ICurrentUser, OauthCurrentUser } from '../interface';
import { Oauth2Strategy } from './oauth2.strategy';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { UserDO } from '@shared/domain/domainobject/user.do';
import { AccountService } from '@src/modules/account/services/account.service';
import { AccountDto } from '@src/modules/account/services/dto';
import { OAuthTokenDto } from '@src/modules/oauth';
import { OAuthService } from '@src/modules/oauth/service/oauth.service';
import { AccountService } from '@modules/account/services/account.service';
import { AccountDto } from '@modules/account/services/dto';
import { OAuthTokenDto } from '@modules/oauth';
import { OAuthService } from '@modules/oauth/service/oauth.service';
import { Strategy } from 'passport-custom';
import { Oauth2AuthorizationBodyParams } from '../controllers/dto';
import { SchoolInMigrationError } from '../errors/school-in-migration.error';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import {
TeamsRepo,
UserRepo,
} from '@shared/repo';
import { ToolModule } from '@src/modules/tool';
import { ToolModule } from '@modules/tool';
import { LoggerModule } from '@src/core/logger';
import { BoardModule } from '@src/modules/board';
import { BoardModule } from '@modules/board';
import { ReferenceLoader, AuthorizationReferenceService, AuthorizationHelper } from './domain';
import { AuthorizationModule } from './authorization.module';

Expand Down
Loading

0 comments on commit fc68ac0

Please sign in to comment.