TGICS/backend/src/routes/surveyRoutes.js

69 lines
1.3 KiB
JavaScript

const {
createSurvey,
getCounts,
getCount,
listSurveys,
getDraft,
saveDraft,
deleteDraft,
} = require('../controllers/surveyController');
module.exports = [
{
method: 'POST',
path: '/api/surveys',
options: {
description: 'Submit a patient survey for a TGICS doctor',
},
handler: createSurvey,
},
{
method: 'GET',
path: '/api/surveys',
options: {
description: 'List patient surveys for a doctor contact_id',
},
handler: listSurveys,
},
{
method: 'GET',
path: '/api/surveys/draft',
options: {
description: 'Load survey draft for a doctor contact',
},
handler: getDraft,
},
{
method: 'PUT',
path: '/api/surveys/draft',
options: {
description: 'Upsert survey draft answers',
},
handler: saveDraft,
},
{
method: 'DELETE',
path: '/api/surveys/draft',
options: {
description: 'Clear survey draft for a doctor contact',
},
handler: deleteDraft,
},
{
method: 'GET',
path: '/api/surveys/counts',
options: {
description: 'Batch survey counts by contact_ids (comma-separated)',
},
handler: getCounts,
},
{
method: 'GET',
path: '/api/surveys/count',
options: {
description: 'Single contact survey count',
},
handler: getCount,
},
];