Skip to content

Commit

Permalink
refactor(core): Standardize filename casing for controllers and datab…
Browse files Browse the repository at this point in the history
…ases (no-changelog) (#10564)
  • Loading branch information
ivov authored Aug 27, 2024
1 parent be52176 commit fd58a27
Show file tree
Hide file tree
Showing 264 changed files with 566 additions and 565 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { DataSource as Connection } from '@n8n/typeorm';
import { ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';

import { inTest } from '@/constants';
import { wrapMigration } from '@db/utils/migrationHelpers';
import { wrapMigration } from '@/databases/utils/migration-helpers';
import type { Migration } from '@db/types';
import { getConnectionOptions } from '@db/config';

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import type { WorkflowExecute } from 'n8n-core';

import type PCancelable from 'p-cancelable';

import type { AuthProviderType } from '@db/entities/AuthIdentity';
import type { SharedCredentials } from '@db/entities/SharedCredentials';
import type { TagEntity } from '@db/entities/TagEntity';
import type { AssignableRole, GlobalRole, User } from '@db/entities/User';
import type { AuthProviderType } from '@/databases/entities/auth-identity';
import type { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { TagEntity } from '@/databases/entities/tag-entity';
import type { AssignableRole, GlobalRole, User } from '@/databases/entities/User';
import type { CredentialsRepository } from '@db/repositories/credentials.repository';
import type { SettingsRepository } from '@db/repositories/settings.repository';
import type { UserRepository } from '@db/repositories/user.repository';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/PublicApi/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ExecutionStatus, ICredentialDataDecryptedObject } from 'n8n-workflow';

import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import type { TagEntity } from '@db/entities/TagEntity';
import type { WorkflowEntity } from '@db/entities/workflow-entity';
import type { TagEntity } from '@/databases/entities/tag-entity';
import type { Risk } from '@/security-audit/types';
import type { AuthlessRequest, AuthenticatedRequest } from '@/requests';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type express from 'express';

import { CredentialsHelper } from '@/credentials-helper';
import { CredentialTypes } from '@/credential-types';
import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { CredentialTypeRequest, CredentialRequest } from '../../../types';
import { projectScope } from '../../shared/middlewares/global.middleware';
import { validCredentialsProperties, validCredentialType } from './credentials.middleware';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import type {
} from 'n8n-workflow';
import * as Db from '@/Db';
import type { ICredentialsDb } from '@/Interfaces';
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { SharedCredentials } from '@db/entities/SharedCredentials';
import type { User } from '@db/entities/User';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { User } from '@/databases/entities/User';
import { ExternalHooks } from '@/external-hooks';
import type { IDependency, IJsonSchema } from '../../../types';
import type { CredentialRequest } from '@/requests';
import { Container } from 'typedi';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository';
import { EventService } from '@/events/event.service';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type express from 'express';

import type { TagEntity } from '@db/entities/TagEntity';
import type { TagEntity } from '@/databases/entities/tag-entity';
import { globalScope, validCursor } from '../../shared/middlewares/global.middleware';
import type { TagRequest } from '../../../types';
import { encodeNextCursor } from '../../shared/services/pagination.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '../../shared/middlewares/global.middleware';
import type { UserRequest } from '@/requests';
import { EventService } from '@/events/event.service';
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository';
import type { Response } from 'express';
import { InvitationController } from '@/controllers/invitation.controller';
import { UsersController } from '@/controllers/users.controller';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container } from 'typedi';
import { UserRepository } from '@db/repositories/user.repository';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import pick from 'lodash/pick';
import { validate as uuidValidate } from 'uuid';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { v4 as uuid } from 'uuid';

import { ActiveWorkflowManager } from '@/active-workflow-manager';
import config from '@/config';
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { WorkflowEntity } from '@db/entities/workflow-entity';
import { ExternalHooks } from '@/external-hooks';
import { addNodeIds, replaceInvalidCredentials } from '@/workflow-helpers';
import type { WorkflowRequest } from '../../../types';
Expand All @@ -27,7 +27,7 @@ import {
} from './workflows.service';
import { WorkflowService } from '@/workflows/workflow.service';
import { WorkflowHistoryService } from '@/workflows/workflow-history/workflow-history.service.ee';
import { SharedWorkflowRepository } from '@/databases/repositories/sharedWorkflow.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { TagRepository } from '@/databases/repositories/tag.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Container } from 'typedi';
import * as Db from '@/Db';
import type { User } from '@db/entities/User';
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
import { WorkflowTagMapping } from '@db/entities/WorkflowTagMapping';
import { SharedWorkflow, type WorkflowSharingRole } from '@db/entities/SharedWorkflow';
import type { User } from '@/databases/entities/User';
import { WorkflowEntity } from '@db/entities/workflow-entity';
import { WorkflowTagMapping } from '@/databases/entities/workflow-tag-mapping';
import { SharedWorkflow, type WorkflowSharingRole } from '@/databases/entities/shared-workflow';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository';
import type { Project } from '@/databases/entities/Project';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import type { Project } from '@/databases/entities/project';
import { TagRepository } from '@db/repositories/tag.repository';
import { License } from '@/license';
import { WorkflowSharingService } from '@/workflows/workflow-sharing.service';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/credentials-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { CredentialsHelper } from '@/credentials-helper';
import { NodeTypes } from '@/node-types';
import { LoadNodesAndCredentials } from '@/load-nodes-and-credentials';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { mockInstance } from '@test/mocking';

