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

new endpoint /workflows/response #1927

Open
3 of 10 tasks
Tracked by #1922
humansinstitute opened this issue Nov 11, 2024 · 5 comments
Open
3 of 10 tasks
Tracked by #1922

new endpoint /workflows/response #1927

humansinstitute opened this issue Nov 11, 2024 · 5 comments
Labels

Comments

@humansinstitute
Copy link
Contributor

humansinstitute commented Nov 11, 2024

Context

  • Problem: We need to handle responses from Stakwork efficiently and take the next action on the response data.
  • Why it's needed: This endpoint is crucial for maintaining the integrity and accuracy of our workflow tracking system by ensuring that all responses are logged and processed correctly.
  • Larger System Fit: This endpoint is part of the Stakwork Common Workflow Plumbing feature, which aims to streamline and automate workflow processes.
  • Background: The /workflows/response endpoint will update the wf_requests table with response data, ensuring that the status of each request is accurately tracked.

This is related to a broader project defined here:
For context see: #1922

System Schematic:

image

Design

The logical flow to process a response is:
image

  1. "/workflow/response"
  2. On receipt of response object.
  3. Use requestUUID to load response data into DB wf_requests
  4. Create action object (union of requestObject and responseObject)
    POST to /workflow/action
{
    "source": "string",
    "requestUUID": "string",
    "action": "string"
    "workflowID": interger,
    "formData": { object },
    "responseData": { object }
}
  • Endpoint: /workflows/response

  • HTTP Method: POST

  • Request Body: JSON object containing response data from Stakwork.

    • Example:
      {
        "request_id": "12345",
        "status": "completed",
        "response_data": {
          "key1": "value1",
          "key2": "value2"
        }
      }
  • Database Interaction: Update the wf_requests table with the response data based on request_id.

  • Database Interaction: Use the wf_processing_map to check for next processing action based on action.

Task Breakdown

Assignment Criteria

  • Required Knowledge/Skills:
    • Proficiency in the primary programming language and framework used in the project.
    • Understanding of RESTful API design and database operations.
  • Communication Channels:
    • Ensure you are live on Sphinx V2 for team communication.

Acceptance Criteria

  • The /workflows/response endpoint accepts POST requests with valid JSON response data.
  • The endpoint updates the wf_requests table with the correct response data based on request_id.
  • The endpoint returns a 200 HTTP status code and a success message upon successful update.
  • The endpoint returns an appropriate error message and status code for invalid requests or update failures.
  • The implementation includes unit tests covering both successful and failure scenarios.
  • The endpoint is documented in the API documentation.
@MuhammadUmer44
Copy link
Contributor

@humansinstitute I can help?

@sophieturner0
Copy link
Contributor

@humansinstitute Please assign me?

@MahtabBukhari
Copy link
Contributor

@humansinstitute assign me?

@humansinstitute
Copy link
Contributor Author

This would be blocked until this ticket is merged to allow access to the wf_requests table: #1925

@aliraza556
Copy link
Contributor

@humansinstitute, Please assign me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants