CrumpetDev / crumpet

GNU Affero General Public License v3.0
18 stars 1 forks source link

A client should be able to retrieve the status of a flow and step for a specific person #69

Open tomtitherington opened 7 months ago

tomtitherington commented 7 months ago

Background & Context*

Once a client has a valid Websocket connection to the server, they should be able to retrieve details of a flow and step for a person.

Goal*

Implementation Details*

Calls to this endpoint should be idempotent. Calling this endpoint multiple times with the same parameters should always result in the same outcome.

// Example request when requesting the state of a flow
{
    "action" "flow_status",
    "request_id" : Date.now(),
    "data": {
        "person_id": "string",
        "flow_schema_identifier": "string",
        "flow_instance_id": "string"
    }
}

// Example response when requesting the state of a flow
{
  "request_id": 1519211809934,
  "errors": [],
  "status": 200,
  "data": {
    "flow_instance_id": "string",
    "flow_schema_identifier": "string",
    "state": "string (active, inactive, completed, exited)",
    "active_steps": [
      {
        "step_instance_id": "string",
        "step_schema_identifier": "string",
        "state": "string (active, inactive, completed)"
      }
    ]
}

// Example request when requesting the state of a step
{
    "action": "step_status",
    "request_id" : Date.now(),
    "data": {
        "person_id": "string",
        "flow_instance_id": "string",
        "step_schema_identifier": "string"
    }
}

// Example response when requesting the state of a step
{
  "request_id": 1519211809934,
  "errors": [],
  "status": 200,
  "data": {
    "step_instance_id": "string",
    "step_schema_identifier": "string",
    "state": "string (active, inactive, completed)"
  }
}

Acceptance Criteria*

Test cases that

Dependencies

Blockers:

Additional Details

Subscribing to flow / step state changes are not covered by this issue. A client will need to send another request type to subscribe to these changes.

*required field.