Implement a couple of rpcs
All checks were successful
ci/woodpecker/push/build Pipeline was successful

Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
This commit is contained in:
2026-06-09 14:52:06 +02:00
parent 7c55e758fc
commit 3ea6765486
7 changed files with 95 additions and 31 deletions

View File

@@ -13,6 +13,7 @@ import (
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/helpers/postgres"
"gitea.badhouseplants.net/softplayer/softplayer-backend/internal/services"
accounts "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/accounts/v1"
projects "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/projects/v1"
test "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/test/v1"
tokens "gitea.badhouseplants.net/softplayer/softplayer-go-proto/pkg/tokens/v1"
grpc_zap "github.com/grpc-ecosystem/go-grpc-middleware/logging/zap"
@@ -24,7 +25,6 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/health"
healthgrpc "google.golang.org/grpc/health/grpc_health_v1"
healthpb "google.golang.org/grpc/health/grpc_health_v1"
"google.golang.org/grpc/reflection"
)
@@ -118,6 +118,10 @@ func (cmd *Server) Run(ctx context.Context) error {
Redis: rdb,
}
projectsCtrl := &services.ProjectsController{
DB: db,
}
// Services that should be accessible for tokens should go here
accounts.RegisterAccountsServiceServer(grpcServer, v1.NewAccountServer(accountCtrl, authController))
accounts.RegisterPublicAccountsServiceServer(grpcServer, v1.NewPublicAccountServer(accountCtrl, authController))
@@ -126,7 +130,7 @@ func (cmd *Server) Run(ctx context.Context) error {
test.RegisterPublicTestServiceServer(grpcServer, v1.NewPublicTestServer())
tokens.RegisterTokensServiceServer(grpcServer, v1.NewTokensServer(tokenCtrl, authController))
tokens.RegisterPublicTokensServiceServer(grpcServer, v1.NewPublicTokensServer(tokenCtrl, authController))
projects.RegisterProjectsServiceServer(grpcServer, v1.NewProjectsServer(projectsCtrl))
healthcheck := health.NewServer()
healthgrpc.RegisterHealthServer(grpcServer, healthcheck)
@@ -140,10 +144,10 @@ func (cmd *Server) Run(ctx context.Context) error {
dbOK := checkDatabase(db)
redisOK := checkRedis(rdb)
status := healthpb.HealthCheckResponse_SERVING
status := healthgrpc.HealthCheckResponse_SERVING
if !dbOK || !redisOK {
status = healthpb.HealthCheckResponse_NOT_SERVING
status = healthgrpc.HealthCheckResponse_NOT_SERVING
}
healthcheck.SetServingStatus(