vocdoni / vaas-api

Centralized backend & server for Vocdoni's Voting-as-a-Service API
GNU Affero General Public License v3.0
2 stars 1 forks source link

Process info apis #7

Closed NateWilliams2 closed 2 years ago

NateWilliams2 commented 2 years ago

This pr implements the getProcessInfo REST call. The only blocked part is querying the db for processes, because the db methods need updating. For now, I propose we merge this (using dummy processes instead of real ones from the db) for testing & integration purposes.

example call of process info api:

$ curl -X GET http://0.0.0.0:8000/api/pub/processes/47f2c1f1164a27db4f5e7b825f8ec064c44da88a83ff72b90e5755fff8bfb53b -H "Authorization: Bearer c553cd753d538b1302d27983a6d9fe00639f06aa7c5ddc8256bd0e3c20d281f6"
{
  "type": "blind-confidential-hidden-results",
  "title": "test election",
  "description": "description test 1",
  "header": "https://source.unsplash.com/random/800x600",
  "questions": [
    {
      "title": "test q1",
      "description": "",
      "choices": [
        "Yes",
        "No"
      ]
    },
    {
      "title": "test q2",
      "description": "",
      "choices": [
        "Yes",
        "No"
      ]
    },
    {
      "title": "test q3",
      "description": "",
      "choices": [
        "Yes",
        "No"
      ]
    }
  ],
  "status": "Results",
  "streamUri": "uri",
  "vote_count": 1,
  "results": [
    {
      "title": [
        "Yes",
        "No"
      ],
      "value": [
        "1",
        "0"
      ]
    },
    {
      "title": [
        "Yes",
        "No"
      ],
      "value": [
        "1",
        "0"
      ]
    },
    {
      "title": [
        "Yes",
        "No"
      ],
      "value": [
        "1",
        "0"
      ]
    }
  ],
  "entityId": "20323909c3e0965d1489893db1512b32b55707ea",
  "ok": true,
  "processId": "47f2c1f1164a27db4f5e7b825f8ec064c44da88a83ff72b90e5755fff8bfb53b",
  "start_block": "2090900",
  "end_block": "2091900",
  "ResultsAggregation": "discrete-counting",
  "ResultsDisplay": "multiple-question"
}