mirror of
https://github.com/lorsanstand/HomeOps-Hub.git
synced 2026-06-19 20:05:17 +03:00
refactor: move domain structure and mapper
This commit is contained in:
@@ -33,7 +33,7 @@ func NewApp() *App {
|
||||
func (a *App) Run() {
|
||||
err := a.hubServe()
|
||||
if err != nil {
|
||||
a.log.Error().Err(err).Msg("failed start server")
|
||||
a.log.Error().Err(err).Msg("failed to start the server")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package rpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
pb "github.com/lorsanstand/HomeOps-Hub/api/gen/homeops"
|
||||
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
|
||||
"github.com/rs/zerolog"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/protobuf/types/known/emptypb"
|
||||
@@ -32,5 +34,7 @@ func (h *HubHandler) Ping(ctx context.Context, _ *emptypb.Empty) (*pb.PongRespon
|
||||
}
|
||||
|
||||
func (h *HubHandler) RegisterAgent(ctx context.Context, request *pb.RegisterAgentRequest) (*pb.RegisterAgentResponse, error) {
|
||||
return &pb.RegisterAgentResponse{AgentId: "12234", HeartbeatIntervalSecond: 2}, nil
|
||||
data := domain.ToDomainAgentRequest(request)
|
||||
fmt.Println(data)
|
||||
return &pb.RegisterAgentResponse{}, nil
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package hub_service
|
||||
|
||||
import (
|
||||
"github.com/lorsanstand/HomeOps-Hub/internal/domain"
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type HubService struct {
|
||||
log zerolog.Logger
|
||||
}
|
||||
|
||||
func NewHubService(request domain.RegisterAgentRequest)
|
||||
Reference in New Issue
Block a user