Jerkinator / secondRoll

0 stars 0 forks source link

90 changing endpoint access and cleaning up gameadslist #103

Closed MiamiYukiYuri closed 5 months ago

MiamiYukiYuri commented 5 months ago

I have cleaned up some code that we no longer needed; gameAdsList and also the methods for creating a new user since we use the sign up method for that now.

Method "getAllOrdersByUsername" has been added to OrderService, which streams through both buyer- and seller lists of orders for a matching username, and when found adds that order to a new list; "userOrders". This list now contains all of the orders connected to a user.

In OrderController there is a new endpoint, api/orders/all/{username} where users can see all of their orders.

This user specific endpoint can only be accessed by either someone with an admin role or the user who is currently logged in/authenticated.


Checkout my branch: git checkout 90-changing-endpoint-access-and-cleaning-up-gameadslist

To test in Postman, log in as both user and admin to create an order. Then simply put your username in the endpoint, ex. "/api/orders/all/Katten". Depending on your role you should only be able to retrieve either your own orders (user) or anyones orders (admin).

The response for orders is yet to be done, so right now it looks rather chaotic. I have assigned the issue of making an OrderResponse to myself at the Kanban board. Some input needed if we should wait to merge this branch before OrderResponse is done?