Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A client can subscribe to active flow state and active step changes #68

Open
Tracked by #58
tomtitherington opened this issue Feb 25, 2024 · 0 comments
Open
Tracked by #58
Labels
blocked: conflict/dependency Something else is blocking this. scope: backend Work involving the backend / Django REST project. scope: tests Work relating to tests. size: hours This should take less than a day. type: feature A piece of functionality of the product.

Comments

@tomtitherington
Copy link
Contributor

tomtitherington commented Feb 25, 2024

Background & Context*

Once a client has a valid Websocket connection to the server, they should be able to subscribe to change notifications from the FlowInstance and StepInstance models related to the current Person associated with the session.

Goal*

A client should be able to subscribe to active flow and active step changes for the specified person.

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. Subscribing once produces the same outcome as subscribing n times.

// Example request when subscribing to Flow state changes
{
    "action": "subscribe_state_change",
    "request_id" : Date.now(),
    "data": {
        "person_key": "string",
        "entity" : "flow",
    }
}

// Example request when subscribing to Step state changes
{
    "action": "subscribe_state_change",
    "request_id" : Date.now(),
    "data": {
        "person_key": "string",
        "entity" : "step",
    }
}

// Example response for Flow/Step state change subscriptions
{
  "request_id": 1519211809934,
  "errors": [],
  "status": 200,
}


// Example events (flow and step changes)
{
    "event": "state_change",
    "request_id": 1519211809934,
    "data": {
        "entity": "flow",
        "id": "string",
        "identifier": "string",
        "state": "string (active, inactive, completed, exited)",
        "previous_state": "string"
    }
}

{
    "event": "state_change",
    "request_id": 1519211809934,
    "data": {
        "entity": "step",
        "id": "string",
        "identifier": "string",
        "state": "string (active, inactive, completed)",
        "previous_state": "string"
    }
}

Acceptance Criteria*

Test cases that

  • Assert that given a valid Person.id and entity type the server will respond with a 200 / status OK.
  • Assert that given a valid Person.id and entity type the server will provide a JSON response in the format and structure defined above.
  • Assert that once first called and the response was successful, changing the state of a flow or step will generate a response as outlined above.
  • Assert that an invalid Person.id or entity type will indicate that the Person.id or entity type was invalid or general 404.

Dependencies

Blockers:

*required field.

This was referenced Feb 25, 2024
@tomtitherington tomtitherington added type: feature A piece of functionality of the product. scope: backend Work involving the backend / Django REST project. scope: tests Work relating to tests. size: hours This should take less than a day. blocked: conflict/dependency Something else is blocking this. labels Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: conflict/dependency Something else is blocking this. scope: backend Work involving the backend / Django REST project. scope: tests Work relating to tests. size: hours This should take less than a day. type: feature A piece of functionality of the product.
Projects
Status: 🔖 Planned
Development

No branches or pull requests

1 participant