foundersandcoders / how-am-I-doing

:thought_balloon: CYPIAPT mental health aid for RCADS data
7 stars 1 forks source link

Routes / URL structure #47

Closed eliasmalik closed 8 years ago

eliasmalik commented 8 years ago

Aim to implement the following url structure

Views:

GET  /
GET  /login
GET  /signup
GET  /dashboard
GET  /account
GET  /account/reset
GET  /account/categories
GET  /account/info
GET  /share
GET  /visualise
GET  /questionnaires/history
GET  /questionnaires/{quid}
GET  /questionnaires/new
GET  /questionnaires/new/question/{qid}
GET  /questionnaires/new/summary

API:

POST /api/login
  payload: {
    username,
    password
  }

POST /api/signup
  payload: {
    username,
    password,
    email,
    clinician_email,
    clinicial_phone
  }

POST /api/share

POST /api/questionnaire
eliasmalik commented 8 years ago

Updates to the URL structure and backend logic for new questionnaires section:

1. GET /questionnaires/new
  1.1 User selects which categories for the questionnaire
  1.2 User submits the form

2. POST /questionnaires/new/register
  2.1 Create new uncompleted questionnaire for logged in user
  2.2 Fill in categories for newly created questionnaire
  2.3 GET /questionnaires/{QUID}/questions

3. GET /questionnaires/{QUID}/questions
  3.0 Check if QUID is marked as completed
    3.0.1 If completed, GET /questionnaires/new
  3.1 Get questions for questionnaire QUID
    3.1.1 Get categories for QUID
    3.1.2 Get questions for categories
    3.1.3 Get answers for QUID (if exist)
  3.2 Create templating data object w/ questions and answers
  3.3 Render view
  3.4 User completes questionnaire and submits the form

4. POST /questionnaires/{QUID}/answers
  4.0 Check if QUID is marked as completed
    4.0.1 If completed, GET /questionnaires/new
  4.1 Upsert all answers into the DB
  4.2 Redirect to /questionnaires/{QUID}/summary

5. GET /questionnaires/{QUID}/summary
  5.1 Get answers for QUID from DB
  5.2 Get question texts for all relevant questions from DB
  5.3 Parse answers into array of objects with qid, answer fields
  5.4 Form templating object w/ question text and answer boolean flags
  5.5 Render view
  5.6 User confirms answers
    5.6.1 POST /questionnaires/{QUID}/complete
    or
  5.7 User clicks back to make changes
    5.7.1 GET /questionnaires/{QUID}/questions

6. POST /questionnaires/{QUID}/complete
  6.2 Mark questionnaire as completed
  6.3 Redirect to /dashboard
eliasmalik commented 8 years ago

Addressed by #59 and #62