package features_survey import ( "github.com/gofiber/fiber/v2" // . "MY/webapp/common" ) type Question struct { Id int64 Question string Answer bool Result int } type Survey struct { Id int64 Title string Description string Date string Respondents int State string Questions []Question } func QueryData() Survey { return Survey{ Title: "Sample Survey", Description: "The description.", Date: "01/20/26", Respondents: 200, State: "Finished", Questions: []Question{ { Id: 1, Question: "Do you like HTML?", Answer: true, // TODO: just for prototyping, needs to be a better model Result: 20, }, { Id: 2, Question: "Do you like CSS?", Answer: false, Result: 11, }, { Id: 3, Question: "Do you like JavaScript?", Answer: true, Result: 43, }, { Id: 4, Question: "Are you a programmer?", Answer: true, Result: 28, }, }, } } func GetPageIndex(c *fiber.Ctx) error { return c.Render("survey/index", fiber.Map{ "Survey": QueryData(), }) } func GetPageSubmit(c *fiber.Ctx) error { return c.Render("survey/submit", fiber.Map{ "Survey": QueryData(), }) } func GetPageFinalize(c *fiber.Ctx) error { return c.Render("survey/finalize", fiber.Map{}) } func GetPageResults(c *fiber.Ctx) error { return c.Render("survey/results", fiber.Map{ "Survey": QueryData(), }) } func SetupViews(app *fiber.App) { app.Get("/survey/", GetPageIndex) app.Get("/survey/submit", GetPageSubmit) app.Get("/survey/finalize", GetPageFinalize) app.Get("/survey/results", GetPageResults) }