implement command update-title
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 4s

This commit is contained in:
Thomas Peetz
2026-10-12 17:37:06 +02:00
parent f5e9cbc423
commit 4c603a8eff
8 changed files with 145 additions and 31 deletions
@@ -8,6 +8,7 @@ import (
"net/http"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/slog"
"github.com/gin-gonic/gin"
"gorm.io/gorm"
)
@@ -58,6 +59,22 @@ func (handler *MediaLoFiHandler) Add(c *gin.Context) {
c.JSON(http.StatusOK, lofi)
}
func (handler *MediaLoFiHandler) Update(c *gin.Context) {
var input models.MediaLoFiDTO
if err := c.ShouldBindJSON(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
lofi, err := handler.Service.Update(c.Request.Context(), input)
if err != nil {
logger := slog.Get(c)
logger.Info("MediaLoFiHandler#Update", "error", err.Error())
c.JSON(http.StatusNotFound, gin.H{"error": "lofi not updated"})
return
}
c.JSON(http.StatusOK, lofi)
}
func (handler *MediaLoFiHandler) Delete(c *gin.Context) {
id := c.Param("id")
err := handler.Service.Delete(c.Request.Context(), id)