Leonid Yavorskyi
04/16/2022, 9:33 AMreturn Entity.wrapRows(query)
.with(Entity::followers) <-- these relations are fetched correctly, based on the filtering applied to the main query (SELECT * FROM followers WHERE followers.id IN (...))
.with(Entity::following) <-- need some additional filtering here (SELECT * FROM followers WHERE followers.id IN (...) AND followers.team_id != :teamId)
.with(Entity::periodData)
.map { it.toDomain() }
.toList()