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 /createPermissionNumber endpoint #16

Open
madhavajay opened this issue May 5, 2020 · 0 comments
Open

Update /createPermissionNumber endpoint #16

madhavajay opened this issue May 5, 2020 · 0 comments

Comments

@madhavajay
Copy link
Collaborator

madhavajay commented May 5, 2020

  • rename createPermissionNumber to approvePermissionNumber
  • Change to new Request / Response types below

Request:

{
    "token": "1234567"
}
  • in a transaction
    • query diagnosis_permission_number for token
      if result count == 1:
      diagnosis_permission_number_id = uuid of returned result
      else if result count == 0 or > 1:
      - if > 1, log an error because > 1 should never happen
      break, reject transaction
    • find diagnosis_permission_number for token
    • find positive_diagnosis record by positive_diagnosis_id
    • update positive_diagnosis record to {"status": "approved"}
    • update diagnosis_permission_number record to remove "token", "positive_diagnosis_id", "created_timestamp", while adding "approved_timestamp:":
      Example updated diagnosis_permission_number
        {
            "permission_key": "arbitrarystring",
            "approved_timestamp": {{ server_timestamp }}
        }
    
    • this allows the key to be used for future reports but not re-used to token auth

If success:
Response:

{
    "status": "200"
    "message": "Report Approved"
}

If fail:
Response:

{
    "status": "404",
    "message": "Token not found"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant