added frontend for social + feed partiali working

This commit is contained in:
2026-05-18 02:25:47 +02:00
parent e1df55df0e
commit 202ce22102
88 changed files with 4236 additions and 737 deletions

View File

@@ -0,0 +1,31 @@
"""Shared pagination classes.
`CreatedCursorPagination` is the canonical choice for infinite-scroll feeds
(posts feed, chat message history). Cursor pagination keeps a stable view of
results even when new items are created at the head, which page/offset
pagination does not.
"""
from rest_framework.pagination import CursorPagination
class CreatedCursorPagination(CursorPagination):
"""Cursor pagination ordered by `-created_at` (newest first)."""
page_size = 20
ordering = '-created_at'
cursor_query_param = 'cursor'
page_size_query_param = 'page_size'
max_page_size = 100
class CreatedAscCursorPagination(CursorPagination):
"""Cursor pagination ordered by `created_at` (oldest first).
Used for chat history scroll-back where messages are displayed oldest -> newest
and pagination walks backwards in time from the most recent.
"""
page_size = 30
ordering = '-created_at' # backend orders newest-first; client reverses for display
cursor_query_param = 'cursor'
page_size_query_param = 'page_size'
max_page_size = 100