refactor(core): Port 3 more controllers to use DTOs (no-changelog) (#12375)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-12-26 16:09:42 +01:00
committed by GitHub
parent 1d5e891a0d
commit 371a09de96
36 changed files with 813 additions and 240 deletions

View File

@@ -1,7 +1,6 @@
import type { Scope } from '@n8n/permissions';
import type express from 'express';
import type {
BannerName,
ICredentialDataDecryptedObject,
IDataObject,
ILoadOptions,
@@ -19,7 +18,7 @@ import type { AssignableRole, GlobalRole, User } from '@/databases/entities/user
import type { Variables } from '@/databases/entities/variables';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { WorkflowHistory } from '@/databases/entities/workflow-history';
import type { PublicUser, SecretsProvider, SecretsProviderState } from '@/interfaces';
import type { SecretsProvider, SecretsProviderState } from '@/interfaces';
import type { ProjectRole } from './databases/entities/project-relation';
import type { ScopesField } from './services/role.service';
@@ -195,42 +194,6 @@ export declare namespace MeRequest {
export type SurveyAnswers = AuthenticatedRequest<{}, {}, IPersonalizationSurveyAnswersV4>;
}
export interface UserSetupPayload {
email: string;
password: string;
firstName: string;
lastName: string;
mfaEnabled?: boolean;
mfaSecret?: string;
mfaRecoveryCodes?: string[];
}
// ----------------------------------
// /owner
// ----------------------------------
export declare namespace OwnerRequest {
type Post = AuthenticatedRequest<{}, {}, UserSetupPayload, {}>;
type DismissBanner = AuthenticatedRequest<{}, {}, Partial<{ bannerName: BannerName }>, {}>;
}
// ----------------------------------
// password reset endpoints
// ----------------------------------
export declare namespace PasswordResetRequest {
export type Email = AuthlessRequest<{}, {}, Pick<PublicUser, 'email'>>;
export type Credentials = AuthlessRequest<{}, {}, {}, { userId?: string; token?: string }>;
export type NewPassword = AuthlessRequest<
{},
{},
Pick<PublicUser, 'password'> & { token?: string; userId?: string; mfaCode?: string }
>;
}
// ----------------------------------
// /users
// ----------------------------------
@@ -253,18 +216,6 @@ export declare namespace UserRequest {
error?: string;
};
export type ResolveSignUp = AuthlessRequest<
{},
{},
{},
{ inviterId?: string; inviteeId?: string }
>;
export type SignUp = AuthenticatedRequest<
{ id: string },
{ inviterId?: string; inviteeId?: string }
>;
export type Delete = AuthenticatedRequest<
{ id: string; email: string; identifier: string },
{},
@@ -295,21 +246,6 @@ export declare namespace UserRequest {
>;
}
// ----------------------------------
// /login
// ----------------------------------
export type LoginRequest = AuthlessRequest<
{},
{},
{
email: string;
password: string;
mfaCode?: string;
mfaRecoveryCode?: string;
}
>;
// ----------------------------------
// MFA endpoints
// ----------------------------------