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,9 +4,9 @@ import (
"context"
"fmt"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/domain"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/utils/config_yaml"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/utils/settings"
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
"github.com/rs/zerolog"
)
@@ -15,7 +15,7 @@ type Collector interface {
}
type HubConnection interface {
RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentData) (domain.RegisterAgentDataResponse, error)
RegisterAgent(ctx context.Context, RegisterData domain.RegisterAgentRequest) (domain.RegisterAgentResponse, error)
}
type AgentService struct {
@@ -43,7 +43,7 @@ func (a *AgentService) RegisterAgentConn(ctx context.Context) {
info, caps := a.collect.GatherInfoSystem()
AgentID := a.settings.AgentID
AgentName := a.cfg.AppName
AgentData := domain.RegisterAgentData{AgentId: AgentID, AgentName: AgentName, Host: info, Capabilities: caps}
AgentData := domain.RegisterAgentRequest{AgentId: AgentID, AgentName: AgentName, Host: info, Capabilities: caps}
data, err := a.conn.RegisterAgent(ctx, AgentData)
if err != nil {
@@ -4,7 +4,7 @@ import (
"os"
"runtime"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/domain"
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
"github.com/rs/zerolog"
)
+3 -1
View File
@@ -1,6 +1,8 @@
package docker_service
import "github.com/lorsanstand/HomeOps-Hub/internal/agent/domain"
import (
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
)
type BadDocker struct {
reason string
@@ -5,7 +5,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container"
"github.com/lorsanstand/HomeOps-Hub/internal/agent/domain"
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
"github.com/rs/zerolog"
)