describe('CredentialsHelper', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/workflow-runner.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Container from 'typedi';
import { WorkflowHooks, type ExecutionError, type IWorkflowExecuteHooks } from 'n8n-workflow';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { WorkflowRunner } from '@/workflow-runner';
import config from '@/config';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/active-workflow-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type { IWorkflowDb } from '@/Interfaces';
import * as WebhookHelpers from '@/webhooks/webhook-helpers';
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';

import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import type { WorkflowEntity } from '@db/entities/workflow-entity';
import { ActiveExecutions } from '@/active-executions';
import { ExecutionService } from './executions/execution.service';
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/auth/__tests__/auth.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { NextFunction, Response } from 'express';
import { AuthService } from '@/auth/auth.service';
import config from '@/config';
import { AUTH_COOKIE_NAME, Time } from '@/constants';
import type { User } from '@db/entities/User';
import type { InvalidAuthTokenRepository } from '@db/repositories/invalidAuthToken.repository';
import type { User } from '@/databases/entities/User';
import type { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import type { UserRepository } from '@db/repositories/user.repository';
import { JwtService } from '@/services/jwt.service';
import type { UrlService } from '@/services/url.service';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { JsonWebTokenError, TokenExpiredError } from 'jsonwebtoken';

import config from '@/config';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import type { User } from '@db/entities/User';
import { InvalidAuthTokenRepository } from '@db/repositories/invalidAuthToken.repository';
import type { User } from '@/databases/entities/User';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error';
import { ForbiddenError } from '@/errors/response-errors/forbidden.error';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Container } from 'typedi';
import type { Response } from 'express';

import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { AuthService } from './auth.service';

// This method is still used by cloud hooks.
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/methods/email.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { PasswordUtility } from '@/services/password.utility';
import { Container } from 'typedi';
import { isLdapLoginEnabled } from '@/ldap/helpers.ee';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/auth/methods/ldap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
createLdapAuthIdentity,
updateLdapUserOnLocalDb,
} from '@/ldap/helpers.ee';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { EventService } from '@/events/event.service';

export const handleLdapLogin = async (
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/db/revert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Container } from 'typedi';
import { Logger } from '@/logger';
import { getConnectionOptions } from '@db/config';
import type { Migration } from '@db/types';
import { wrapMigration } from '@db/utils/migrationHelpers';
import { wrapMigration } from '@/databases/utils/migration-helpers';

