Write order item dao - #1
Open
Nick040791 wants to merge 15 commits into
Open
Conversation
- Created MySQL 'web_shop' server running on port 3306 - Configured spring.datasource user/pass
1. Loaded/ran 'create-database.sql' script in My SQL workbench successfully serving over port 3306 2. Test ran Spring Boor Application in IntelliJ 3. Postman collections loaded from import into workspace 3. Ran POST login to authenticate as Admin 4. Ran Profile and User REST endpoint requests with success. using Postman *Read for exercises*
-OrderController.java -OrderItemController.java -ProdcutController.java
Created the Product DAO class, fixed capitalization issues and ran the spring boot application. implemented: get create update delete tests never reach the DAO because there is no ProductController yet.
implemented Product Controller for Product DAO get create update delete -all ProductEndpointTests unit tests pass -all Postman Products API endpoint tests pass
implemented the Order Data Access Object with: list order, list order by username, get order by id, create order,
OrderController for OrderDao implemented: list, get, create, update, delete, controls units tests pass for OrderEndpointTests, ProductsEndpointTests, and UserEndpointTests Postman API endpoint tests pass for Orders other than update order --
updated OrderItemDao class with list list order get by id create update delete -- cannot test without controller
Completed OrderByItemController - all unit tests pass - all postman endpoint tests pass Unit 2 complete!
There was a problem hiding this comment.
Pull request overview
This PR merges a working branch that adds CRUD data-access and REST endpoints for Products, Orders, and Order Items, along with Postman collections to exercise the API. It also updates local environment/build settings (datasource config, Maven compiler settings) and includes IDE workspace metadata.
Changes:
- Added DAO layers for products, orders, and order items using
JdbcTemplate. - Added REST controllers for products, orders, and order items (including optional query-parameter filters).
- Added Postman workspace/collection YAMLs for users/profile/products/orders/order-items, plus updated local config/IDE metadata.
Reviewed changes
Copilot reviewed 45 out of 59 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| java-springboot-final/src/main/resources/application.properties | Updates datasource credentials. |
| java-springboot-final/src/main/java/org/example/daos/ProductDao.java | Adds JDBC DAO for products. |
| java-springboot-final/src/main/java/org/example/daos/OrderItemDao.java | Adds JDBC DAO for order items. |
| java-springboot-final/src/main/java/org/example/daos/OrderDao.java | Adds JDBC DAO for orders. |
| java-springboot-final/src/main/java/org/example/controllers/ProductController.java | Adds REST CRUD endpoints for products. |
| java-springboot-final/src/main/java/org/example/controllers/OrderItemController.java | Adds REST CRUD endpoints for order items (+ optional orderId filter). |
| java-springboot-final/src/main/java/org/example/controllers/OrderController.java | Adds REST CRUD endpoints for orders (+ optional username filter, Principal override on POST). |
| java-springboot-final/postman/postman/globals/workspace.globals.yaml | Adds Postman globals scaffold. |
| java-springboot-final/postman/postman/collections/web-store/Users/Get Test User.request.yaml | Adds Postman request for getting test user. |
| java-springboot-final/postman/postman/collections/web-store/Users/Get Test User Roles.request.yaml | Adds Postman request for getting test user roles. |
| java-springboot-final/postman/postman/collections/web-store/Users/Get All Users.request.yaml | Adds Postman request for listing users. |
| java-springboot-final/postman/postman/collections/web-store/Users/Delete Test User.request.yaml | Adds Postman request for deleting test user. |
| java-springboot-final/postman/postman/collections/web-store/Users/Delete TEST role from test.request.yaml | Adds Postman request for removing a role from test user. |
| java-springboot-final/postman/postman/collections/web-store/Users/Create Test User.request.yaml | Adds Postman request for creating test user. |
| java-springboot-final/postman/postman/collections/web-store/Users/Change Test Password.request.yaml | Adds Postman request for changing test user password. |
| java-springboot-final/postman/postman/collections/web-store/Users/Add TEST role to test.request.yaml | Adds Postman request for adding TEST role. |
| java-springboot-final/postman/postman/collections/web-store/Users/Add ADMIN role to test.request.yaml | Adds Postman request for adding ADMIN role. |
| java-springboot-final/postman/postman/collections/web-store/Users/.resources/definition.yaml | Adds Postman folder definition for Users. |
| java-springboot-final/postman/postman/collections/web-store/Profile/Get Profile.request.yaml | Adds Postman request for profile. |
| java-springboot-final/postman/postman/collections/web-store/Profile/Get Profile Roles.request.yaml | Adds Postman request for profile roles. |
| java-springboot-final/postman/postman/collections/web-store/Profile/Change Password To -test-.request.yaml | Adds Postman request for changing profile password to test. |
| java-springboot-final/postman/postman/collections/web-store/Profile/Change Password To -admin-.request.yaml | Adds Postman request for changing profile password to admin. |
| java-springboot-final/postman/postman/collections/web-store/Profile/.resources/definition.yaml | Adds Postman folder definition for Profile. |
| java-springboot-final/postman/postman/collections/web-store/Products/Update Product 6.request.yaml | Adds Postman request for updating product. |
| java-springboot-final/postman/postman/collections/web-store/Products/Get Product By Id.request.yaml | Adds Postman request for getting product by id. |
| java-springboot-final/postman/postman/collections/web-store/Products/Get All Products.request.yaml | Adds Postman request for listing products. |
| java-springboot-final/postman/postman/collections/web-store/Products/Delete Product 6.request.yaml | Adds Postman request for deleting product. |
| java-springboot-final/postman/postman/collections/web-store/Products/Create Product 6.request.yaml | Adds Postman request for creating product. |
| java-springboot-final/postman/postman/collections/web-store/Products/.resources/definition.yaml | Adds Postman folder definition for Products. |
| java-springboot-final/postman/postman/collections/web-store/Orders/Update Order 6.request.yaml | Adds Postman request for updating order. |
| java-springboot-final/postman/postman/collections/web-store/Orders/Get Order By Id.request.yaml | Adds Postman request for getting order by id. |
| java-springboot-final/postman/postman/collections/web-store/Orders/Get All Orders.request.yaml | Adds Postman request for listing orders. |
| java-springboot-final/postman/postman/collections/web-store/Orders/Delete Order 6.request.yaml | Adds Postman request for deleting order. |
| java-springboot-final/postman/postman/collections/web-store/Orders/Create Order 6.request.yaml | Adds Postman request for creating order. |
| java-springboot-final/postman/postman/collections/web-store/Orders/.resources/definition.yaml | Adds Postman folder definition for Orders. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/Update Order Item 1.request.yaml | Adds Postman request for updating order item. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/Get Order Item By Id.request.yaml | Adds Postman request for getting order item by id. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/Get All Order Items.request.yaml | Adds Postman request for listing order items. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/Delete Order Item 1.request.yaml | Adds Postman request for deleting order item. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/Create Order Item 1.request.yaml | Adds Postman request for creating order item. |
| java-springboot-final/postman/postman/collections/web-store/Order Items/.resources/definition.yaml | Adds Postman folder definition for Order Items. |
| java-springboot-final/postman/postman/collections/web-store/login.request.yaml | Adds Postman login request with token extraction script. |
| java-springboot-final/postman/postman/collections/web-store/.resources/definition.yaml | Adds Postman collection definition (variables/auth). |
| java-springboot-final/postman/.postman/resources.yaml | Adds Postman workspace resources mapping. |
| java-springboot-final/pom.xml | Adds Maven compiler plugin configuration. |
| java-springboot-final/.idea/sqldialects.xml | Adds IntelliJ SQL dialect mapping (IDE metadata). |
| java-springboot-final/.idea/dataSources/data_sources_history.xml | Adds IntelliJ datasource history (IDE metadata). |
| java-springboot-final/.idea/dataSources.xml | Adds IntelliJ datasource config (IDE metadata). |
| java-springboot-final/.idea/dataSources.local.xml | Adds IntelliJ local datasource config (IDE metadata). |
| java-springboot-final/.idea/data_source_mapping.xml | Adds IntelliJ datasource file mappings (IDE metadata). |
| .idea/vcs.xml | Adds root IntelliJ VCS mapping (IDE metadata). |
| .idea/modules.xml | Adds root IntelliJ module config (IDE metadata). |
| .idea/misc.xml | Adds root IntelliJ project SDK config (IDE metadata). |
| .idea/jarRepositories.xml | Adds root IntelliJ jar repos config (IDE metadata). |
| .idea/flexpath-unit-2-final.iml | Adds root IntelliJ module file (IDE metadata). |
| .idea/encodings.xml | Adds root IntelliJ encodings config (IDE metadata). |
| .idea/dataSources.xml | Adds root IntelliJ datasource config (IDE metadata). |
| .idea/compiler.xml | Adds root IntelliJ compiler settings (IDE metadata). |
| .idea/.gitignore | Adds IntelliJ gitignore rules. |
Files not reviewed (14)
- .idea/.gitignore: Generated file
- .idea/compiler.xml: Generated file
- .idea/dataSources.xml: Generated file
- .idea/encodings.xml: Generated file
- .idea/flexpath-unit-2-final.iml: Generated file
- .idea/jarRepositories.xml: Generated file
- .idea/misc.xml: Generated file
- .idea/modules.xml: Generated file
- .idea/vcs.xml: Generated file
- java-springboot-final/.idea/dataSources.local.xml: Generated file
- java-springboot-final/.idea/dataSources.xml: Generated file
- java-springboot-final/.idea/dataSources/data_sources_history.xml: Generated file
- java-springboot-final/.idea/data_source_mapping.xml: Generated file
- java-springboot-final/.idea/sqldialects.xml: Generated file
Suppressed comments (1)
java-springboot-final/src/main/java/org/example/controllers/OrderController.java:67
- This comment is a local Postman run note and doesn't belong in production code. If it's still needed, move it to the Postman collection/README instead.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+2
to
+3
| spring.datasource.username=nick0 | ||
| spring.datasource.password=Nb221291?? |
Comment on lines
+95
to
+102
| <plugin> | ||
| <groupId>org.apache.maven.plugins</groupId> | ||
| <artifactId>maven-compiler-plugin</artifactId> | ||
| <configuration> | ||
| <source>25</source> | ||
| <target>25</target> | ||
| </configuration> | ||
| </plugin> |
Comment on lines
+40
to
+44
| try { | ||
| return orderItemDao.updateOrderItem(item); | ||
| } catch (RuntimeException e) { | ||
| throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Order item not found"); | ||
| } |
Comment on lines
+51
to
+55
| try { | ||
| return orderDao.updateOrder(order); | ||
| } catch (RuntimeException e) { | ||
| throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Order not found"); | ||
| } |
Comment on lines
+1
to
+19
| <DataSourcesHistory> | ||
| <DataSourceFromHistory isRemovedFromProject="false"> | ||
| <data-source source="LOCAL" name="web_shop@localhost" uuid="85733b47-5a05-4bc1-95af-19085e761aa9"> | ||
| <database-info product="" version="" jdbc-version="" driver-name="" driver-version="" dbms="MYSQL" /> | ||
| <driver-ref>mysql.8</driver-ref> | ||
| <synchronize>true</synchronize> | ||
| <imported>true</imported> | ||
| <remarks>C:/Users/nicho/OneDrive/Documents/GitHub/flexpath-unit-2-final/java-springboot-final/src/main/resources/application.properties</remarks> | ||
| <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver> | ||
| <jdbc-url>jdbc:mysql://localhost:3306/web_shop</jdbc-url> | ||
| <jdbc-additional-properties> | ||
| <property name="com.intellij.clouds.kubernetes.db.host.port" /> | ||
| <property name="com.intellij.clouds.kubernetes.db.enabled" value="false" /> | ||
| <property name="com.intellij.clouds.kubernetes.db.container.port" /> | ||
| </jdbc-additional-properties> | ||
| <secret-storage>master_key</secret-storage> | ||
| <user-name>nick0</user-name> | ||
| <schema-mapping /> | ||
| <working-dir>$ProjectFileDir$</working-dir> |
Comment on lines
+1
to
+6
| /* | ||
| The README bonus says overwriting the username from Principal on both create and | ||
| update. The unit test "putOrderShouldUpdateThirdOrder" sends a body with username "user" and says | ||
| that the returned order still has username "user". If I overwrite on PUT, that test fails. So only apply the | ||
| Principal overwrite on POST. | ||
| */ |
Comment on lines
+37
to
+41
| try { | ||
| return productDao.updateProduct(product); | ||
| } catch (RuntimeException e) { | ||
| throw new ResponseStatusException(HttpStatus.NOT_FOUND, "Product not found"); | ||
| } |
-changed project settings to JDK 17 - removed java 25 compiler plugin from pom.xl
clear sensitive credentials set to placeholder values
Copilot stopped work on behalf of
Nick040791 due to an error
August 10, 2026 03:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge working branch into main.
All unit tests pass
All Postman Tests pass with exception of put update in Orders. There is no order 6.