kinosaal crud

This commit is contained in:
2025-10-24 01:13:06 +02:00
parent b55b334794
commit 9a53f3bda8
2 changed files with 22 additions and 10 deletions

View File

@@ -35,7 +35,7 @@
<dependency> <dependency>
<groupId>de.infinimotion</groupId> <groupId>de.infinimotion</groupId>
<artifactId>model-backend</artifactId> <artifactId>model-backend</artifactId>
<version>0.0.54</version> <version>0.0.55</version>
</dependency> </dependency>
<!-- Quarkus --> <!-- Quarkus -->

View File

@@ -3,25 +3,20 @@ package de.infinimotion.backend;
import de.infinimotion.model.backend.*; import de.infinimotion.model.backend.*;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject; import jakarta.inject.Inject;
import jakarta.ws.rs.GET; import jakarta.ws.rs.*;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import org.eclipse.microprofile.reactive.messaging.*;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ApplicationScoped @ApplicationScoped
@Path("/") @Path("/kinosaal")
public class RequestResource { public class KinosaalResource {
@Inject @Inject
BetterRequestReply requester; BetterRequestReply requester;
@GET @GET
@Path("/kinosaal")
public List<Kinosaal> listKinosaal() throws IOException, ExecutionException, InterruptedException { public List<Kinosaal> listKinosaal() throws IOException, ExecutionException, InterruptedException {
CommandListKinosaal request = new CommandListKinosaal(); CommandListKinosaal request = new CommandListKinosaal();
CommandWrapper response = requester.request(request.serialize().generateIds().commit()); CommandWrapper response = requester.request(request.serialize().generateIds().commit());
@@ -29,7 +24,6 @@ public class RequestResource {
} }
@POST @POST
@Path("/kinosaal/create")
public Kinosaal createKinosaal(Kinosaal hall) throws IOException, ExecutionException, InterruptedException { public Kinosaal createKinosaal(Kinosaal hall) throws IOException, ExecutionException, InterruptedException {
CommandCreateKinosaal request = new CommandCreateKinosaal(); CommandCreateKinosaal request = new CommandCreateKinosaal();
request.setName(hall.getName()); request.setName(hall.getName());
@@ -38,4 +32,22 @@ public class RequestResource {
return CommandCreateKinosaalResponse.deserialize(response).getHall(); return CommandCreateKinosaalResponse.deserialize(response).getHall();
} }
@PUT
public Kinosaal updateKinosaal(Kinosaal hall) throws IOException, ExecutionException, InterruptedException {
CommandUpdateKinosaal request = new CommandUpdateKinosaal();
request.setHall(hall);
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
return CommandUpdateKinosaal.deserialize(response).getHall();
}
@DELETE
public Kinosaal deleteKinosaal(Kinosaal hall) throws IOException, ExecutionException, InterruptedException {
CommandDeleteKinosaal request = new CommandDeleteKinosaal();
request.setHall(hall);
CommandWrapper response = requester.request(request.serialize().generateIds().commit());
return CommandDeleteKinosaalResponse.deserialize(response).getHall();
}
} }