Skip to content

Commit

Permalink
Fetch member's segments after by-id query to opensearch (#2042)
Browse files Browse the repository at this point in the history
  • Loading branch information
sausage-todd authored Jan 9, 2024
1 parent 9e8af11 commit 0ad4962
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 @@ -1214,6 +1214,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 0ad4962

Please sign in to comment.