mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-02-18 07:14:40 +00:00
fix: rename PageMeta to LogsPageMeta
This commit is contained in:
parent
3d2c79ecb1
commit
8b2e4666dd
|
@ -44,7 +44,7 @@ class LogEntry:
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class PageMeta:
|
class LogsPageMeta:
|
||||||
up_cursor: typing.Optional[str] = strawberry.field()
|
up_cursor: typing.Optional[str] = strawberry.field()
|
||||||
down_cursor: typing.Optional[str] = strawberry.field()
|
down_cursor: typing.Optional[str] = strawberry.field()
|
||||||
|
|
||||||
|
@ -57,22 +57,22 @@ class PageMeta:
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class PaginatedEntries:
|
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(
|
entries: typing.List[LogEntry] = strawberry.field(
|
||||||
description="The list of log entries."
|
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.page_meta = meta
|
||||||
self.entries = entries
|
self.entries = entries
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_entries(entries: typing.List[LogEntry]):
|
def from_entries(entries: typing.List[LogEntry]):
|
||||||
if entries == []:
|
if entries == []:
|
||||||
return PaginatedEntries(PageMeta(None, None), [])
|
return PaginatedEntries(LogsPageMeta(None, None), [])
|
||||||
|
|
||||||
return PaginatedEntries(
|
return PaginatedEntries(
|
||||||
PageMeta(
|
LogsPageMeta(
|
||||||
entries[0].cursor(),
|
entries[0].cursor(),
|
||||||
entries[-1].cursor(),
|
entries[-1].cursor(),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue