update kontor-echo
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type MediaVideoService struct {
|
||||
repository *repository.MediaVideoRepository
|
||||
}
|
||||
|
||||
func NewMediaVideoService(repo *repository.MediaVideoRepository) *MediaVideoService {
|
||||
service := &MediaVideoService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *MediaVideoService) List(context context.Context) ([]models.MediaVideo, error) {
|
||||
slog.Info("MediaVideoService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
|
||||
func (service *MediaVideoService) Get(context context.Context, id string) (*models.MediaVideo, error) {
|
||||
slog.Info("MediaVideoService#Get")
|
||||
return service.repository.GetById(context, id)
|
||||
}
|
||||
|
||||
func (service *MediaVideoService) Add(context context.Context, url string) (*models.MediaVideo, error) {
|
||||
slog.Info("MediaVideoService#Add")
|
||||
return service.repository.Add(context, url)
|
||||
}
|
||||
|
||||
func (service *MediaVideoService) Update(context context.Context, music models.MediaVideoDTO) (*models.MediaVideo, error) {
|
||||
slog.Info("MediaVideoService#Update")
|
||||
return service.repository.Update(context, music)
|
||||
}
|
||||
|
||||
func (service *MediaVideoService) Delete(context context.Context, id string) error {
|
||||
slog.Info("MediaVideoService#Delete")
|
||||
return service.repository.Delete(context, id)
|
||||
}
|
||||
Reference in New Issue
Block a user