VILLASweb-backend-go/routes/project/projectEndpoints.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

46 lines
942 B
Go

package project
import (
"github.com/gin-gonic/gin"
"net/http"
)
func ProjectsRegister(r *gin.RouterGroup) {
r.GET("/", projectsReadEp)
r.POST("/", projectRegistrationEp)
r.PUT("/:ProjectID", projectUpdateEp)
r.GET("/:ProjectID", projectReadEp)
r.DELETE("/:ProjectID", projectDeleteEp)
}
func projectsReadEp(c *gin.Context) {
allProjects, _, _ := FindAllProjects()
serializer := ProjectsSerializerNoAssoc{c, allProjects}
c.JSON(http.StatusOK, gin.H{
"projects": serializer.Response(),
})
}
func projectRegistrationEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func projectUpdateEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func projectReadEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func projectDeleteEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}