Skip to content

Add /order/{providerId} endpoint - #183

Merged
albi005 merged 1 commit into
masterfrom
feature/order-endpoint
Sep 10, 2025
Merged

albi005 merged 1 commit into
masterfrom
feature/order-endpoint

Conversation

@albi005

@albi005 albi005 commented Sep 8, 2025 •

Copy link
Copy Markdown
Member

This change adds an endpoint that prompts the user to log in if not logged in, then redirects to the given provider's page.

The previous flow for placing an order:

  1. Follow a link to /provider/{}
  2. Click an item
  3. Get told to log in
  4. Close the popup, find the log-in button
  5. Log in, get redirected to the home page
  6. Remember what you wanted to order
  7. Find the page of the provider
  8. Find what you wanted to order
  9. Don't order because the item went out of stock while you went on an adventure

After this change:

  1. Follow a link to /order/{}
  2. Log in
  3. Find item
  4. Order

The previous flow for placing an order:
1. Follow a link to /provider/{}
2. Click an item
3. Get told to log in
4. Close the popup, find the log-in button
5. Log in, get redirected to the home page
6. Remember what you wanted to order
7. Find the page of the provider
8. Find what you wanted to order
9. Don't order because the item went out of stock while you went on an adventure

After this change:
1. Follow a link to /order/{}
2. Log in
3. Find item
4. Order
@albi005
albi005 requested a review from Isti01 September 8, 2025 15:17
).permitAll()
auth.requestMatchers("/loggedin", "/login").permitAll()
auth.requestMatchers("/api/**").permitAll()
auth.requestMatchers("/order/**").hasRole(Role.USER.name)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since "/provider/**", is permit all, I'd use .permitAll() here as well.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to write down how this works. Check the first paragraph of the PR's description

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's intentional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Not sure if they get redirected back to that provider, otherview it's ok!

@albi005 albi005 Sep 8, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For endpoints that require auth, if the user is not logged in, before redirecting to the login page, the framework stores the path and redirects the user back after logging in.

ASP.NET supports a redirectUri query parameter for the login endpoint, but I couldn't find an equivalent feature here, so I went with this workaround.

@albi005
albi005 requested a review from Gerviba September 8, 2025 20:13
@albi005
albi005 merged commit 69d3443 into master Sep 10, 2025
1 check passed
@albi005
albi005 deleted the feature/order-endpoint branch September 10, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants