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:
@@ -22,7 +22,7 @@ type LoginResponse struct {
|
||||
|
||||
type ExportData struct {
|
||||
Sport models.SportDTOList `json:"sport"`
|
||||
Player []models.PlayerDTO `json:"player"`
|
||||
Player models.PlayerDTOList `json:"player"`
|
||||
Team []models.TeamDTO `json:"team"`
|
||||
Position []models.PositionDTO `json:"field_position"`
|
||||
Rooster []models.RoosterDTO `json:"rooster"`
|
||||
@@ -65,6 +65,8 @@ func (e *ExportData) GetMap() map[string]any {
|
||||
switch path {
|
||||
case "tysc/sports":
|
||||
dataMap["sports"] = value
|
||||
case "tysc/players":
|
||||
dataMap["players"] = value
|
||||
}
|
||||
}
|
||||
return dataMap
|
||||
@@ -133,6 +135,7 @@ func GetData(server config.Server, apiVersion string) (data *ExportData, err err
|
||||
var login LoginResponse
|
||||
|
||||
client := resty.New()
|
||||
client.SetLoggerWarnLevel(true)
|
||||
PostJSON(client, server, "api/login", &login)
|
||||
|
||||
for path, value := range Registry {
|
||||
@@ -197,7 +200,7 @@ func WriteJson(data *ExportData, fileName string) error {
|
||||
|
||||
func GetJSON(client *resty.Client, token string, server config.Server, path string, v any) {
|
||||
url := fmt.Sprintf("%s/%s/%s", server.Url, config.Config.ApiVersion, path)
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("GetJSON", "url", url)
|
||||
}
|
||||
_, err := client.R().
|
||||
@@ -208,14 +211,14 @@ func GetJSON(client *resty.Client, token string, server config.Server, path stri
|
||||
if err != nil {
|
||||
slog.Info(url, "error", err.Error())
|
||||
}
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("GetJSON", "value", v)
|
||||
}
|
||||
}
|
||||
|
||||
func PostJSON(client *resty.Client, server config.Server, path string, v any) {
|
||||
url := fmt.Sprintf("%s/%s", server.Url, path)
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("PostJSON", "url", url)
|
||||
}
|
||||
_, err := client.R().
|
||||
@@ -229,7 +232,7 @@ func PostJSON(client *resty.Client, server config.Server, path string, v any) {
|
||||
if err != nil {
|
||||
slog.Info("PostJSON", "error", err.Error())
|
||||
}
|
||||
if config.Verbose > 1 {
|
||||
if config.Verbose > 2 {
|
||||
slog.Info(url, "token", v)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,19 @@ var addLinksCmd = &cobra.Command{
|
||||
token := api.GetToken(client, localServer)
|
||||
for _, line := range lines {
|
||||
lofiAdd := models.MediaLofiAdd{Url: line}
|
||||
addResult := &models.MediaLoFi{}
|
||||
response, err := client.R().
|
||||
SetBody(lofiAdd).
|
||||
SetAuthToken(token).
|
||||
SetHeader("Accept", "application/json").
|
||||
Post("http://localhost:8550/api/v1/media/lofi")
|
||||
SetResult(addResult).
|
||||
Post("http://localhost:8550/api/v1/media/lofis")
|
||||
if err != nil {
|
||||
slog.Info("Add Lofi", "error", err.Error())
|
||||
}
|
||||
if addResult != nil {
|
||||
slog.Info("Lofi added", "lofi", addResult)
|
||||
}
|
||||
slog.Info("Add Lofi", "status", response.StatusCode(), "body", response.Body)
|
||||
}
|
||||
},
|
||||
|
||||
@@ -19,18 +19,23 @@ var syncCmd = &cobra.Command{
|
||||
slog.Info("sync kontor")
|
||||
apiVersion := viper.GetString("api")
|
||||
mainServer := config.Config.Server["main"]
|
||||
slog.Info("syncCmd#Run", "mainServer", mainServer)
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("syncCmd#Run", "mainServer", mainServer)
|
||||
}
|
||||
localServer := config.Config.Server["local"]
|
||||
sourceData, _ := api.GetData(mainServer, apiVersion)
|
||||
targetData, _ := api.GetData(localServer, apiVersion)
|
||||
slog.Info("Size of targetData", "size", reflect.TypeOf(targetData).Size())
|
||||
if config.Verbose > 2 {
|
||||
slog.Info("Size of targetData", "size", reflect.TypeOf(targetData).Size())
|
||||
}
|
||||
// find missing items in target and collect items not available in source
|
||||
for table, item_list := range sourceData.GetMap() {
|
||||
slog.Info("iterate sourceData", "table", table, "count", reflect.TypeOf(item_list).Size())
|
||||
switch table {
|
||||
case "sports":
|
||||
sourceData.Sport.CompareIds(&targetData.Sport)
|
||||
|
||||
case "players":
|
||||
sourceData.Player.CompareIds(&targetData.Player)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
func StripUrl(webLink string, keepParam string) string {
|
||||
u, err := url.Parse(webLink)
|
||||
if err != nil {
|
||||
slog.Info("StripUrl", "error", err)
|
||||
return webLink
|
||||
}
|
||||
values := u.Query()
|
||||
for key := range values {
|
||||
if key != keepParam {
|
||||
values.Del(key)
|
||||
}
|
||||
}
|
||||
u.RawQuery = values.Encode()
|
||||
return u.String()
|
||||
}
|
||||
@@ -31,6 +31,10 @@ type MediaActorDTO struct {
|
||||
WebLink string `json:"url"`
|
||||
}
|
||||
|
||||
type MediaActorAdd struct {
|
||||
WebLink string `json:"url"`
|
||||
}
|
||||
|
||||
func ConvertMediaActorsToDtos(actors []MediaActor) []MediaActorDTO {
|
||||
dtos := make([]MediaActorDTO, len(actors))
|
||||
for i, actor := range actors {
|
||||
|
||||
@@ -21,6 +21,11 @@ func (media_file *MediaActorFile) TableName() string {
|
||||
return "media_actor_file"
|
||||
}
|
||||
|
||||
type MediaActorFileAdd struct {
|
||||
MediaActorID string `json:"media_actor_id"`
|
||||
MediaFileID string `json:"media_file_id"`
|
||||
}
|
||||
|
||||
type MediaActorFileDTO struct {
|
||||
ID string `json:"id" binding:"required"`
|
||||
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||
|
||||
@@ -26,6 +26,10 @@ func (media_file *MediaFile) TableName() string {
|
||||
return "media_file"
|
||||
}
|
||||
|
||||
type MediaFileAdd struct {
|
||||
Url string `json:"url"`
|
||||
}
|
||||
|
||||
type MediaFileDTO struct {
|
||||
ID string `json:"id" binding:"required"`
|
||||
CreatedAt helpers.KontorTime `json:"created_date"`
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"kontor-api-gin/internal/helpers"
|
||||
"log/slog"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -30,6 +32,36 @@ type PlayerDTO struct {
|
||||
LastName string `json:"last_name" binding:"required"`
|
||||
}
|
||||
|
||||
type PlayerDTOList []PlayerDTO
|
||||
|
||||
func (playerList *PlayerDTOList) CompareIds(target *PlayerDTOList) (missing, obsolete []string) {
|
||||
sources := make(map[string]PlayerDTO, len(*playerList))
|
||||
targets := make(map[string]PlayerDTO, len(*target))
|
||||
for _, source := range *playerList {
|
||||
sources[source.ID] = source
|
||||
}
|
||||
for _, target := range *target {
|
||||
targets[target.ID] = target
|
||||
}
|
||||
// iterate source IDs
|
||||
for id := range sources {
|
||||
if _, ok := targets[id]; ok {
|
||||
slog.Info(fmt.Sprintf("ID %s found in both lists", id))
|
||||
} else {
|
||||
missing = append(missing, id)
|
||||
}
|
||||
}
|
||||
for id := range targets {
|
||||
if _, ok := sources[id]; ok {
|
||||
slog.Info(fmt.Sprintf("ID %s found in both lists", id))
|
||||
} else {
|
||||
obsolete = append(obsolete, id)
|
||||
}
|
||||
}
|
||||
slog.Info("CompareIds", "missing", missing, "obsolete", obsolete)
|
||||
return missing, obsolete
|
||||
}
|
||||
|
||||
func ConvertPlayersToDtos(players []Player) []PlayerDTO {
|
||||
dtos := make([]PlayerDTO, len(players))
|
||||
for i, player := range players {
|
||||
|
||||
@@ -2,6 +2,7 @@ package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
|
||||
@@ -26,14 +27,19 @@ func (repository *MediaActorRepository) FindAll(context context.Context) ([]mode
|
||||
return actors, nil
|
||||
}
|
||||
|
||||
func (repository *MediaActorRepository) GetById(context context.Context, id string) (models.MediaActor, error) {
|
||||
func (repository *MediaActorRepository) GetById(context context.Context, id string) (*models.MediaActor, error) {
|
||||
var actor = models.MediaActor{ID: id}
|
||||
slog.Info("MediaActorRepository#GetById", "id", id)
|
||||
result := repository.db.First(&actor)
|
||||
if result.Error != nil {
|
||||
slog.Info("SportRepository#GetById", "error", result.Error.Error())
|
||||
}
|
||||
return actor, result.Error
|
||||
return &actor, result.Error
|
||||
}
|
||||
|
||||
func (repository *MediaActorRepository) Add(context context.Context, url string) (*models.MediaActor, error) {
|
||||
slog.Info("MediaActorRepository#Add", "url", url)
|
||||
return nil, fmt.Errorf("unimplemented method MediaFileRepository#Add")
|
||||
}
|
||||
|
||||
func (repository *MediaActorRepository) Delete(context context.Context, id string) error {
|
||||
|
||||
@@ -2,6 +2,7 @@ package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
|
||||
@@ -25,3 +26,29 @@ func (repository *MediaActorFileRepository) FindAll(context context.Context) ([]
|
||||
|
||||
return actor_files, nil
|
||||
}
|
||||
|
||||
func (repository *MediaActorFileRepository) GetById(context context.Context, id string) (*models.MediaActorFile, error) {
|
||||
var actorfile = models.MediaActorFile{ID: id}
|
||||
slog.Info("MediaActorFileRepository#GetById", "id", id)
|
||||
result := repository.db.First(&actorfile)
|
||||
if result.Error != nil {
|
||||
slog.Info("MediaActorFileRepository#GetById", "error", result.Error.Error())
|
||||
return nil, result.Error
|
||||
}
|
||||
return &actorfile, result.Error
|
||||
}
|
||||
|
||||
func (repository *MediaActorFileRepository) Add(context context.Context, media_actor_id, media_file_id string) (*models.MediaActorFile, error) {
|
||||
slog.Info("MediaActorFileRepository#Add", "actor_id", media_actor_id, "file_id", media_file_id)
|
||||
return nil, fmt.Errorf("unimplemented method MediaActorFileRepository#Add")
|
||||
}
|
||||
|
||||
func (repository *MediaActorFileRepository) Delete(context context.Context, id string) error {
|
||||
var file = models.MediaActorFile{ID: id}
|
||||
slog.Info("MediaActorFileRepository#Delete", "id", id)
|
||||
result := repository.db.Delete(&file)
|
||||
if result.Error != nil {
|
||||
slog.Info("MediaActorFileRepository#Delete", "error", result.Error.Error())
|
||||
}
|
||||
return result.Error
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
|
||||
@@ -25,3 +26,29 @@ func (repository *MediaFileRepository) FindAll(context context.Context) ([]model
|
||||
|
||||
return files, nil
|
||||
}
|
||||
|
||||
func (repository *MediaFileRepository) GetById(context context.Context, id string) (*models.MediaFile, error) {
|
||||
var file = models.MediaFile{ID: id}
|
||||
slog.Info("MediaFileRepository#GetById", "id", id)
|
||||
result := repository.db.First(&file)
|
||||
if result.Error != nil {
|
||||
slog.Info("MediaFileRepository#GetById", "error", result.Error.Error())
|
||||
return nil, result.Error
|
||||
}
|
||||
return &file, result.Error
|
||||
}
|
||||
|
||||
func (repository *MediaFileRepository) Add(context context.Context, url string) (*models.MediaFile, error) {
|
||||
slog.Info("MediaFileRepository#Add", "url", url)
|
||||
return nil, fmt.Errorf("unimplemented method MediaFileRepository#Add")
|
||||
}
|
||||
|
||||
func (repository *MediaFileRepository) Delete(context context.Context, id string) error {
|
||||
var file = models.MediaFile{ID: id}
|
||||
slog.Info("MediaFileRepository#Delete", "id", id)
|
||||
result := repository.db.Delete(&file)
|
||||
if result.Error != nil {
|
||||
slog.Info("MediaFileRepository#Delete", "error", result.Error.Error())
|
||||
}
|
||||
return result.Error
|
||||
}
|
||||
|
||||
@@ -2,9 +2,14 @@ package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"kontor-api-gin/internal/helpers"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
@@ -26,19 +31,51 @@ func (repository *MediaLoFiRepository) FindAll(context context.Context) ([]model
|
||||
return lofis, nil
|
||||
}
|
||||
|
||||
func (repository *MediaLoFiRepository) GetById(context context.Context, id string) (models.MediaLoFi, error) {
|
||||
func (repository *MediaLoFiRepository) GetById(context context.Context, id string) (*models.MediaLoFi, error) {
|
||||
var lofi = models.MediaLoFi{ID: id}
|
||||
slog.Info("MediaLoFiRepository#GetById", "id", id)
|
||||
result := repository.db.First(&lofi)
|
||||
if result.Error != nil {
|
||||
slog.Info("MediaLoFiRepository#GetById", "error", result.Error.Error())
|
||||
}
|
||||
return lofi, result.Error
|
||||
return &lofi, result.Error
|
||||
}
|
||||
|
||||
func (repository *MediaLoFiRepository) Add(context context.Context, url string) (models.MediaLoFi, error) {
|
||||
func (repository *MediaLoFiRepository) Add(context context.Context, url string) (*models.MediaLoFi, error) {
|
||||
slog.Info("MediaLoFiRepository#Add", "url", url)
|
||||
panic("unimplemented")
|
||||
webLink := helpers.StripUrl(url, "v")
|
||||
var lofi models.MediaLoFi
|
||||
search_result := repository.db.Where("url = ?", webLink).First(&lofi)
|
||||
if search_result.RowsAffected > 0 {
|
||||
slog.Info("search for existing url", "result", search_result, "lofi", lofi)
|
||||
return &lofi, nil
|
||||
}
|
||||
if errors.Is(search_result.Error, gorm.ErrRecordNotFound) {
|
||||
slog.Info("MediaLoFiRepository#Add URL not found", "url", webLink)
|
||||
lofi = models.MediaLoFi{
|
||||
ID: uuid.NewString(),
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
DeletedAt: nil,
|
||||
Version: 0,
|
||||
WebLink: webLink,
|
||||
ShouldDownload: false,
|
||||
Review: true,
|
||||
Title: "",
|
||||
FileName: "",
|
||||
}
|
||||
add_result := repository.db.Create(&lofi)
|
||||
if add_result.Error != nil {
|
||||
slog.Info("add new MediaLofi", "error", add_result.Error)
|
||||
return nil, add_result.Error
|
||||
}
|
||||
slog.Info("add new MediaLofi", "lofi", lofi)
|
||||
return &lofi, nil
|
||||
}
|
||||
if search_result.Error != nil {
|
||||
return nil, search_result.Error
|
||||
}
|
||||
return nil, fmt.Errorf("MediaLoFiRepository#Add unknown error")
|
||||
}
|
||||
|
||||
func (repository *MediaLoFiRepository) Delete(context context.Context, id string) error {
|
||||
|
||||
@@ -103,15 +103,19 @@ func New(admin *handlers.AdminHandler, bookshelf *handlers.BookshelfHandler, com
|
||||
secured.GET("comics/issueworks", comics.IssueworkHandler.List)
|
||||
mediaGroup := secured.Group("/media")
|
||||
mediaGroup.GET("/files", media.MediaFileHandler.List)
|
||||
mediaGroup.POST("/files", media.MediaFileHandler.Add)
|
||||
mediaGroup.GET("/videos", media.MediaVideoHandler.List)
|
||||
mediaGroup.GET("/lofis", media.MediaLoFiHandler.List)
|
||||
mediaGroup.POST("/lofis", media.MediaLoFiHandler.Add)
|
||||
mediaGroup.GET("/lofis/:id", media.MediaLoFiHandler.Get)
|
||||
mediaGroup.DELETE("/lofis", media.MediaLoFiHandler.Delete)
|
||||
mediaGroup.GET("/actors", media.MediaActorHandler.List)
|
||||
mediaGroup.POST("/actors", media.MediaActorHandler.Add)
|
||||
mediaGroup.GET("/actors/:id", media.MediaActorHandler.Get)
|
||||
mediaGroup.DELETE("/actors/:id", media.MediaActorHandler.Delete)
|
||||
mediaGroup.GET("/actorfiles", media.MediaActorFileHandler.List)
|
||||
mediaGroup.POST("/actorfiles", media.MediaActorFileHandler.Add)
|
||||
mediaGroup.DELETE("/actorfiles", media.MediaActorFileHandler.Delete)
|
||||
}
|
||||
return router
|
||||
}
|
||||
|
||||
@@ -21,11 +21,16 @@ func (service *MediaActorService) List(context context.Context) ([]models.MediaA
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
|
||||
func (service *MediaActorService) Get(context context.Context, id string) (models.MediaActor, error) {
|
||||
func (service *MediaActorService) Get(context context.Context, id string) (*models.MediaActor, error) {
|
||||
slog.Info("MediaActorService#Get")
|
||||
return service.repository.GetById(context, id)
|
||||
}
|
||||
|
||||
func (service *MediaActorService) Add(context context.Context, url string) (*models.MediaActor, error) {
|
||||
slog.Info("MediaActorService#Add")
|
||||
return service.repository.Add(context, url)
|
||||
}
|
||||
|
||||
func (service *MediaActorService) Delete(context context.Context, id string) error {
|
||||
slog.Info("MediaActorService#Delete")
|
||||
return service.repository.Delete(context, id)
|
||||
|
||||
@@ -20,3 +20,18 @@ func (service *MediaActorFileService) List(context context.Context) ([]models.Me
|
||||
slog.Info("MediaActorFileService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
|
||||
func (service *MediaActorFileService) Get(context context.Context, id string) (*models.MediaActorFile, error) {
|
||||
slog.Info("MediaActorFileService#Get")
|
||||
return service.repository.GetById(context, id)
|
||||
}
|
||||
|
||||
func (service *MediaActorFileService) Add(context context.Context, media_actor_id, media_file_id string) (*models.MediaActorFile, error) {
|
||||
slog.Info("MediaActorFileService#Add")
|
||||
return service.repository.Add(context, media_actor_id, media_file_id)
|
||||
}
|
||||
|
||||
func (service *MediaActorFileService) Delete(context context.Context, id string) error {
|
||||
slog.Info("MediaActorFileService#Delete")
|
||||
return service.repository.Delete(context, id)
|
||||
}
|
||||
|
||||
@@ -20,3 +20,18 @@ func (service *MediaFileService) List(context context.Context) ([]models.MediaFi
|
||||
slog.Info("MediaFileService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
|
||||
func (service *MediaFileService) Get(context context.Context, id string) (*models.MediaFile, error) {
|
||||
slog.Info("MediaFileService#Get")
|
||||
return service.repository.GetById(context, id)
|
||||
}
|
||||
|
||||
func (service *MediaFileService) Add(context context.Context, url string) (*models.MediaFile, error) {
|
||||
slog.Info("MediaFileService#Add")
|
||||
return service.repository.Add(context, url)
|
||||
}
|
||||
|
||||
func (service *MediaFileService) Delete(context context.Context, id string) error {
|
||||
slog.Info("MediaFileService#Delete")
|
||||
return service.repository.Delete(context, id)
|
||||
}
|
||||
|
||||
@@ -21,12 +21,12 @@ func (service *MediaLoFiService) List(context context.Context) ([]models.MediaLo
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
|
||||
func (service *MediaLoFiService) Get(context context.Context, id string) (models.MediaLoFi, error) {
|
||||
func (service *MediaLoFiService) Get(context context.Context, id string) (*models.MediaLoFi, error) {
|
||||
slog.Info("MediaLoFiService#Get")
|
||||
return service.repository.GetById(context, id)
|
||||
}
|
||||
|
||||
func (service *MediaLoFiService) Add(context context.Context, url string) (models.MediaLoFi, error) {
|
||||
func (service *MediaLoFiService) Add(context context.Context, url string) (*models.MediaLoFi, error) {
|
||||
slog.Info("MediaLoFiService#Add")
|
||||
return service.repository.Add(context, url)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user