completed adding MediaLofi for kontor-gin
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
This commit is contained in:
@@ -43,6 +43,21 @@ func (handler *MediaActorHandler) Get(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, actor)
|
||||
}
|
||||
|
||||
func (handler *MediaActorHandler) Add(c *gin.Context) {
|
||||
var input models.MediaActorAdd
|
||||
|
||||
if err := c.ShouldBindJSON(&input); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
actor, err := handler.Service.Add(c.Request.Context(), input.WebLink)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "lofi not added"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, actor)
|
||||
}
|
||||
|
||||
func (handler *MediaActorHandler) Delete(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
err := handler.Service.Delete(c.Request.Context(), id)
|
||||
|
||||
@@ -33,6 +33,41 @@ func (handler *MediaActorFileHandler) List(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, dtos)
|
||||
}
|
||||
|
||||
func (handler *MediaActorFileHandler) Get(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
actor, err := handler.Service.Get(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "sport not found"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, actor)
|
||||
}
|
||||
|
||||
func (handler *MediaActorFileHandler) Add(c *gin.Context) {
|
||||
var input models.MediaActorFileAdd
|
||||
|
||||
if err := c.ShouldBindJSON(&input); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
actorfile, err := handler.Service.Add(c.Request.Context(), input.MediaActorID, input.MediaFileID)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "lofi not added"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, actorfile)
|
||||
}
|
||||
|
||||
func (handler *MediaActorFileHandler) Delete(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
err := handler.Service.Delete(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "sport not found"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"ok": "true"})
|
||||
}
|
||||
|
||||
func (handler *MediaActorFileHandler) ListPage(c *gin.Context) {
|
||||
session := sessions.Default(c)
|
||||
user := session.Get(globals.UserKey)
|
||||
|
||||
@@ -36,6 +36,31 @@ func (handler *MediaFileHandler) List(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, dtos)
|
||||
}
|
||||
|
||||
func (handler *MediaFileHandler) Add(c *gin.Context) {
|
||||
var input models.MediaFileAdd
|
||||
|
||||
if err := c.ShouldBindJSON(&input); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
lofi, err := handler.Service.Add(c.Request.Context(), input.Url)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "lofi not added"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, lofi)
|
||||
}
|
||||
|
||||
func (handler *MediaFileHandler) Delete(c *gin.Context) {
|
||||
id := c.Param("id")
|
||||
err := handler.Service.Delete(c.Request.Context(), id)
|
||||
if err != nil {
|
||||
c.JSON(http.StatusNotFound, gin.H{"error": "lofi not found"})
|
||||
return
|
||||
}
|
||||
c.JSON(http.StatusOK, gin.H{"ok": "true"})
|
||||
}
|
||||
|
||||
func (handler *MediaFileHandler) ListPage(c *gin.Context) {
|
||||
session := sessions.Default(c)
|
||||
user := session.Get(globals.UserKey)
|
||||
|
||||
Reference in New Issue
Block a user