waflog.go 1.2 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 WafLogService interface {
  11. GetWafLog(ctx context.Context, id int64) (*model.Log, error)
  12. GetWafLogList(ctx context.Context, req admin.SearchWafLogParams) (*v1.PaginatedResponse[model.Log], error)
  13. }
  14. func NewWafLogService(
  15. service *service.Service,
  16. wafLogRepository adminRep.WafLogRepository,
  17. ) WafLogService {
  18. return &wafLogService{
  19. Service: service,
  20. wafLogRepository: wafLogRepository,
  21. }
  22. }
  23. type wafLogService struct {
  24. *service.Service
  25. wafLogRepository adminRep.WafLogRepository
  26. }
  27. func (s *wafLogService) GetWafLog(ctx context.Context, id int64) (*model.Log, error) {
  28. return s.wafLogRepository.GetWafLog(ctx, id)
  29. }
  30. func (s *wafLogService) GetWafLogList(ctx context.Context, req admin.SearchWafLogParams) (*v1.PaginatedResponse[model.Log], error) {
  31. return s.wafLogRepository.GetWafLogList(ctx, req)
  32. }