VILLASweb-backend-go/serializers/simulationSerializer.go
Sonja Happ 5409c61939 Major changes:
- continue revision of folder structure
- work on model endpoints
- add skeletons for clone endpoints
2019-05-21 14:37:45 +02:00

43 lines
1.1 KiB
Go

package serializers
import (
"github.com/gin-gonic/gin"
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/common"
)
type SimulationsSerializerNoAssoc struct {
Ctx *gin.Context
Simulations []common.Simulation
}
func (self *SimulationsSerializerNoAssoc) Response() []SimulationResponseNoAssoc {
response := []SimulationResponseNoAssoc{}
for _, simulation := range self.Simulations {
serializer := SimulationSerializerNoAssoc{self.Ctx, simulation}
response = append(response, serializer.Response())
}
return response
}
type SimulationSerializerNoAssoc struct {
Ctx *gin.Context
common.Simulation
}
type SimulationResponseNoAssoc struct {
Name string `json:"Name"`
ID uint `json:"SimulationID"`
Running bool `json:"Running"`
//StartParams postgres.Jsonb `json:"Starting Parameters"`
}
func (self *SimulationSerializerNoAssoc) Response() SimulationResponseNoAssoc {
response := SimulationResponseNoAssoc{
Name: self.Name,
ID: self.ID,
Running: self.Running,
//StartParams: self.StartParameters,
}
return response
}