Skip to content

fix issue sort and search on table browse screen#69

Merged
NicolasCARPi merged 2 commits into
masterfrom
toan-2026-01-19-fix-issue-sort
Jan 19, 2026
Merged

fix issue sort and search on table browse screen#69
NicolasCARPi merged 2 commits into
masterfrom
toan-2026-01-19-fix-issue-sort

Conversation

@toan-nsc
Copy link
Copy Markdown
Contributor

@toan-nsc toan-nsc commented Jan 19, 2026

Fixed the issue:

  1. Sort on column does not work
  2. Filter by does not work

Summary by CodeRabbit

  • New Features
    • Server-side sorting and filtering now available for browse results.
    • Advanced filtering added with text search (name, author) and numeric range filters (downloads).
    • Enhanced moderation action workflow with real-time visual feedback, button state management, and completion notifications.

✏️ Tip: You can customize this high-level summary in your review settings.

@toan-nsc toan-nsc requested a review from NicolasCARPi January 19, 2026 14:28
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The changes enhance sorting and filtering capabilities across the application by integrating server-side sorting and filtering into the browse endpoints. The backend repository methods now accept ordering and filter parameters, supported by a new utility to construct SQL filter clauses. The frontend integrates AG Grid's server-side datasource to propagate sort and filter parameters to the API. Additionally, the moderation workflow is improved with better button state management and user feedback via toast notifications.

Changes

Cohort / File(s) Summary
Frontend UI & AG Grid Integration
src/index.js
Propagates sorting and filtering parameters from AG Grid server-side datasource to browse API; enhances moderation workflow with button state management, action text updates, and toast-based feedback for success/error states
Backend Data Access Layer
src/record_repository.go
Extends paginated method signatures (SearchPaginated, GetAllByRorIDsPaginated, GetAllByCategoriesPaginated, GetAllPaginated) to accept orderBy, sortOrder, and filters map; adds buildFilterClause helper to construct SQL WHERE clauses for name, author, and downloads filtering; updates query construction to include dynamic ORDER BY and WHERE clauses
Backend API Handler
src/record_handler.go
Parses and validates sortBy/sortOrder from request parameters with database column mapping and desc default; constructs filters map for name, author, downloads range filtering; threads sort and filter parameters through all browse API and page rendering data retrieval paths
Backend Organization Logic
src/organization_handler.go
Updates organization record count retrieval to include explicit sort parameters (created_at, desc) and empty filter map when calling GetAllByRorIDsPaginated

Sequence Diagrams

sequenceDiagram
    participant Client as Client / Browser
    participant Handler as API Handler
    participant Repo as Repository
    participant DB as Database

    Client->>Handler: GET /browse?sortBy=downloads&filterName=test
    Handler->>Handler: Parse sortBy → downloads (map to db_downloads)<br/>Parse filters (name: test)
    Handler->>Repo: SearchPaginated(ctx, query, categoryID,<br/>limit, offset, "db_downloads", "desc",<br/>{name: {value: "test", type: "contains"}})
    Repo->>Repo: buildFilterClause(filters) → WHERE clause<br/>Construct ORDER BY clause
    Repo->>DB: SELECT * FROM records<br/>WHERE name LIKE '%test%'<br/>ORDER BY db_downloads DESC
    DB-->>Repo: Filtered & sorted records
    Repo-->>Handler: Records, total count
    Handler-->>Client: JSON with sorted/filtered results
Loading
sequenceDiagram
    participant User as User
    participant UI as UI Button
    participant API as API Handler
    participant Server as Server

    User->>UI: Click moderation action button
    UI->>UI: Capture original button text<br/>Disable all related buttons<br/>Update button text (e.g., "Approving...")
    UI->>API: POST /moderate {action: "approve"}
    API->>Server: Process moderation action
    alt Success
        Server-->>API: 200 OK
        API-->>UI: Success response
        UI->>UI: Show toast "Action successful"<br/>Reload page
    else Error
        Server-->>API: 4xx/5xx Error
        API-->>UI: Error response
        UI->>UI: Show error toast<br/>Reset button text<br/>Re-enable buttons
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Sorting spins through databases fast,
Filters bloom where queries are cast,
AG Grid receives the moderation's care,
Buttons speak truth with buttons to spare,
Progress whispers through every affair! ✨


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

@NicolasCARPi NicolasCARPi merged commit 167daa3 into master Jan 19, 2026
2 checks passed
@NicolasCARPi NicolasCARPi deleted the toan-2026-01-19-fix-issue-sort branch January 19, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants