refactor(core): Make controller constructors consistent (no-changelog) (#7015)

This commit is contained in:
Iván Ovejero
2023-08-25 13:23:22 +02:00
committed by GitHub
parent 07d3633a05
commit 87cf1d9c1b
10 changed files with 145 additions and 270 deletions

View File

@@ -12,44 +12,28 @@ import { validateEntity } from '@/GenericHelpers';
import { issueCookie } from '@/auth/jwt';
import type { User } from '@db/entities/User';
import { Response } from 'express';
import type { ILogger } from 'n8n-workflow';
import { ILogger } from 'n8n-workflow';
import {
AuthenticatedRequest,
MeRequest,
UserSettingsUpdatePayload,
UserUpdatePayload,
} from '@/requests';
import type { PublicUser, IExternalHooksClass, IInternalHooksClass } from '@/Interfaces';
import { IExternalHooksClass, IInternalHooksClass } from '@/Interfaces';
import type { PublicUser } from '@/Interfaces';
import { randomBytes } from 'crypto';
import { isSamlLicensedAndEnabled } from '../sso/saml/samlHelpers';
import { UserService } from '@/services/user.service';
import Container from 'typedi';
@Authorized()
@RestController('/me')
export class MeController {
private readonly logger: ILogger;
private readonly externalHooks: IExternalHooksClass;
private readonly internalHooks: IInternalHooksClass;
private readonly userService: UserService;
constructor({
logger,
externalHooks,
internalHooks,
}: {
logger: ILogger;
externalHooks: IExternalHooksClass;
internalHooks: IInternalHooksClass;
}) {
this.logger = logger;
this.externalHooks = externalHooks;
this.internalHooks = internalHooks;
this.userService = Container.get(UserService);
}
constructor(
private readonly logger: ILogger,
private readonly externalHooks: IExternalHooksClass,
private readonly internalHooks: IInternalHooksClass,
private readonly userService: UserService,
) {}
/**
* Update the logged-in user's properties, except password.