Add filters to search record action (#12481)
First PR to add filters to send records. Lot of work left, but I want to split. I mainly want to validate the architecture there. https://github.com/user-attachments/assets/63375a75-ba88-49df-8c12-5e3e58de5342 TODO in next PRs: - fix design - make filters reliable. Some composite fields are not implemented and some fields like datetime do not work well - improve typing
This commit is contained in:
@ -129,7 +129,8 @@ export class FindRecordsWorkflowAction implements WorkflowExecutor {
|
||||
const withFilterQueryBuilder = graphqlQueryParser.applyFilterToBuilder(
|
||||
queryBuilder,
|
||||
workflowActionInput.objectName,
|
||||
workflowActionInput.filter ?? ({} as ObjectRecordFilter),
|
||||
workflowActionInput.filter?.gqlOperationFilter ??
|
||||
({} as ObjectRecordFilter),
|
||||
);
|
||||
|
||||
const orderByWithIdCondition = [
|
||||
@ -167,14 +168,15 @@ export class FindRecordsWorkflowAction implements WorkflowExecutor {
|
||||
const withFilterCountQueryBuilder = graphqlQueryParser.applyFilterToBuilder(
|
||||
countQueryBuilder,
|
||||
workflowActionInput.objectName,
|
||||
workflowActionInput.filter ?? ({} as ObjectRecordFilter),
|
||||
workflowActionInput.filter?.gqlOperationFilter ??
|
||||
({} as ObjectRecordFilter),
|
||||
);
|
||||
|
||||
const withDeletedCountQueryBuilder =
|
||||
graphqlQueryParser.applyDeletedAtToBuilder(
|
||||
withFilterCountQueryBuilder,
|
||||
workflowActionInput.filter
|
||||
? workflowActionInput.filter
|
||||
workflowActionInput.filter?.gqlOperationFilter
|
||||
? workflowActionInput.filter.gqlOperationFilter
|
||||
: ({} as ObjectRecordFilter),
|
||||
);
|
||||
|
||||
|
||||
@ -25,7 +25,14 @@ export type WorkflowDeleteRecordActionInput = {
|
||||
|
||||
export type WorkflowFindRecordsActionInput = {
|
||||
objectName: string;
|
||||
filter?: Partial<ObjectRecordFilter>;
|
||||
// TODO: migrate gql computation and record filter groups to twenty-shared
|
||||
filter?: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
recordFilterGroups?: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
recordFilters?: any;
|
||||
gqlOperationFilter?: Partial<ObjectRecordFilter>[];
|
||||
};
|
||||
orderBy?: Partial<ObjectRecordOrderBy>;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user