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>
<groupId>de.infinimotion</groupId>
<artifactId>model-backend</artifactId>
<version>0.0.54</version>
<version>0.0.55</version>
</dependency>
<!-- Quarkus -->

View File

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