Skip to content

Commit

Permalink
Merge pull request #618 from Epic-Breakfast-Productions/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
GregJohnStewart authored Jun 19, 2024
2 parents 508e21d + c09fb21 commit 75414af
Show file tree
Hide file tree
Showing 134 changed files with 3,371 additions and 461 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Requires=docker.socket
[Service]
Type=simple
Restart=always
TimeoutStartSec=600
Environment="CONTAINER_NAME=oqm-infra-kafka-rp"
Environment="IMAGE_NAME=docker.redpanda.com/redpandadata/redpanda"
Environment="IMAGE_VERSION=v23.3.9"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Requires=docker.socket
[Service]
Type=simple
Restart=always
TimeoutSec=5m
TimeoutSec=10m
Environment="CONTAINER_NAME=oqm-infra-mongo"
Environment="IMAGE_NAME=mongo"
Environment="IMAGE_VERSION=7"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Requires=docker.socket
[Service]
Type=simple
Restart=always
TimeoutSec=5m
TimeoutSec=10m
Environment="CONTAINER_NAME=oqm-infra-postgres"
Environment="IMAGE_NAME=postgres"
Environment="IMAGE_VERSION=15"
Expand Down
2 changes: 1 addition & 1 deletion deployment/Single Host/Station-Captain/properties.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packageName":"oqm-manager-station+captain",
"version":"2.2.1",
"version":"2.2.2",
"description":"Utility for setting up and maintaining an instance of Open QuarterMaster.",
"maintainer": {
"name":"EBP"
Expand Down
2 changes: 2 additions & 0 deletions deployment/Single Host/Station-Captain/src/mainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@
"providedMode": {
"caProvided": true
}
},
"plugin": {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.apache.sshd.server.command.Command;
import stationCaptainTest.testResources.config.ConfigReader;
import stationCaptainTest.testResources.config.snhSetup.ContainerSnhSetupConfig;
import stationCaptainTest.testResources.config.snhSetup.ExistingSnhSetupConfig;
Expand Down Expand Up @@ -180,18 +181,18 @@ public void uninstallOqm(){
log.info("Uninstalling OQM");
switch (this.getSetupConfig().getInstallTypeConfig().getInstallerType()){
case deb -> {
this.runCommand("systemctl", "stop", "oqm-*");
this.runCommand("apt-get", "remove", "-y", "--purge", "open+quarter+master-*");
this.runCommand("apt-get", "remove", "-y", "--purge", "oqm-*");
this.runCommand("docker", "image", "prune", "-f");
this.runCommand("systemctl", "reset-failed");
this.runCommand("systemctl", "stop", "oqm-*").assertSuccess("Stop OQM services");
// this.runCommand("apt-get", "remove", "-y", "--purge", "open+quarter+master-*").assertSuccess("Remove old OQM versions");
CommandResult uninstallResult = this.runCommand("apt-get", "remove", "-y", "--purge", "oqm-*");
this.runCommand("docker", "image", "prune", "-f");//.assertSuccess("Prune docker images");
this.runCommand("systemctl", "reset-failed");//.assertSuccess("Reset systemd");
// this.runCommand("apt-get", "-y", "autoremove");
}
case rpm -> {
//TODO
}
}
this .runCommand("rm", "-rf", "/etc/oqm", "/tmp/oqm", "/data/oqm");
this .runCommand("rm", "-rf", "/etc/oqm", "/tmp/oqm", "/data/oqm").assertSuccess("Remove OQM directories");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,17 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.smallrye.common.annotation.Blocking;
import io.smallrye.mutiny.Uni;
import jakarta.annotation.security.PermitAll;
import jakarta.annotation.security.RolesAllowed;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.Constants;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.files.FileUploadBody;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.files.ImportBundleFileBody;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.FileAttachmentSearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.HistorySearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.ImageSearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.InventoryItemSearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.ItemCategorySearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.SearchObject;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.StorageBlockSearch;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.ItemCheckoutSearch;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects.*;

import java.util.Currency;
import java.util.List;

Expand All @@ -49,9 +37,18 @@ public interface OqmCoreApiClientService {


//<editor-fold desc="Interacting Entity">
@GET
@Path(ROOT_API_ENDPOINT_V1 + "/interacting-entity")
Uni<ObjectNode> interactingEntitySearch(@HeaderParam(Constants.AUTH_HEADER_NAME) String token, @BeanParam InteractingEntitySearch entitySearch);

@GET
@Path(ROOT_API_ENDPOINT_V1 + "/interacting-entity/{id}")
Uni<ObjectNode> interactingEntityGet(@HeaderParam(Constants.AUTH_HEADER_NAME) String token, @PathParam("id") String entityId);

@GET
@Path(ROOT_API_ENDPOINT_V1 + "/interacting-entity/{id}/reference")
Uni<ObjectNode> interactingEntityGetReference(@HeaderParam(Constants.AUTH_HEADER_NAME) String token, @PathParam("id") String entityId);

//</editor-fold>

//<editor-fold desc="Units">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects;

import jakarta.ws.rs.QueryParam;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.*;
import lombok.experimental.SuperBuilder;

import java.util.List;

@ToString(callSuper = true)
@Getter
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class HistorySearch extends SearchObject {

@Setter
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package tech.ebp.oqm.lib.core.api.quarkus.runtime.restClient.searchObjects;

import jakarta.ws.rs.QueryParam;
import lombok.Getter;
import lombok.ToString;

@ToString(callSuper = true)
@Getter
public class InteractingEntitySearch extends SearchObject {
@QueryParam("name") String name;
//TODO:: object specific fields

}
2 changes: 1 addition & 1 deletion software/oqm-core-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group 'com.ebp.openQuarterMaster'
version '2.0.0'
version '2.1.0'

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions software/oqm-core-api/installerSrc/installerProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"maintainer": {
"name": "EBP <[email protected]>"
},
"description": "Base Station instance for Open QuarterMaster.",
"homepage": "https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/open-qm-base-station",
"description": "Core API instance for Open QuarterMaster.",
"homepage": "https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/oqm-core-api",
"dependencies": {
"deb": "curl, jq, docker.io, docker, oqm-manager-station+captain (>= 2.1.0), oqm-infra-jaeger (>= 1.1.0), oqm-infra-mongodb (>= 1.1.0), oqm-core-depot (>= 1.0.0)"
},
Expand Down
6 changes: 3 additions & 3 deletions software/oqm-core-api/installerSrc/oqm-core-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,14 @@ ExecStartPost=/bin/bash -c "running=\"false\"; \
status=\"$(jq --argjson hcGet \"$hcGet\" -nr '$hcGet.status')\"; \
echo \"Status: $status\"; \
if [ \"$status\" = \"UP\" ]; then \
echo \"Base Station running and available!\"; \
echo \"Core API running and available!\"; \
running=\"true\"; \
fi \
done \
"
# Remove from docker
ExecStop=/bin/bash -c "/usr/bin/docker stop -t 10 $CONTAINER_NAME || echo 'Could not stop base station container'"
ExecStopPost=/bin/bash -c "/usr/bin/docker rm $CONTAINER_NAME || echo 'Could not remove base station container'"
ExecStop=/bin/bash -c "/usr/bin/docker stop -t 10 $CONTAINER_NAME || echo 'Could not stop core api container'"
ExecStopPost=/bin/bash -c "/usr/bin/docker rm $CONTAINER_NAME || echo 'Could not remove core api container'"

[Install]
WantedBy=multi-user.target
2 changes: 1 addition & 1 deletion software/oqm-core-api/makeInstallers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ cat <<EOT >> "$buildDir/$debDir/DEBIAN/postrm"
systemctl daemon-reload
# Remove docker image
if [[ "$(docker images -q oqm-core-api 2> /dev/null)" != "" ]]; then
docker rmi oqm_base_station
docker rmi oqm-core-api
echo "Removed docker image."
else
echo "Docker image was already gone."
Expand Down
2 changes: 1 addition & 1 deletion software/oqm-core-api/src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.19-1
FROM registry.access.redhat.com/ubi8/openjdk-17:1.20-2

ENV LANGUAGE='en_US:en'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# accessed directly. (example: "foo.example.com,bar.example.com")
#
###
FROM registry.access.redhat.com/ubi8/openjdk-17:1.19-1
FROM registry.access.redhat.com/ubi8/openjdk-17:1.20-2

ENV LANGUAGE='en_US:en'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import io.quarkus.security.Authenticated;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -18,9 +15,13 @@
import org.eclipse.microprofile.openapi.annotations.tags.Tag;
import org.eclipse.microprofile.openapi.annotations.tags.Tags;
import tech.ebp.oqm.core.api.interfaces.endpoints.EndpointProvider;
import tech.ebp.oqm.core.api.model.object.interactingEntity.InteractingEntity;
import tech.ebp.oqm.core.api.model.object.interactingEntity.InteractingEntityReference;
import tech.ebp.oqm.core.api.model.object.storage.items.InventoryItem;
import tech.ebp.oqm.core.api.rest.search.InteractingEntitySearch;
import tech.ebp.oqm.core.api.service.mongo.InteractingEntityService;
import tech.ebp.oqm.core.api.service.mongo.exception.DbNotFoundException;
import tech.ebp.oqm.core.api.service.mongo.search.SearchResult;

@Slf4j
@Path(EndpointProvider.ROOT_API_ENDPOINT_V1 + "/interacting-entity")
Expand All @@ -32,7 +33,69 @@ public class InteractingEntityEndpoints extends EndpointProvider {

@Inject
InteractingEntityService interactingEntityService;

@GET
@Operation(
summary = "Searches the interacting entities."
)
@APIResponse(
responseCode = "200",
description = "Entities searched.",
content = @Content(
mediaType = "application/json",
schema = @Schema(
type = SchemaType.OBJECT,
implementation = SearchResult.class
)
)
)
@APIResponse(
responseCode = "404",
description = "No item found to get.",
content = @Content(mediaType = "text/plain")
)
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
public Response search(
@BeanParam InteractingEntitySearch search
) {
SearchResult<InteractingEntity> searchResult = this.getInteractingEntityService().search(search);
return Response.status(Response.Status.OK)
.entity(searchResult)
.build();
}

@GET
@Path("{entityId}")
@Operation(
summary = "Gets an interacting entity."
)
@APIResponse(
responseCode = "200",
description = "Item added.",
content = @Content(
mediaType = "application/json",
schema = @Schema(
type = SchemaType.ARRAY,
implementation = InventoryItem.class
)
)
)
@APIResponse(
responseCode = "404",
description = "No item found to get.",
content = @Content(mediaType = "text/plain")
)
@Authenticated
@Produces(MediaType.APPLICATION_JSON)
public Response getInteractingEntity(
@PathParam("entityId") String entityId
) {
return Response.ok(
this.interactingEntityService.get(entityId)
).build();
}

@GET
@Path("{entityId}/reference")
@Operation(
Expand All @@ -59,8 +122,15 @@ public class InteractingEntityEndpoints extends EndpointProvider {
public Response getInteractingEntityReference(
@PathParam("entityId") String entityId
) {
InteractingEntity entity = this.interactingEntityService.get(entityId);

if(entity == null){
return Response.status(Response.Status.NOT_FOUND).build();
}

log.info("Getting reference for entity {} (from id {})", entity, entityId);
return Response.ok(
new InteractingEntityReference(this.interactingEntityService.get(entityId))
new InteractingEntityReference(entity)
).build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public ItemCheckinEvent(MainObject object, InteractingEntity entity) {

@Override
public EventType getType() {
return EventType.ITEM_CHECKOUT;
return EventType.ITEM_CHECKIN;
}
}
Loading

0 comments on commit 75414af

Please sign in to comment.