issues
search
precisely
/
web
1
stars
0
forks
source link
Build Survey Question Models and GraphQL API
#379
Open
aneilbaboo
opened
5 years ago
aneilbaboo
commented
5 years ago
Survey / SurveyVersions approach
Models
Survey
Id: hashkey
Title
ownerId: string
currentPublishedVersionId: versionId
draftVersionId: versionId
SurveyVersion
surveyId: hashkey (unique to each survey version)
versionId: rangeKey (string representing a number an iso timestamp)
questions: JSON (surveyjs data)
GraphQL API
Objects
Survey object
id - uuid
title
ownerId
currentPublishedVersionId
draftVersionId
currentPublishedVersion => SurveyVersion object
draftVersion => SurveyVersion object
versions => list of survey versions
SurveyVersion object
surveyId
versionId
questions
Query
survey(id)- gets a survey
surveys(state: ‘published’ | ‘draft’ |’all’ ) - all surveys
Mutations
saveSurvey
If id provided, then create Survey and SurveyVersion (new draft)
Otherwise, provide id => saved questions overwrite draft SurveyVersion
publishSurvey (surveyId)
deleteSurvey
unpublishSurvey (surveyId) ? - not yet
gcv
commented
5 years ago
PR:
https://github.com/precisely/web/pull/386