add location

This commit is contained in:
2026-09-18 16:01:02 +07:00
parent fc171dace5
commit 32191529a5
15 changed files with 106 additions and 21 deletions
+9
View File
@@ -11,6 +11,13 @@ import (
"google.golang.org/grpc/status"
)
func nilIfEmpty(value string) *string {
if value == "" {
return nil
}
return &value
}
func (s *server) AddGame(ctx context.Context, req *proto.AddGameReq) (*proto.AddGameRsp, error) {
claims := ctx.Value("claims").(*processor_jwt.JWTClaims)
if !roles.HasRole(claims, roles.Organizer) && !roles.HasRole(claims, roles.Author) {
@@ -25,6 +32,7 @@ func (s *server) AddGame(ctx context.Context, req *proto.AddGameReq) (*proto.Add
ctx,
req.Name,
req.Description,
nilIfEmpty(req.Location),
req.StartAt.AsTime(),
req.ScenarioId,
req.Format,
@@ -148,6 +156,7 @@ func (s *server) UpdateGame(ctx context.Context, req *proto.UpdateGameReq) (*pro
int(req.Id),
req.Name,
req.Description,
nilIfEmpty(req.Location),
req.StartAt.AsTime(),
req.ScenarioId,
req.Format,