add input in front + add connection via grpc to solidarity-service(vue)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
fleets "git.coopgo.io/coopgo-platform/fleets/grpcapi"
|
||||
groupsmanagement "git.coopgo.io/coopgo-platform/groups-management/grpcapi"
|
||||
mobilityaccounts "git.coopgo.io/coopgo-platform/mobility-accounts/grpcapi"
|
||||
solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto"
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
@@ -13,10 +14,11 @@ type ServicesHandler struct {
|
||||
}
|
||||
|
||||
type GRPCServices struct {
|
||||
MobilityAccounts mobilityaccounts.MobilityAccountsClient
|
||||
GroupsManagement groupsmanagement.GroupsManagementClient
|
||||
Fleets fleets.FleetsClient
|
||||
Agenda agenda.AgendaClient
|
||||
MobilityAccounts mobilityaccounts.MobilityAccountsClient
|
||||
GroupsManagement groupsmanagement.GroupsManagementClient
|
||||
Fleets fleets.FleetsClient
|
||||
Agenda agenda.AgendaClient
|
||||
SolidarityService solidarity_service.SolidarityServiceClient
|
||||
}
|
||||
|
||||
func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
||||
@@ -25,6 +27,7 @@ func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
||||
groupsManagementDial = cfg.GetString("services.grpc.groupsmanagement.dial")
|
||||
fleetsDial = cfg.GetString("services.grpc.fleets.dial")
|
||||
agendaDial = cfg.GetString("services.grpc.agenda.dial")
|
||||
solidarityDial = cfg.GetString("services.grpc.solidarity_service.dial")
|
||||
)
|
||||
mobilityAccounts, err := NewMobilityAccountService(mobilityAccountsDial)
|
||||
if err != nil {
|
||||
@@ -46,12 +49,18 @@ func NewServicesHandler(cfg *viper.Viper) (*ServicesHandler, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
solidarity_service, err := NewSolidarityService(solidarityDial)
|
||||
if err != nil {
|
||||
return nil , err
|
||||
}
|
||||
|
||||
return &ServicesHandler{
|
||||
GRPC: GRPCServices{
|
||||
MobilityAccounts: mobilityAccounts,
|
||||
GroupsManagement: groupsManagement,
|
||||
Fleets: fleetsSvc,
|
||||
Agenda: agendaSvc,
|
||||
SolidarityService: solidarity_service,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
23
services/solidarity_service.go
Normal file
23
services/solidarity_service.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
solidarity_service "git.coopgo.io/sbouaram/solidarity-service/servers/grpc/proto"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
type SolidarityService struct {
|
||||
solidarity_service.SolidarityServiceClient
|
||||
}
|
||||
|
||||
func NewSolidarityService(dial string) (*SolidarityService, error) {
|
||||
conn, err := grpc.Dial(dial, grpc.WithInsecure())
|
||||
|
||||
client := solidarity_service.NewSolidarityServiceClient(conn)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &SolidarityService{
|
||||
SolidarityServiceClient: client,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user