diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusHandler.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusHandler.java index 5e04fcd..3f191ad 100644 --- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusHandler.java +++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusHandler.java @@ -8,7 +8,18 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.ErrorRes import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.dispatcher.ResponseDispatcher; import java.util.Optional; -/** Handler for GET_LOBBY_STATUS: returns lobby details and player list. */ +/** + * Handler for the `GET_LOBBY_STATUS` command. + * + *
+ * Resolves the target lobby either by the optional `ID` parameter or by
+ * `USERNAME`. If both are
+ * omitted the handler requires the session to be associated with a logged-in
+ * user (see the inline
+ * pre-execution check). On success a {@link GetLobbyStatusResponse} is
+ * dispatched, otherwise an
+ * {@link ErrorResponse} with code `LOBBY_NOT_FOUND` is sent.
+ */
public class GetLobbyStatusHandler extends CommandHandler Supported optional parameters:
+ *
+ * Builds a response with a single `LOBBY` block containing `ID`, `NAME` and a nested `PLAYERS`
+ * collection with repeated `PLAYER` blocks (`USERNAME`, `READY`).
+ */
public class GetLobbyStatusResponse extends SuccessResponse {
+ /**
+ * Create a new response for the provided {@link Lobby}.
+ *
+ * @param context request context to use for the response
+ * @param lobby lobby domain object containing id, name and players
+ */
public GetLobbyStatusResponse(RequestContext context, Lobby lobby) {
super(
context,
+ *
+ *
+ * If both are omitted the handler may require a logged-in session.
+ *
+ * @param primitiveRequest raw request containing parameters and context
+ * @return parsed {@link GetLobbyStatusRequest}
+ */
@Override
public GetLobbyStatusRequest parse(PrimitiveRequest primitiveRequest) {
RequestParameterAccessor accessor =
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusRequest.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusRequest.java
index 5d73882..6baa338 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusRequest.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusRequest.java
@@ -7,16 +7,25 @@ public class GetLobbyStatusRequest extends Request {
private final Integer id;
private final String username;
+ /**
+ * Create a new GetLobbyStatusRequest.
+ *
+ * @param context request context (session id, source, etc.)
+ * @param id optional numeric lobby id to query, or null
+ * @param username optional username to query the lobby for, or null
+ */
public GetLobbyStatusRequest(RequestContext context, Integer id, String username) {
super(context);
this.id = id;
this.username = username;
}
+ /** Returns the optional lobby id. */
public Integer getId() {
return id;
}
+ /** Returns the optional username. */
public String getUsername() {
return username;
}
diff --git a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusResponse.java b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusResponse.java
index 94bc690..043eb3d 100644
--- a/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusResponse.java
+++ b/src/main/java/ch/unibas/dmi/dbis/cs108/casono/server/app/commands/lobby/get_lobby_status/GetLobbyStatusResponse.java
@@ -5,8 +5,19 @@ import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.request.RequestCo
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.SuccessResponse;
import ch.unibas.dmi.dbis.cs108.casono.server.network.protocol.response.builder.ResponseBody;
-/** Response with lobby player listing and simple READY placeholders. */
+/**
+ * Success response for `GET_LOBBY_STATUS`.
+ *
+ *