diff --git a/backend/src/database/repositories/memberRepository.ts b/backend/src/database/repositories/memberRepository.ts index ba00a843c4..05cf802311 100644 --- a/backend/src/database/repositories/memberRepository.ts +++ b/backend/src/database/repositories/memberRepository.ts @@ -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 }