Skip to content

Commit 68afebc

Browse files
committed
Adjust stubs to match openapi changes
1 parent fc5f542 commit 68afebc

File tree

5 files changed

+78
-9
lines changed

5 files changed

+78
-9
lines changed

openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ paths:
431431
- $ref: "#/components/parameters/pathGameId"
432432
post:
433433
tags: [games]
434-
operationId: restart
434+
operationId: restartGame
435435
summary: Restart the game with the same or adjusted settings
436436
description: |
437437
Like starting a new game with the same settings as the current one and directly notifying all previous participants via an event.

src/main/java/org/developerden/codosseum/controller/GameController.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,14 @@ public HttpResponse<String> getCodeTemplate(
9292
throw new UnsupportedOperationException();
9393
}
9494

95+
@Post("/{id}/restart")
96+
@GameAuthorized(GameRole.PLAYER)
97+
public HttpResponse<GameCreateResponse> restartGame(
98+
Principal principal, @PathVariable("id") Game game
99+
) {
100+
throw new UnsupportedOperationException();
101+
}
102+
95103
@ExecuteOn(TaskExecutors.IO)
96104
@Get("/{id}/events")
97105
@Produces(MediaType.TEXT_EVENT_STREAM)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023 JohnnyJayJay
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify it under the terms of
6+
* the GNU Affero General Public License as published by the Free Software Foundation, either
7+
* version 3 of the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU Affero General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU Affero General Public License along with this program.
14+
* If not, see <https://www.gnu.org/licenses/>.
15+
*
16+
*/
17+
18+
package org.developerden.codosseum.controller;
19+
20+
import io.micronaut.http.annotation.Controller;
21+
import io.micronaut.http.annotation.Get;
22+
import java.util.List;
23+
24+
@Controller
25+
public class InfoController {
26+
27+
@Get("/languages")
28+
public List<String> getSupportedLanguages() {
29+
throw new UnsupportedOperationException();
30+
}
31+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* SPDX-FileCopyrightText: 2023 JohnnyJayJay
3+
* SPDX-License-Identifier: AGPL-3.0-or-later
4+
*
5+
* This program is free software: you can redistribute it and/or modify it under the terms of
6+
* the GNU Affero General Public License as published by the Free Software Foundation, either
7+
* version 3 of the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU Affero General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU Affero General Public License along with this program.
14+
* If not, see <https://www.gnu.org/licenses/>.
15+
*
16+
*/
17+
18+
package org.developerden.codosseum.dto;
19+
20+
import io.micronaut.core.annotation.Introspected;
21+
import jakarta.annotation.Nonnull;
22+
import jakarta.validation.constraints.NotNull;
23+
24+
@Introspected
25+
public record GameCreateRequest(
26+
@Nonnull
27+
@NotNull
28+
GameSettings settings,
29+
30+
@Nonnull
31+
@NotNull
32+
Player player
33+
){
34+
}

src/main/java/org/developerden/codosseum/dto/GameInfo.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,14 @@
2727
@RecordBuilder
2828
public record GameInfo(
2929
@Nonnull
30-
String id,
30+
GameSettings settings,
3131

3232
@Nonnull
33-
List<String> allowedLanguages,
33+
String id,
3434

3535
@Nonnull
3636
GameMode gameMode,
3737

38-
int maxPlayers,
39-
40-
int timeLimit,
41-
42-
int maxWarmupTime,
43-
4438
@Nonnull
4539
Players players,
4640

@@ -49,6 +43,8 @@ public record GameInfo(
4943

5044
int timeLeft,
5145

46+
long nextStateAt,
47+
5248
@Nullable
5349
Integer round,
5450

0 commit comments

Comments
 (0)