This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type ArticleService struct {
|
||||
repository *repository.ArticleRepository
|
||||
}
|
||||
|
||||
func NewArticleService(repo *repository.ArticleRepository) *ArticleService {
|
||||
service := &ArticleService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *ArticleService) List(context context.Context) ([]models.Article, error) {
|
||||
slog.Info("ArticleService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type ArticleAuthorService struct {
|
||||
repository *repository.ArticleAuthorRepository
|
||||
}
|
||||
|
||||
func NewArticleAuthorService(repo *repository.ArticleAuthorRepository) *ArticleAuthorService {
|
||||
service := &ArticleAuthorService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *ArticleAuthorService) List(context context.Context) ([]models.ArticleAuthor, error) {
|
||||
slog.Info("ArticleAuthorService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type AuthorService struct {
|
||||
repository *repository.AuthorRepository
|
||||
}
|
||||
|
||||
func NewAuthorService(repo *repository.AuthorRepository) *AuthorService {
|
||||
service := &AuthorService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *AuthorService) List(context context.Context) ([]models.Author, error) {
|
||||
slog.Info("AuthorService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type BookService struct {
|
||||
repository *repository.BookRepository
|
||||
}
|
||||
|
||||
func NewBookService(repo *repository.BookRepository) *BookService {
|
||||
service := &BookService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *BookService) List(context context.Context) ([]models.Book, error) {
|
||||
slog.Info("BookService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type BookAuthorService struct {
|
||||
repository *repository.BookAuthorRepository
|
||||
}
|
||||
|
||||
func NewBookAuthorService(repo *repository.BookAuthorRepository) *BookAuthorService {
|
||||
service := &BookAuthorService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *BookAuthorService) List(context context.Context) ([]models.BookAuthor, error) {
|
||||
slog.Info("BookAuthorService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"kontor-api-gin/internal/models"
|
||||
"kontor-api-gin/internal/repository"
|
||||
"log/slog"
|
||||
)
|
||||
|
||||
type BookshelfPublisherService struct {
|
||||
repository *repository.BookshelfPublisherRepository
|
||||
}
|
||||
|
||||
func NewBookshelfPublisherService(repo *repository.BookshelfPublisherRepository) *BookshelfPublisherService {
|
||||
service := &BookshelfPublisherService{repository: repo}
|
||||
return service
|
||||
}
|
||||
|
||||
func (service *BookshelfPublisherService) List(context context.Context) ([]models.BookshelfPublisher, error) {
|
||||
slog.Info("BookshelfPublisherService#List")
|
||||
return service.repository.FindAll(context)
|
||||
}
|
||||
Reference in New Issue
Block a user