refactor: move domain structure and mapper

This commit is contained in:
2026-04-14 19:48:16 +03:00
parent 76fe95400c
commit 0b955bb714
11 changed files with 111 additions and 58 deletions
+4 -4
View File
@@ -4,7 +4,7 @@ import (
"context"
pb "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/domain"
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
"github.com/rs/zerolog"
"google.golang.org/grpc"
)
@@ -32,8 +32,8 @@ func (c *Connection) Hub() pb.HubClient {
return c.hub
}
func (c *Connection) RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentData) (domain.RegisterAgentDataResponse, error) {
ResponseData, err := c.Hub().RegisterAgent(ctx, new(toAgentRegisterRequest(RegisterData)))
func (c *Connection) RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentRequest) (domain.RegisterAgentResponse, error) {
ResponseData, err := c.Hub().RegisterAgent(ctx, new(domain.ToGRPCAgentRequest(RegisterData)))
c.log.Info().Msg("register agent")
return toAgentRegisterDataResponse(ResponseData), err
return domain.ToDomainAgentResponse(ResponseData), err
}