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
66 lines
No EOL
1.3 KiB
Go
66 lines
No EOL
1.3 KiB
Go
package endpoints
|
|
|
|
import (
|
|
"fmt"
|
|
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/queries"
|
|
"git.rwth-aachen.de/acs/public/villas/villasweb-backend-go/serializers"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
"strconv"
|
|
)
|
|
|
|
|
|
func simulationReadAllEp(c *gin.Context) {
|
|
allSimulations, _, _ := queries.FindAllSimulations()
|
|
serializer := serializers.SimulationsSerializerNoAssoc{c, allSimulations}
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"simulations": serializer.Response(),
|
|
})
|
|
}
|
|
|
|
func simulationRegistrationEp(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "NOT implemented",
|
|
})
|
|
}
|
|
|
|
func simulationCloneEp(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "NOT implemented",
|
|
})
|
|
}
|
|
|
|
func simulationUpdateEp(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "NOT implemented",
|
|
})
|
|
}
|
|
|
|
func simulationReadEp(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "NOT implemented",
|
|
})
|
|
}
|
|
|
|
func simulationDeleteEp(c *gin.Context) {
|
|
c.JSON(http.StatusOK, gin.H{
|
|
"message": "NOT implemented",
|
|
})
|
|
}
|
|
|
|
|
|
func GetSimulationID(c *gin.Context) (int, error) {
|
|
|
|
simID, err := strconv.Atoi(c.Param("SimulationID"))
|
|
|
|
if err != nil {
|
|
errormsg := fmt.Sprintf("Bad request. No or incorrect format of simulation ID")
|
|
c.JSON(http.StatusBadRequest, gin.H{
|
|
"error": errormsg,
|
|
})
|
|
return -1, err
|
|
} else {
|
|
return simID, err
|
|
|
|
}
|
|
} |