VILLASweb-backend-go/routes/file/fileEndpoints.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

46 lines
910 B
Go

package file
import (
"github.com/gin-gonic/gin"
"net/http"
)
func FilesRegister(r *gin.RouterGroup) {
r.GET("/", filesReadEp)
r.POST("/", fileRegistrationEp) // NEW in API
r.PUT("/:FileID", fileUpdateEp) // NEW in API
r.GET("/:FileID", fileReadEp)
r.DELETE("/:FileID", fileDeleteEp)
}
func filesReadEp(c *gin.Context) {
allFiles, _, _ := FindAllFiles()
serializer := FilesSerializerNoAssoc{c, allFiles}
c.JSON(http.StatusOK, gin.H{
"files": serializer.Response(),
})
}
func fileRegistrationEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func fileUpdateEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func fileReadEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}
func fileDeleteEp(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"message": "NOT implemented",
})
}