-
-
Save mccraigmccraig/1b6eefd2d7035a52a3347cdfca69f3fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(s/defn last-n-conversation-messages | |
([cassandra conversation] | |
(last-n-conversation-messages cassandra | |
conversation | |
max-recent-messages)) | |
([cassandra | |
conversation | |
n] | |
(ddo [:let [[org-id con-id] (t/extract-uber-key-value conv.ent/Conversations | |
conversation)] | |
msgs (cm/select | |
cassandra | |
conv.ent/ConversationMessages | |
[:org_id :conversation_id] | |
[org-id con-id] | |
{:limit n})] | |
(return | |
(filter | |
(comp not :deleted) | |
msgs))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment