This commit is contained in:
Tomas Dvorak
2025-10-24 14:52:46 +02:00
parent 70ea0c3c91
commit 8a7c292e54
41 changed files with 912 additions and 404 deletions
+9
View File
@@ -129,6 +129,7 @@ func (pc *PollController) CreatePoll(c *gin.Context) {
Title string `json:"title" binding:"required"`
Description string `json:"description"`
Type string `json:"type"`
Style string `json:"style"`
Status string `json:"status"`
StartDate *time.Time `json:"start_date"`
EndDate *time.Time `json:"end_date"`
@@ -166,6 +167,7 @@ func (pc *PollController) CreatePoll(c *gin.Context) {
Title: input.Title,
Description: input.Description,
Type: input.Type,
Style: input.Style,
Status: input.Status,
StartDate: input.StartDate,
EndDate: input.EndDate,
@@ -188,6 +190,9 @@ func (pc *PollController) CreatePoll(c *gin.Context) {
if poll.Type == "" {
poll.Type = "single"
}
if poll.Style == "" {
poll.Style = "auto"
}
if poll.Status == "" {
poll.Status = "draft"
}
@@ -250,6 +255,7 @@ func (pc *PollController) UpdatePoll(c *gin.Context) {
Title *string `json:"title"`
Description *string `json:"description"`
Type *string `json:"type"`
Style *string `json:"style"`
Status *string `json:"status"`
StartDate *time.Time `json:"start_date"`
EndDate *time.Time `json:"end_date"`
@@ -282,6 +288,9 @@ func (pc *PollController) UpdatePoll(c *gin.Context) {
if input.Type != nil {
poll.Type = *input.Type
}
if input.Style != nil {
poll.Style = *input.Style
}
if input.Status != nil {
poll.Status = *input.Status
}