Skip to content
Snippets Groups Projects
Commit 89b89c5c authored by Tucker Siegel's avatar Tucker Siegel
Browse files

minor updates

parent cd68d480
No related branches found
No related tags found
No related merge requests found
To build swagger: # Weather server
`swag init --parseDependency --parseInternal`
Used to serve gdd, cfs, and gefs data, and can be expanded to more data
Still need to add CFS/GEFS, and confidence intervals
In the future, the errors folder might be moved to a common package when more go services are built to have shared error In the future, the errors folder might be moved to a common package when more go services are built to have shared error
handling across all services handling across all services
To run: `go run main.go`
Build to executable: `go build`
To rebuild swagger: `swag init`
...@@ -3,11 +3,11 @@ package models ...@@ -3,11 +3,11 @@ package models
import ( import (
"dawn-weather/errors" "dawn-weather/errors"
"dawn-weather/persistence/entities" "dawn-weather/persistence/entities"
validation "github.com/go-ozzo/ozzo-validation"
"github.com/gofiber/fiber/v2"
"go.mongodb.org/mongo-driver/bson/primitive"
"strconv" "strconv"
"time" "time"
validation "github.com/go-ozzo/ozzo-validation"
"github.com/gofiber/fiber/v2"
) )
type GddResponse struct { type GddResponse struct {
...@@ -15,7 +15,7 @@ type GddResponse struct { ...@@ -15,7 +15,7 @@ type GddResponse struct {
NearestLatitude float64 `json:"nearest_latitude"` NearestLatitude float64 `json:"nearest_latitude"`
NearestLongitude float64 `json:"nearest_longitude"` NearestLongitude float64 `json:"nearest_longitude"`
GddValues []float64 `json:"gdd_values"` GddValues []float64 `json:"gdd_values"`
LastDate primitive.DateTime `json:"last_date"` LastDate string `json:"last_date"`
} }
type GddRequest struct { type GddRequest struct {
......
...@@ -74,7 +74,7 @@ func GetGddValues(request models.GddRequest) models.GddResponse { ...@@ -74,7 +74,7 @@ func GetGddValues(request models.GddRequest) models.GddResponse {
NearestLatitude: gdds.Location.Coordinates[1], NearestLatitude: gdds.Location.Coordinates[1],
NearestLongitude: gdds.Location.Coordinates[0], NearestLongitude: gdds.Location.Coordinates[0],
GddValues: CalculateGddValues(gdds.MinTemps, gdds.MaxTemps, product, request.Accumulate), GddValues: CalculateGddValues(gdds.MinTemps, gdds.MaxTemps, product, request.Accumulate),
LastDate: gdds.LastDate, LastDate: gdds.LastDate.Time().String(),
} }
return returnGdds return returnGdds
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment