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