Добавить стол организаторов на карту

This commit is contained in:
2026-09-21 18:28:14 +07:00
parent 002c4b26b4
commit 90871f920b
+7 -1
View File
@@ -22,6 +22,9 @@ func (s *server) GetGameMap(ctx context.Context, req *proto.GetGameMapReq) (*pro
if err != nil {
return nil, status.Error(codes.NotFound, "игра не найдена")
}
if err := s.mapRepo.Ensure(ctx, int(req.GameId), "organizer_desk", 1); err != nil {
return nil, status.Error(codes.Internal, "не удалось сохранить карту")
}
for _, team := range game.Teams {
if team.ParticipationStatus == "cancelled" {
continue
@@ -67,6 +70,9 @@ func (s *server) GetGameMap(ctx context.Context, req *proto.GetGameMapReq) (*pro
if item.Kind == "team" {
mapped.Label = teamNames[item.ItemID]
}
if item.Kind == "organizer_desk" {
mapped.Label = "Стол организаторов"
}
if state := screenStates[item.ItemID]; item.Kind == "screen" && state != nil {
mapped.Label = "Экран " + state.Id
mapped.Status = state.Status
@@ -81,7 +87,7 @@ func (s *server) UpdateGameMapItem(ctx context.Context, req *proto.UpdateGameMap
if !canManageScreens(ctx) {
return nil, status.Error(codes.PermissionDenied, "permission denied")
}
if req == nil || req.GameId <= 0 || req.ItemId <= 0 || (req.Kind != "team" && req.Kind != "screen") {
if req == nil || req.GameId <= 0 || req.ItemId <= 0 || (req.Kind != "team" && req.Kind != "screen" && req.Kind != "organizer_desk") {
return nil, status.Error(codes.InvalidArgument, "некорректный объект карты")
}
if err := s.mapRepo.Update(ctx, game_map_repo.Item{GameID: int(req.GameId), Kind: req.Kind, ItemID: int(req.ItemId), X: int(req.X), Y: int(req.Y), Hidden: req.Hidden}); err != nil {