Skip to content

Commit

Permalink
Fetch member's segments after by-id query to opensearch (#2046)
Browse files Browse the repository at this point in the history
  • Loading branch information
sausage-todd authored Jan 9, 2024
1 parent 4dec238 commit 7b57dd3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions backend/src/database/repositories/memberRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,25 @@ class MemberRepository {
})
}

const seq = SequelizeRepository.getSequelize(options)
result.segments = await seq.query(
`
SELECT
s.id,
s.name
FROM mv_activities_cube a
JOIN segments s ON s.id = a."segmentId"
WHERE a."memberId" = :id
GROUP BY s.id
`,
{
replacements: {
id,
},
type: QueryTypes.SELECT,
},
)

return result
}

Expand Down

0 comments on commit 7b57dd3

Please sign in to comment.