Description
Return all rules in the system with subscriber lists and subscription status for requesting client. Enables efficient rule re-use by making all rules discoverable to all clients, allowing them to subscribe to existing rules instead of creating duplicates.
Acceptance Criteria
- Returns all rules in system
- Includes list of all subscribers for each rule
- If
requesting_client_id provided: includes accurate is_subscribed bool
- If
requesting_client_id blank/empty: is_subscribed false for all rules
- Includes
requesting_client_id in response (empty string if not provided)
- Client_id from URL path parameter (URL encoded, optional)
- Time: O(R) where R = total rules
Proposed Solution
GET /rules/{requesting_client_id} (client_id can be empty string)
Response: RulesResponse
where RulesResponse = {
requesting_client_id: String,
rules: Vec<ClientRule>
}
where ClientRule = {
#[serde(flatten)]
rule: Rule,
subscribers: Vec<ClientId>,
is_subscribed: bool
}
Add RulesResponse and ClientRule structs to rule_structs.rs. Modify get_all_rules() to accept optional client_id and return RulesResponse. Get rid of the Auth header and instead use the client_id from the path, handle empty string case. Test using Postman, add tests to rule_structs_test.rs.
Mocks
No response
Description
Return all rules in the system with subscriber lists and subscription status for requesting client. Enables efficient rule re-use by making all rules discoverable to all clients, allowing them to subscribe to existing rules instead of creating duplicates.
Acceptance Criteria
requesting_client_idprovided: includes accurateis_subscribedboolrequesting_client_idblank/empty:is_subscribedfalse for all rulesrequesting_client_idin response (empty string if not provided)Proposed Solution
Add
RulesResponseandClientRulestructs torule_structs.rs. Modifyget_all_rules()to accept optional client_id and returnRulesResponse. Get rid of the Auth header and instead use the client_id from the path, handle empty string case. Test using Postman, add tests torule_structs_test.rs.Mocks
No response