mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
dev day #70
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user