Skip to content

Endpoint to get all rules with subscription status #500

@bracyw

Description

@bracyw

Description

Return all rules in the system with a boolean flag indicating if the requesting client is subscribed to each rule. Used for the main rules list UI where users can see all available rules and their subscription status, enabling them to discover and subscribe to existing rules or create new ones. Frontend handles filtering/sorting by topic or subscription status for better UX.

Acceptance Criteria

  • Returns all rules in system
  • Includes is_subscribed: bool for given client_id
  • Time: O(R) where R = total rules

Proposed Solution

GET /rules/all/{client_id}
Response: Vec<RuleWithSubscription>
where RuleWithSubscription = { 
    #[serde(flatten)]
    rule: Rule, 
    is_subscribed: bool 
}

Add get_all_rules_with_status() method to RuleManager in rule_structs.rs, add endpoint to rule_controller.rs. Reference get_all_rules() for reading from rules hashmap, and handle_msg() for checking subscriptions via subscriptions.read().await.get_right(&client_id). Test using Postman for basic functionality, then add tests to rule_structs_test.rs.

Mocks

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    mediumA more complex taskscylla-serverDevelopment Focused in the Backend

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions