mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 09:06:06 -04:00
Move parsing of tokens out of storage layer
This commit is contained in:
parent
2c662ddde4
commit
7a7eba8302
2 changed files with 21 additions and 14 deletions
|
@ -54,7 +54,7 @@ class PaginationChunk(object):
|
|||
return d
|
||||
|
||||
|
||||
@attr.s
|
||||
@attr.s(frozen=True, slots=True)
|
||||
class RelationPaginationToken(object):
|
||||
"""Pagination token for relation pagination API.
|
||||
|
||||
|
@ -85,7 +85,7 @@ class RelationPaginationToken(object):
|
|||
return attr.astuple(self)
|
||||
|
||||
|
||||
@attr.s
|
||||
@attr.s(frozen=True, slots=True)
|
||||
class AggregationPaginationToken(object):
|
||||
"""Pagination token for relation aggregation pagination API.
|
||||
|
||||
|
@ -151,12 +151,6 @@ class RelationsWorkerStore(SQLBaseStore):
|
|||
requested. The rows are of the form `{"event_id": "..."}`.
|
||||
"""
|
||||
|
||||
if from_token:
|
||||
from_token = RelationPaginationToken.from_string(from_token)
|
||||
|
||||
if to_token:
|
||||
to_token = RelationPaginationToken.from_string(to_token)
|
||||
|
||||
where_clause = ["relates_to_id = ?"]
|
||||
where_args = [event_id]
|
||||
|
||||
|
@ -258,12 +252,6 @@ class RelationsWorkerStore(SQLBaseStore):
|
|||
match. Each row is a dict with `type`, `key` and `count` fields.
|
||||
"""
|
||||
|
||||
if from_token:
|
||||
from_token = AggregationPaginationToken.from_string(from_token)
|
||||
|
||||
if to_token:
|
||||
to_token = AggregationPaginationToken.from_string(to_token)
|
||||
|
||||
where_clause = ["relates_to_id = ?", "relation_type = ?"]
|
||||
where_args = [event_id, RelationTypes.ANNOTATION]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue