Skip to content

Commit

Permalink
Humaans integration: update "getCustomValue" method
Browse files Browse the repository at this point in the history
  • Loading branch information
ba1uev committed Oct 30, 2024
1 parent 2975db7 commit 1fc88ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/integrations/humaans/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,13 @@ class Humaans extends Integration {
personId: string,
customFieldId: string
): Promise<CustomValue | null> {
return (
(await this.makePaginatedRequest<CustomValue>('/custom-values', {
personId,
customFieldId,
}).then(fp.first)) || null
)
return await this.makePaginatedRequest<CustomValue>('/custom-values', {
personId,
customFieldId,
}).then((xs) => {
if (!xs.length) return null
return xs.sort(fp.sortBy('updatedAt', 'desc'))[0]
})
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/integrations/humaans/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,6 @@ export type CustomValue = {
value: string
personId: string
customFieldId: string
createdAt: Date
updatedAt: Date
}

0 comments on commit 1fc88ad

Please sign in to comment.