diff --git a/.vscode/launch.json b/.vscode/launch.json index b1300e6..655f9db 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,10 +20,18 @@ "noDebug": false, "__progressId": "ac782dee-a961-4892-9b94-9090bfdfcbda", "__origin": "internal" + }, + { + "type": "java", + "name": "ApplicationView-linux", + "request": "launch", + "mainClass": "edu.inventorym.ApplicationView", + "projectName": "UiView", + "vmArgs": " --module-path /home/sherwinp/workspace/javafx-sdk/lib --add-modules ALL-MODULE-PATH --enable-native-access=javafx.web,javafx.controls,javafx.media,javafx.graphics -Dcom.sun.management.jmxremote=false -Djava.awt.headless=true -XX:+DisableAttachMechanism" }, { "type": "java", - "name": "ApplicationView", + "name": "ApplicationView-windows", "request": "launch", "mainClass": "edu.inventorym.ApplicationView", "projectName": "UiView", diff --git a/Model/src/main/java/edu/inventorym/model/DataRepository.java b/Model/src/main/java/edu/inventorym/model/DataRepository.java index c8387c5..71b0542 100644 --- a/Model/src/main/java/edu/inventorym/model/DataRepository.java +++ b/Model/src/main/java/edu/inventorym/model/DataRepository.java @@ -216,7 +216,7 @@ public class DataRepository { public final static String getPath() { String home = System.getenv("HOME") != null ? System.getenv("HOME") : System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH"); - return home.replace('\\', '/') + "/workspace/inventorym/Api/src/resources/db"; + return home.replace('\\', '/') + "/workspace/inventorym/Ui/src/resources/db"; } } } diff --git a/Ui/src/main/java/edu/inventorym/ApiController.java b/Ui/src/main/java/edu/inventorym/ApiController.java index c588283..07c3846 100644 --- a/Ui/src/main/java/edu/inventorym/ApiController.java +++ b/Ui/src/main/java/edu/inventorym/ApiController.java @@ -29,7 +29,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; @RestController @RequestMapping("/api") -public interface ApiController { // SINGLETON +public class ApiController { // SINGLETON @Operation(summary = "Get status Inventory Loaded", description = "Returns status Inventory Loaded.") @ApiResponse(responseCode = "200", description = "loaded") @@ -45,16 +45,9 @@ public interface ApiController { // SINGLETON InventoryManager.getInstance().add(make(new Sculpture())); InventoryManager.getInstance().add(make(new Sculpture())); InventoryManager.getInstance().add(make(new Sculpture())); - } - return new ResponseEntity<>("Resource loaded!", HttpStatus.OK); - } - static void callerInterface() { - // @Comment - /* - * 1. Add new art object to the inventory. Your manager must check that the art - * is not already in the inventory before adding - */ + InventoryManager.getInstance().save(); + } /* Customers */ CustomerManager.getInstance().load(); @@ -68,6 +61,16 @@ public interface ApiController { // SINGLETON CustomerManager.getInstance().save(); } + return new ResponseEntity<>("Resource loaded!", HttpStatus.OK); + } + + static void callerInterface() { + // @Comment + /* + * 1. Add new art object to the inventory. Your manager must check that the art + * is not already in the inventory before adding + */ + /* * 2. Remove art object from the inventory */ diff --git a/Ui/src/resources/db/customers.json b/Ui/src/resources/db/customers.json new file mode 100644 index 0000000..0e42398 --- /dev/null +++ b/Ui/src/resources/db/customers.json @@ -0,0 +1,23 @@ +[ + { + "email": "kate@museum.com", + "id": "2020281777", + "nameFirst": "Kate", + "nameLast": "Demsey", + "phone": "310-676-4844" + }, + { + "email": "jim@homedeco.com", + "id": "5261329301", + "nameFirst": "Jim", + "nameLast": "Gumbly", + "phone": "203-676-4844" + }, + { + "email": "evan@homedeco.com", + "id": "4961460829", + "nameFirst": "Evan", + "nameLast": "Hao", + "phone": "203-676-8943" + } +] \ No newline at end of file diff --git a/Ui/src/resources/db/inventory.json b/Ui/src/resources/db/inventory.json new file mode 100644 index 0000000..9e30c8b --- /dev/null +++ b/Ui/src/resources/db/inventory.json @@ -0,0 +1,67 @@ +[ + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.628880822-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "3215738680", + "price": 92.0, + "title": "Windy Rowing", + "type": "DRAWING" + }, + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.628927081-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "5150484617", + "price": 102.0, + "title": "Different day same thing", + "type": "PRINT" + }, + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.628966511-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "4279724246", + "price": 51.0, + "title": "Walking by the beach.", + "type": "PAINTING", + "height": 0, + "width": 0 + }, + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.628997921-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "2561610938", + "price": 32.0, + "title": "Jolly Romp", + "type": "SCULPTURE", + "weight": 4.0 + }, + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.629066491-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "3819887576", + "price": 32.0, + "title": "Jolly Romp", + "type": "SCULPTURE", + "weight": 4.0 + }, + { + "Author": "Dave Janson", + "author": "Dave Janson", + "created": "2026-01-28T18:21:41.62908951-05:00[America/New_York]", + "description": "East Market Square find. Local Author.", + "id": "4329655027", + "price": 32.0, + "title": "Jolly Romp", + "type": "SCULPTURE", + "weight": 4.0 + } +] \ No newline at end of file diff --git a/UiView/src/resources/index.html b/UiView/src/resources/index.html index b8a2dc2..9461c9b 100644 --- a/UiView/src/resources/index.html +++ b/UiView/src/resources/index.html @@ -16,7 +16,7 @@
- +