28 lines
690 B
Go
28 lines
690 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"kontor-api-gin/internal/models"
|
|
"kontor-api-gin/internal/repository"
|
|
"log/slog"
|
|
)
|
|
|
|
type RoosterService struct {
|
|
repository *repository.RoosterRepository
|
|
}
|
|
|
|
func NewRoosterService(repo *repository.RoosterRepository) *RoosterService {
|
|
service := &RoosterService{repository: repo}
|
|
return service
|
|
}
|
|
|
|
func (service *RoosterService) List(context context.Context) ([]models.Rooster, error) {
|
|
slog.Info("RoosterService#List")
|
|
return service.repository.FindAll(context)
|
|
}
|
|
|
|
func (service *RoosterService) Get(context context.Context, id string) (models.Rooster, error) {
|
|
slog.Info("RoosterService#Get")
|
|
return service.repository.GetById(context, id)
|
|
}
|