Create base search record action (#10135)

Create Search Record action without filters neither sorting

<img width="234" alt="Capture d’écran 2025-02-11 à 18 19 25"
src="https://github.com/user-attachments/assets/f18caaa3-476a-436f-9f93-1ad506b24da2"
/>
<img width="262" alt="Capture d’écran 2025-02-11 à 18 19 38"
src="https://github.com/user-attachments/assets/25fcbfcf-57fb-476f-aba9-119be7c3e067"
/>
<img width="236" alt="Capture d’écran 2025-02-11 à 18 19 53"
src="https://github.com/user-attachments/assets/1eb2be25-0727-4797-868c-afdc05040e6a"
/>
This commit is contained in:
Thomas Trompette
2025-02-12 11:29:32 +01:00
committed by GitHub
parent 9cc6ea501a
commit 33af71ccd3
7 changed files with 292 additions and 3 deletions

View File

@ -1,9 +1,9 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { isDefined } from 'twenty-shared';
import { Repository } from 'typeorm';
import { v4 } from 'uuid';
import { isDefined } from 'twenty-shared';
import { DatabaseEventAction } from 'src/engine/api/graphql/graphql-query-runner/enums/database-event-action';
import { BASE_TYPESCRIPT_PROJECT_INPUT_SCHEMA } from 'src/engine/core-modules/serverless/drivers/constants/base-typescript-project-input-schema';
@ -186,6 +186,26 @@ export class WorkflowVersionStepWorkspaceService {
},
};
}
case WorkflowActionType.FIND_RECORDS: {
const activeObjectMetadataItem =
await this.objectMetadataRepository.findOne({
where: { workspaceId, isActive: true, isSystem: false },
});
return {
id: newStepId,
name: 'Search Records',
type: WorkflowActionType.FIND_RECORDS,
valid: false,
settings: {
...BASE_STEP_DEFINITION,
input: {
objectName: activeObjectMetadataItem?.nameSingular || '',
limit: 1,
},
},
};
}
default:
throw new WorkflowVersionStepException(
`WorkflowActionType '${type}' unknown`,