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