Skip to content

Commit 52e1cd1

Browse files
author
Uros Marolt
authored
Only use posts that have publishedAt property set. (#718)
1 parent f77a56f commit 52e1cd1

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

backend/src/serverless/integrations/usecases/linkedin/getOrganizationPosts.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,23 @@ export const getOrganizationPosts = async (
3333

3434
let stop = false
3535

36-
const elements = response.elements.map((e) => {
37-
if (lookBackUntilTs && e.createdAt <= lookBackUntilTs) {
38-
stop = true
39-
}
36+
const elements = response.elements
37+
.filter((e) => e.publishedAt !== undefined)
38+
.map((e) => {
39+
if (lookBackUntilTs && e.createdAt <= lookBackUntilTs) {
40+
stop = true
41+
}
4042

41-
return {
42-
urnId: e.id,
43-
lifecycleState: e.lifecycleState,
44-
visibility: e.visibility,
45-
authorUrn: e.author,
46-
body: e.commentary,
47-
originalUrnId: e.reshareContext?.parent,
48-
timestamp: e.createdAt,
49-
}
50-
})
43+
return {
44+
urnId: e.id,
45+
lifecycleState: e.lifecycleState,
46+
visibility: e.visibility,
47+
authorUrn: e.author,
48+
body: e.commentary,
49+
originalUrnId: e.reshareContext?.parent,
50+
timestamp: e.createdAt,
51+
}
52+
})
5153

5254
if (stop) {
5355
return {

0 commit comments

Comments
 (0)