VILLASweb-backend-go/routes/simulationmodel/simulationmodelEnpoints.go
Sonja Happ e03f076161 - rename "cimfile" to "file"
- fix API documentation
- move /uploads POST endpoint to /files POST
- add /files/FileID PUT endpoint for updating files
- mark removed and new endpoints in API doc
2019-05-16 09:27:44 +02:00

60 lines
No EOL
1.5 KiB
Go

package simulationmodel
import (
"github.com/gin-gonic/gin"
"net/http"
)
func SimulationModelsRegister(r *gin.RouterGroup) {
r.GET("/", simulationmodelsReadEp)
r.POST("/", simulationmodelRegistrationEp)
r.PUT("/:SimulationModelID", simulationmodelUpdateEp)
r.GET("/:SimulationModelID", simulationmodelReadEp)
r.DELETE("/:SimulationModelID", simulationmodelDeleteEp)
r.GET("/:SimulationModelID/file", simulationmodelReadFileEp) // NEW in API
r.PUT("/:SimulationModelID/file", simulationmodelUpdateFileEp) // NEW in API
}
func simulationmodelsReadEp(c *gin.Context) {
allSimulationModels, _, _ := FindAllSimulationModels()
serializer := SimulationModelsSerializerNoAssoc{c, allSimulationModels}
c.JSON(http.StatusOK, gin.H{
"simulationmodels": serializer.Response(),
})
}
func simulationmodelRegistrationEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func simulationmodelUpdateEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func simulationmodelReadEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func simulationmodelDeleteEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func simulationmodelReadFileEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func simulationmodelUpdateFileEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}