gatewayipadmin.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package admin
  2. import (
  3. "context"
  4. v1 "github.com/go-nunu/nunu-layout-advanced/api/v1"
  5. v1admin "github.com/go-nunu/nunu-layout-advanced/api/v1/admin"
  6. "github.com/go-nunu/nunu-layout-advanced/internal/model"
  7. "github.com/go-nunu/nunu-layout-advanced/internal/repository/admin"
  8. "github.com/go-nunu/nunu-layout-advanced/internal/service"
  9. )
  10. type GatewayIpAdminService interface {
  11. GetGatewayIpAdmin(ctx context.Context, id int64) (*model.Gatewayip, error)
  12. GetGatewayGroupIpList(ctx context.Context,req v1admin.SearchGatewayIpParams) (*v1.PaginatedResponse[model.Gatewayip], error)
  13. AddGatewayIp(ctx context.Context,req model.Gatewayip) error
  14. EditGatewayIp(ctx context.Context,req model.Gatewayip) error
  15. DeleteGatewayIp(ctx context.Context,id int64) error
  16. DeleteGatewayIps(ctx context.Context, ids []int64) error
  17. }
  18. func NewGatewayIpAdminService(
  19. service *service.Service,
  20. gatewayIpAdminRepository admin.GatewayIpAdminRepository,
  21. ) GatewayIpAdminService {
  22. return &gatewayIpAdminService{
  23. Service: service,
  24. gatewayIpAdminRepository: gatewayIpAdminRepository,
  25. }
  26. }
  27. type gatewayIpAdminService struct {
  28. *service.Service
  29. gatewayIpAdminRepository admin.GatewayIpAdminRepository
  30. }
  31. func (s *gatewayIpAdminService) GetGatewayIpAdmin(ctx context.Context, id int64) (*model.Gatewayip, error) {
  32. return s.gatewayIpAdminRepository.GetGatewayIpAdmin(ctx, id)
  33. }
  34. func (s *gatewayIpAdminService) GetGatewayGroupIpList(ctx context.Context,req v1admin.SearchGatewayIpParams) (*v1.PaginatedResponse[model.Gatewayip], error) {
  35. return s.gatewayIpAdminRepository.GetGatewayGroupIpList(ctx,req)
  36. }
  37. func (s *gatewayIpAdminService) AddGatewayIp(ctx context.Context,req model.Gatewayip) error {
  38. return s.gatewayIpAdminRepository.AddGatewayIp(ctx,req)
  39. }
  40. func (s *gatewayIpAdminService) EditGatewayIp(ctx context.Context,req model.Gatewayip) error {
  41. return s.gatewayIpAdminRepository.EditGatewayIp(ctx,req)
  42. }
  43. func (s *gatewayIpAdminService) DeleteGatewayIp(ctx context.Context,id int64) error {
  44. return s.gatewayIpAdminRepository.DeleteGatewayIp(ctx,id)
  45. }
  46. func (s *gatewayIpAdminService) DeleteGatewayIps(ctx context.Context, ids []int64) error {
  47. return s.gatewayIpAdminRepository.DeleteGatewayIps(ctx,ids)
  48. }