log.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package admin
  2. import (
  3. "context"
  4. v1 "github.com/go-nunu/nunu-layout-advanced/api/v1"
  5. admin "github.com/go-nunu/nunu-layout-advanced/api/v1/admin"
  6. "github.com/go-nunu/nunu-layout-advanced/internal/model"
  7. adminRep "github.com/go-nunu/nunu-layout-advanced/internal/repository/admin"
  8. "github.com/go-nunu/nunu-layout-advanced/internal/service"
  9. )
  10. type LogService interface {
  11. GetLog(ctx context.Context, id int64) (*model.Log, error)
  12. GetLogList(ctx context.Context, req admin.SearchLogParams) (*v1.PaginatedResponse[model.Log], error)
  13. }
  14. func NewLogService(
  15. service *service.Service,
  16. LogRepository adminRep.LogRepository,
  17. ) LogService {
  18. return &logService{
  19. Service: service,
  20. LogRepository: LogRepository,
  21. }
  22. }
  23. type logService struct {
  24. *service.Service
  25. LogRepository adminRep.LogRepository
  26. }
  27. func (s *logService) GetLog(ctx context.Context, id int64) (*model.Log, error) {
  28. return s.LogRepository.GetLog(ctx, id)
  29. }
  30. func (s *logService) GetLogList(ctx context.Context, req admin.SearchLogParams) (*v1.PaginatedResponse[model.Log], error) {
  31. return s.LogRepository.GetLogList(ctx, req)
  32. }