This commit is contained in:
nemunaire 2022-10-02 23:24:53 +02:00
parent be8ff3466a
commit a9be05854c
11 changed files with 331 additions and 12 deletions

37
api/actions.go Normal file
View file

@ -0,0 +1,37 @@
package api
import (
"net/http"
"github.com/gin-gonic/gin"
"git.nemunai.re/nemunaire/reveil/config"
)
func declareActionsRoutes(cfg *config.Config, router *gin.RouterGroup) {
router.GET("/actions", func(c *gin.Context) {
})
router.POST("/actions", func(c *gin.Context) {
})
actionsRoutes := router.Group("/actions/:gid")
actionsRoutes.Use(actionHandler)
actionsRoutes.GET("", func(c *gin.Context) {
c.JSON(http.StatusOK, c.MustGet("action"))
})
actionsRoutes.PUT("", func(c *gin.Context) {
c.JSON(http.StatusOK, c.MustGet("action"))
})
actionsRoutes.DELETE("", func(c *gin.Context) {
c.JSON(http.StatusOK, c.MustGet("action"))
})
}
func actionHandler(c *gin.Context) {
c.Set("action", nil)
c.Next()
}