kinosaal crud
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user