comparison libervia/backend/memory/sqla.py @ 4160:6a0066ea5c97

core (memory/sqla): add `id` filter in `history_get`
author Goffi <goffi@goffi.org>
date Tue, 28 Nov 2023 17:26:45 +0100
parents 02f0adc745c6
children 5f2d496c633f
comparison
equal deleted inserted replaced
4159:54b8cf8c8daf 4160:6a0066ea5c97
614 # have in history. This is mainly used to retrieve messages sent 614 # have in history. This is mainly used to retrieve messages sent
615 # while we were offline, using MAM (XEP-0313). 615 # while we were offline, using MAM (XEP-0313).
616 if filters["last_stanza_id"] is not True or limit != 1: 616 if filters["last_stanza_id"] is not True or limit != 1:
617 raise ValueError("Unexpected values for last_stanza_id filter") 617 raise ValueError("Unexpected values for last_stanza_id filter")
618 stmt = stmt.where(History.stanza_id.is_not(None)) 618 stmt = stmt.where(History.stanza_id.is_not(None))
619 if "id" in filters:
620 stmt = stmt.where(History.uid == filters["id"])
619 if "origin_id" in filters: 621 if "origin_id" in filters:
620 stmt = stmt.where(History.origin_id == filters["origin_id"]) 622 stmt = stmt.where(History.origin_id == filters["origin_id"])
621 623
622 if limit is not None: 624 if limit is not None:
623 stmt = stmt.limit(limit) 625 stmt = stmt.limit(limit)