feat: refac and add key deletion route
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package routes
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"orbits-server/internal/server/api/assets"
|
||||
"orbits-server/internal/server/service"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func RegisterCtrlRoutes(api *gin.RouterGroup, db *gorm.DB) {
|
||||
ctrlService := service.NewControlService(db)
|
||||
// define the control route on the api
|
||||
// /api/control
|
||||
ctrl := api.Group("/control")
|
||||
// Display the information on what is going on at the moment
|
||||
ctrl.GET("/command", func(c *gin.Context) {
|
||||
command, err := ctrlService.ListLatestCommand()
|
||||
if err != nil {
|
||||
slog.Error("unable to determine state", "error", err)
|
||||
assets.InternalErrorResponse(c)
|
||||
return
|
||||
}
|
||||
|
||||
assets.BasicResponse(c, command)
|
||||
})
|
||||
|
||||
ctrl.PATCH("/command", func(c *gin.Context) {
|
||||
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user