VILLASweb-backend-go/routes/simulation/simulationEndpoints.go
Sonja Happ 2e7475a26b - add first draft of code for other routes (not complete!)
- some new endpoints
- some new DB queries
- some new serializers
2019-05-09 17:02:24 +02:00

47 lines
1,003 B
Go

package simulation
import (
"github.com/gin-gonic/gin"
"net/http"
)
func SimulationsRegister(r *gin.RouterGroup) {
r.GET("/", simulationsReadEp)
r.POST("/", simulationRegistrationEp)
r.PUT("/:SimulationID", simulationUpdateEp)
r.GET("/:SimulationID", simulationReadEp)
r.DELETE("/:SimulationID", simulationDeleteEp)
}
func simulationsReadEp(c *gin.Context) {
allSimulations, _, _ := FindAllSimulations()
serializer := 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 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",
})
}