refactor(core): Port over project request payloads to DTOs (#12528)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-01-09 13:47:23 +01:00
committed by GitHub
parent 44679b42aa
commit 5f1adefca7
34 changed files with 514 additions and 194 deletions

View File

@@ -1,3 +1,4 @@
import type { ProjectIcon, ProjectRole, ProjectType } from '@n8n/api-types';
import type { Scope } from '@n8n/permissions';
import type express from 'express';
import type {
@@ -9,14 +10,13 @@ import type {
} from 'n8n-workflow';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { Project, ProjectIcon, ProjectType } from '@/databases/entities/project';
import type { Project } from '@/databases/entities/project';
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 { SecretsProvider, SecretsProviderState } from '@/interfaces';
import type { ProjectRole } from './databases/entities/project-relation';
import type { ScopesField } from './services/role.service';
export type APIRequest<
@@ -388,32 +388,10 @@ export declare namespace ActiveWorkflowRequest {
// ----------------------------------
export declare namespace ProjectRequest {
type GetAll = AuthenticatedRequest<{}, Project[]>;
type Create = AuthenticatedRequest<
{},
Project,
{
name: string;
icon?: ProjectIcon;
}
>;
type GetMyProjects = AuthenticatedRequest<
{},
Array<Project & { role: ProjectRole }>,
{},
{
includeScopes?: boolean;
}
>;
type GetMyProjectsResponse = Array<
Project & { role: ProjectRole | GlobalRole; scopes?: Scope[] }
>;
type GetPersonalProject = AuthenticatedRequest<{}, Project>;
type ProjectRelationPayload = { userId: string; role: ProjectRole };
type ProjectRelationResponse = {
id: string;
email: string;
@@ -429,18 +407,6 @@ export declare namespace ProjectRequest {
relations: ProjectRelationResponse[];
scopes: Scope[];
};
type Get = AuthenticatedRequest<{ projectId: string }, {}>;
type Update = AuthenticatedRequest<
{ projectId: string },
{},
{
name?: string;
relations?: ProjectRelationPayload[];
icon?: { type: 'icon' | 'emoji'; value: string };
}
>;
type Delete = AuthenticatedRequest<{ projectId: string }, {}, {}, { transferId?: string }>;
}
// ----------------------------------