refactor(pipedrive): make filterProvidedFields func reusable

This commit is contained in:
Rıdvan Akca
2023-10-20 19:25:06 +03:00
committed by Ali BARIN
parent 94e64676af
commit 034bc6a79e
7 changed files with 26 additions and 62 deletions

View File

@@ -1,4 +1,5 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
type TEmail = {
__id: string;
@@ -10,15 +11,6 @@ type TPhone = {
phone: string;
}[];
function filterProvidedFields(body: Record<string, unknown>) {
return Object.keys(body).reduce<Record<string, unknown>>((result, key) => {
if (body[key]) {
result[key] = body[key];
}
return result;
}, {});
}
export default defineAction({
name: 'Create person',
key: 'createPerson',