mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Separate list query entities from request types (#15015)
This commit is contained in:
@@ -11,7 +11,8 @@ import type {
|
||||
import type { Project } from '@/databases/entities/project';
|
||||
import type { User } from '@/databases/entities/user';
|
||||
import type { WorkflowHistory } from '@/databases/entities/workflow-history';
|
||||
import type { ListQuery } from '@/types-db';
|
||||
|
||||
import type { ListQueryDb } from './types-db';
|
||||
|
||||
export type APIRequest<
|
||||
RouteParams = {},
|
||||
@@ -42,13 +43,35 @@ export type AuthenticatedRequest<
|
||||
};
|
||||
};
|
||||
|
||||
export namespace ListQuery {
|
||||
export type Request = AuthenticatedRequest<{}, {}, {}, Params> & {
|
||||
listQueryOptions?: Options;
|
||||
};
|
||||
|
||||
export type Params = {
|
||||
filter?: string;
|
||||
skip?: string;
|
||||
take?: string;
|
||||
select?: string;
|
||||
sortBy?: string;
|
||||
};
|
||||
|
||||
export type Options = {
|
||||
filter?: Record<string, unknown>;
|
||||
select?: Record<string, true>;
|
||||
skip?: number;
|
||||
take?: number;
|
||||
sortBy?: string;
|
||||
};
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// list query
|
||||
// ----------------------------------
|
||||
|
||||
export function hasSharing(
|
||||
workflows: ListQuery.Workflow.Plain[] | ListQuery.Workflow.WithSharing[],
|
||||
): workflows is ListQuery.Workflow.WithSharing[] {
|
||||
workflows: ListQueryDb.Workflow.Plain[] | ListQueryDb.Workflow.WithSharing[],
|
||||
): workflows is ListQueryDb.Workflow.WithSharing[] {
|
||||
return workflows.some((w) => 'shared' in w);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user