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

Update ticket function block #2

Open
uttahb opened this issue Oct 6, 2023 · 6 comments
Open

Update ticket function block #2

uttahb opened this issue Oct 6, 2023 · 6 comments

Comments

@uttahb
Copy link
Contributor

uttahb commented Oct 6, 2023

Add Function block for Updating Tickets in TMS

Issue:
Create a new endpoint open_tms_update_ticket in the backend under the directory backend/open_tms_update_ticket to handle ticket update in the Ticket Management System (TMS).

Tables:

  • tickets
  • ticket_revisions
  • ticket_activity

Input Signature:

  • Request Method: POST
  • Body:
    {
      "ticket_id": "<ticket id>",
      "to_stage": "<stage_id to be updated to>",
      "assignee_id": "<department_id>"
      "remarks": "<remarks while rejecting a ticket>" (optional)
      "name":"<title to be updated in case ticket is revised>" (optional)
      "description":"<description to be updated in case ticket is revised>" (optional)
    }
  • Is Authenticated: Yes

Response Signature:

  • Success:
    {
      "meta": {
          "status": 200,
          "message": "Ticket updated successfully"
      },
      "data": {
          "ticket_id": "<id of the created ticket>",
          "ticket_revision_id": "<id of the ticket revision created>",
          "ticket_activity_id": "<id of the ticket activity>"
      }
    }
  • Error in Authentication:
    {
      "status": 401,
      "message": {
        "data": {
          "error": "<auth failed>"
        }
      }
    }
    Error with invalid next stage or assignee data:
    {
      "meta": {
        "status": 400,
        "message": "Bad Request"
      },
      "errors": [
        {
          "code": "BAD_REQUESt",
          "message": "Next stage or assignee is invalid."
        }
      ]
    }
  • Any Other Internal Error:
    {
      "meta": {
        "status": 500,
        "message": "Something went wrong."
      },
      "errors": [
        {
          "code": "INTERNAL_ERROR",
          "message": "Something went wrong."
        }
      ]
    }

Expected Workflow:

  1. Authenticate the request and build the user context in the middleware.
  2. Find the latest ticket revision
  3. find the latest ticket activity for latest ticket revision
  4. find the current stage from ticket activity
  5. Validate the to stage and assignee with the available process path from current stage
  6. If validated successfully add one entry to the ticket_activity table with the to stage and assignee data.
  7. If ticket needs to be revised create a new entry to the ticket_revision table with update description and title.After that create a row in the ticket_activity table with newly created ticket_revision_id as foreign key.
  8. If validation fails, send proper error message
  9. Capture errors and send appropriate error messages based on the response structure to the frontend.
  10. If the workflow completes successfully, send a success message as per response signature to the frontend.
@HarshitVashisht11
Copy link

@uttahb i have made a PR please review my PR

@uttahb
Copy link
Contributor Author

uttahb commented Oct 15, 2023

@HarshitVashisht11 Sure, thanks mate, will update my comments in PR

@jude98
Copy link
Contributor

jude98 commented Oct 21, 2023

Hi @uttahb, Can i work on this issue?

@uttahb
Copy link
Contributor Author

uttahb commented Oct 24, 2023

Hi @jude98 please go ahead!

@Harshil0512
Copy link

Hello @uttahb, I would like to work on this issue

@ShivamAgarwal-code
Copy link

@uttahb can I work in this issue?

Athuln added a commit that referenced this issue Jan 5, 2024
Update ticket function block #2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants