WIP: add missing handlers, services nd repositories
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user