mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00

- continue revision of folder structure - work on model endpoints - add skeletons for clone endpoints
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package serializers
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/jinzhu/gorm/dialects/postgres"
|
|
|
|
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/common"
|
|
)
|
|
|
|
type ModelsSerializer struct {
|
|
Ctx *gin.Context
|
|
Models []common.Model
|
|
}
|
|
|
|
func (self *ModelsSerializer) Response() []ModelResponse {
|
|
response := []ModelResponse{}
|
|
for _, model := range self.Models {
|
|
serializer := ModelSerializer{self.Ctx, model}
|
|
response = append(response, serializer.Response())
|
|
}
|
|
return response
|
|
}
|
|
|
|
type ModelSerializer struct {
|
|
Ctx *gin.Context
|
|
common.Model
|
|
}
|
|
|
|
type ModelResponse struct {
|
|
Name string `json:"Name"`
|
|
OutputLength int `json:"OutputLength"`
|
|
InputLength int `json:"InputLength"`
|
|
SimulationID uint `json:"SimulationID"`
|
|
SimulatorID uint `json:"SimulatorID"`
|
|
StartParams postgres.Jsonb `json:"StartParams"`
|
|
//StartParams postgres.Jsonb `json:"Starting Parameters"`
|
|
//Output Mapping
|
|
//Input Mapping
|
|
}
|
|
|
|
func (self *ModelSerializer) Response() ModelResponse {
|
|
response := ModelResponse{
|
|
Name: self.Name,
|
|
OutputLength: self.OutputLength,
|
|
InputLength: self.InputLength,
|
|
SimulationID: self.SimulationID,
|
|
SimulatorID: self.SimulatorID,
|
|
StartParams: self.StartParameters,
|
|
//InputMapping
|
|
//OutputMapping
|
|
}
|
|
return response
|
|
}
|
|
|