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