Skip to content

feat: added events feature for both admin and the user

Bhaskar Battula requested to merge events into develop

Summary

This MR adds CLI support for the backend event subsystem by implementing commands for event management and runtime event resolution.

The CLI now supports interacting with /api/v1/events endpoints directly, enabling users to create, manage, inspect, and resolve active events from the command line.

This brings feature parity between the backend service and CLI tooling.


What Changed

1. Added event management commands

Implemented CLI commands for event CRUD operations:

Admin Commands

### to create an event  
uv run corpus-client admin events create <params>

### to get list of all events
uv run corpus-client admin events list

### to get details of a specific event
uv run corpus-client admin events get <event uuid>

### to update details of a specific event 
uv run corpus-client admin events update <event uuid>

### to deactivate a event
uv run corpus-client admin events deactivate <event uuid>

User Command

## to get the current event details
uv run corpus-client current-event

These commands map directly to the backend event APIs.


2. Added runtime event resolution command

Behavior mirrors backend semantics:

  • resolves events using page route context
  • returns empty/null when no active event exists
  • surfaces conflict behavior when multiple active events match

3. Added support for event filter payloads

Implemented serialization/deserialization handling for event filters to ensure compatibility with backend expectations.

Supported payload types include:

  • enums
  • UUIDs
  • date values
  • nested review filter structures

4. Added CLI validation and error handling

Added handling for:

  • invalid event IDs
  • malformed payloads
  • missing required arguments
  • backend conflict responses (409)
  • empty runtime event responses

Why This Change

This MR exposes the backend event system through the CLI so developers and operators can:

  • manage events without manual API calls
  • test runtime event resolution flows
  • automate event workflows through scripts
  • debug page-context behavior more easily
  • maintain backend/CLI feature parity

Coverage added for:

  • CRUD command execution
  • current event resolution
  • empty runtime responses
  • duplicate active event conflicts
  • filter payload serialization
  • CLI error handling paths

Closes

closes: #52

Merge request reports

Loading