mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
fix: rename PageMeta to LogsPageMeta
This commit is contained in:
parent
3d2c79ecb1
commit
8b2e4666dd
|
@ -44,7 +44,7 @@ class LogEntry:
|
|||
|
||||
|
||||
@strawberry.type
|
||||
class PageMeta:
|
||||
class LogsPageMeta:
|
||||
up_cursor: typing.Optional[str] = strawberry.field()
|
||||
down_cursor: typing.Optional[str] = strawberry.field()
|
||||
|
||||
|
@ -57,22 +57,22 @@ class PageMeta:
|
|||
|
||||
@strawberry.type
|
||||
class PaginatedEntries:
|
||||
page_meta: PageMeta = strawberry.field(description="Metadata to aid in pagination.")
|
||||
page_meta: LogsPageMeta = strawberry.field(description="Metadata to aid in pagination.")
|
||||
entries: typing.List[LogEntry] = strawberry.field(
|
||||
description="The list of log entries."
|
||||
)
|
||||
|
||||
def __init__(self, meta: PageMeta, entries: typing.List[LogEntry]):
|
||||
def __init__(self, meta: LogsPageMeta, entries: typing.List[LogEntry]):
|
||||
self.page_meta = meta
|
||||
self.entries = entries
|
||||
|
||||
@staticmethod
|
||||
def from_entries(entries: typing.List[LogEntry]):
|
||||
if entries == []:
|
||||
return PaginatedEntries(PageMeta(None, None), [])
|
||||
return PaginatedEntries(LogsPageMeta(None, None), [])
|
||||
|
||||
return PaginatedEntries(
|
||||
PageMeta(
|
||||
LogsPageMeta(
|
||||
entries[0].cursor(),
|
||||
entries[-1].cursor(),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue