Skip to content

Commit

Permalink
use dto for heat estimation date change
Browse files Browse the repository at this point in the history
  • Loading branch information
konrad2002 committed Jun 7, 2024
1 parent 5c8f846 commit 686f767
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions controller/heat_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"go.mongodb.org/mongo-driver/bson/primitive"
"net/http"
"strconv"
"time"
)

func heatController() {
Expand Down Expand Up @@ -304,13 +303,13 @@ func updateHeatsStartEstimationDate(c *gin.Context) {
return
}

var request time.Time
var request dto.HeatEstimationDateRequest
if err := c.BindJSON(&request); err != nil {
c.IndentedJSON(http.StatusInternalServerError, gin.H{"message": err.Error()})
return
}

info, err := service.UpdateHeatsEstimationDateByMeetingAndEvent(meeting, event, request)
info, err := service.UpdateHeatsEstimationDateByMeetingAndEvent(meeting, event, request.Time)
if err != nil {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": err.Error()})
return
Expand Down
7 changes: 7 additions & 0 deletions dto/heat_estimation_date_request.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dto

import "time"

type HeatEstimationDateRequest struct {
Time time.Time `json:"time"`
}

0 comments on commit 686f767

Please sign in to comment.