This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package repository
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"log/slog"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type MediaVideoRepository struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewMediaVideoRepository(db *gorm.DB) *MediaVideoRepository {
|
||||
repo := &MediaVideoRepository{db: db}
|
||||
return repo
|
||||
}
|
||||
|
||||
func (repository *MediaVideoRepository) FindAll(context context.Context) ([]models.MediaVideo, error) {
|
||||
var videos []models.MediaVideo
|
||||
|
||||
result := repository.db.Find(&videos)
|
||||
slog.Info("MediaVideoRepository#FindAll", "count", result.RowsAffected)
|
||||
|
||||
return videos, nil
|
||||
}
|
||||
Reference in New Issue
Block a user