// This function is extracted to make it easier to unit test it.
// Mocking turned into a mess due to this command using typeorm and the db
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/executeBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import pick from 'lodash/pick';
import { ActiveExecutions } from '@/active-executions';
import { WorkflowRunner } from '@/workflow-runner';
import type { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import { OwnershipService } from '@/services/ownership.service';
import { findCliWorkflowStart } from '@/utils';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import glob from 'fast-glob';
import type { EntityManager } from '@n8n/typeorm';

import * as Db from '@/Db';
import { SharedCredentials } from '@db/entities/SharedCredentials';
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { BaseCommand } from '../base-command';
import type { ICredentialsEncrypted } from 'n8n-workflow';
import { ApplicationError, jsonParse } from 'n8n-workflow';
import { UM_FIX_INSTRUCTION } from '@/constants';
import { ProjectRepository } from '@/databases/repositories/project.repository';
import { Project } from '@/databases/entities/Project';
import { Project } from '@/databases/entities/project';
import { User } from '@/databases/entities/User';

export class ImportCredentialsCommand extends BaseCommand {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/import/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import fs from 'fs';
import glob from 'fast-glob';

import { UM_FIX_INSTRUCTION } from '@/constants';
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
import type { WorkflowEntity } from '@db/entities/workflow-entity';
import { generateNanoId } from '@db/utils/generators';
import { UserRepository } from '@db/repositories/user.repository';
import { WorkflowRepository } from '@db/repositories/workflow.repository';
import type { IWorkflowToImport } from '@/Interfaces';
import { ImportService } from '@/services/import.service';
import { BaseCommand } from '../base-command';
import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository';

function assertHasWorkflowsToImport(workflows: unknown): asserts workflows is IWorkflowToImport[] {
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/src/commands/ldap/reset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Container from 'typedi';
import { LDAP_DEFAULT_CONFIGURATION, LDAP_FEATURE_NAME } from '@/ldap/constants';
import { AuthIdentityRepository } from '@db/repositories/authIdentity.repository';
import { AuthProviderSyncHistoryRepository } from '@db/repositories/authProviderSyncHistory.repository';
import { AuthIdentityRepository } from '@db/repositories/auth-identity.repository';
import { AuthProviderSyncHistoryRepository } from '@/databases/repositories/auth-provider-sync-history.repository';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { BaseCommand } from '../base-command';
Expand All @@ -11,9 +11,9 @@ import { ProjectRepository } from '@/databases/repositories/project.repository';
import { WorkflowService } from '@/workflows/workflow.service';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In } from '@n8n/typeorm';
import { SharedWorkflowRepository } from '@/databases/repositories/sharedWorkflow.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/sharedCredentials.repository';
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository';
import { CredentialsService } from '@/credentials/credentials.service';
import { UM_FIX_INSTRUCTION } from '@/constants';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/mfa/disable.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Container from 'typedi';
import { Flags } from '@oclif/core';
import { AuthUserRepository } from '@db/repositories/authUser.repository';
import { AuthUserRepository } from '@/databases/repositories/auth-user.repository';
import { BaseCommand } from '../base-command';

export class DisableMFACommand extends BaseCommand {
Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/commands/user-management/reset.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Container } from 'typedi';
import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
import { User } from '@db/entities/User';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { User } from '@/databases/entities/User';
import { CredentialsRepository } from '@db/repositories/credentials.repository';
import { SettingsRepository } from '@db/repositories/settings.repository';
import { SharedCredentialsRepository } from '@db/repositories/sharedCredentials.repository';
import { SharedWorkflowRepository } from '@db/repositories/sharedWorkflow.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { BaseCommand } from '../base-command';
import { ProjectRepository } from '@/databases/repositories/project.repository';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DynamicNodeParametersController } from '@/controllers/dynamicNodeParameters.controller';
import { DynamicNodeParametersController } from '@/controllers/dynamic-node-parameters.controller';
import type { DynamicNodeParametersRequest } from '@/requests';
import type { DynamicNodeParametersService } from '@/services/dynamicNodeParameters.service';
import { mock } from 'jest-mock-extended';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/controllers/__tests__/me.controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import jwt from 'jsonwebtoken';
import { mock, anyObject } from 'jest-mock-extended';

import type { PublicUser } from '@/Interfaces';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { API_KEY_PREFIX, MeController } from '@/controllers/me.controller';
import { AUTH_COOKIE_NAME } from '@/constants';
import type { AuthenticatedRequest, MeRequest } from '@/requests';
Expand All @@ -15,8 +15,8 @@ import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { EventService } from '@/events/event.service';
import { badPasswords } from '@test/testData';
import { mockInstance } from '@test/mocking';
import { AuthUserRepository } from '@/databases/repositories/authUser.repository';
import { InvalidAuthTokenRepository } from '@db/repositories/invalidAuthToken.repository';
import { AuthUserRepository } from '@/databases/repositories/auth-user.repository';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@db/repositories/user.repository';
import { MfaService } from '@/mfa/mfa.service';
import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import jwt from 'jsonwebtoken';
import type { AuthService } from '@/auth/auth.service';
import config from '@/config';
import { OwnerController } from '@/controllers/owner.controller';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import type { SettingsRepository } from '@db/repositories/settings.repository';
import type { UserRepository } from '@db/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { UserSettingsController } from '@/controllers/userSettings.controller';
import { UserSettingsController } from '@/controllers/user-settings.controller';
import type { NpsSurveyRequest } from '@/requests';
import type { UserService } from '@/services/user.service';
import { mock } from 'jest-mock-extended';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Response } from 'express';
import { AuthService } from '@/auth/auth.service';
import { Get, Post, RestController } from '@/decorators';
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { User } from '@db/entities/User';
import type { User } from '@/databases/entities/User';
import { AuthenticatedRequest, LoginRequest, UserRequest } from '@/requests';
import type { PublicUser } from '@/Interfaces';
import { handleEmailLogin, handleLdapLogin } from '@/auth';
Expand Down
Loading

0 comments on commit fd58a27

Please sign in to comment.