mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package simulation
|
|
|
|
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
|
|
}
|