PublicDataWorks / verdad-frontend

MIT License
0 stars 0 forks source link

[Backend] Implement RPC function to retrieve filtering options #82

Closed nhphong closed 2 hours ago

nhphong commented 2 hours ago

Let's implement an RPC function on Supabase to retrieve filtering options for the Verdad system and display them on the left sidebar of the homepage.

Business Value:

This feature will enhance the user experience by providing dynamic filtering options for users, making it easier to navigate and find relevant content in the Verdad system.

Acceptance Criteria:

  1. Functionality:
    • Implement an RPC function on Supabase that returns filtering options in the specified JSON format.
    • The function should handle pagination for labels with a default label_page of 0 and label_page_size of 5.
    • Ensure the labels are sorted based on their created_at timestamp.
  2. Response Format:

    • The RPC function should return a JSON response with the following structure:

      {
       "labels": {
           "items": [
               {"label": "Sample Label 1", "value": "uuid-1"},
               {"label": "Sample Label 2", "value": "uuid-2"}
           ],
           "page_size": 2,
           "total_pages": 13,
           "current_page": 0
       },
       "states": [
           {"label": "State 1", "value": "State 1"},
           {"label": "State 2", "value": "State 2"}
       ],
       "sources": [
           {"label": "Source 1", "value": "Source 1"},
           {"label": "Source 2", "value": "Source 2"}
       ],
       "labeledBy": [
           {"label": "by Me", "value": "by_me"},
           {"label": "by Others", "value": "by_others"}
       ],
       "languages": [
           {"label": "English", "value": "English"},
           {"label": "Spanish", "value": "Spanish"}
       ],
       "starredBy": [
           {"label": "by Me", "value": "by_me"},
           {"label": "by Others", "value": "by_others"}
       ]
      }
  3. Localization:
    • Default the language to English.
  4. Pagination:
    • Implement a mechanism for pagination of labels, including support for a "Show more" button as per the Figma design.

Technical Notes:

Tasks:

Considerations for Future Enhancements:

linear[bot] commented 2 hours ago

VER-136 [Backend] Implement RPC function to retrieve filtering options