Skip to content

Refactor inventory and item equip flow#28

Merged
MelonChicken merged 7 commits into
mainfrom
feat/shopAndInventory
Jun 9, 2026
Merged

Refactor inventory and item equip flow#28
MelonChicken merged 7 commits into
mainfrom
feat/shopAndInventory

Conversation

@MelonChicken

@MelonChicken MelonChicken commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

While verifying user flow (manual end-to-end test), I found several issue.

  • reflected actual assets in the front
  • Fixed inventory retrieval to handle async item lookup correctly using a for loop
  • Updated item equip logic to apply and remove item effects properly
  • Improved shop purchase response to return updated user item and will balance

Changes

  • authService.js

    • Replaced async forEach with for loop in getInventory
    • Ensures item lookup is awaited correctly
  • eggService.js

    • Applies new item effect when equipping
    • Removes previous item effect when replacing equipped item
  • shopService.js

    • Returns created/updated user item info
    • Returns current will balance after purchase

Test

  • Checked inventory retrieval after purchase
  • Checked equip behavior when replacing already equipped items
  • Follow the user flow (Register -> Login -> post -> shop -> egg) in Swagger UI

How to test

  • After deleting database, re-initialize using npm install and npm start
image

@MelonChicken MelonChicken requested a review from naviGateauR June 7, 2026 08:29
@MelonChicken MelonChicken self-assigned this Jun 7, 2026
@MelonChicken MelonChicken added the P2: Secondary essential, but not urgent label Jun 7, 2026
@MelonChicken MelonChicken changed the title add assets path and real information Refactor inventory and item equip flow Jun 7, 2026

@naviGateauR naviGateauR left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks all good to me. I can see the changes in the code align with the documentation on SwaggerUI.

I was also able to test both the GET and POST endpoint of the Shop.
No issues.

There is a conflict with the database.sqlite though. How do we want to resolve it ?
user the one from the main branch and not merge it ?

@MelonChicken

Copy link
Copy Markdown
Collaborator Author

Looks all good to me. I can see the changes in the code align with the documentation on SwaggerUI.

I was also able to test both the GET and POST endpoint of the Shop. No issues.

There is a conflict with the database.sqlite though. How do we want to resolve it ? user the one from the main branch and not merge it ?

I can we can just delete database from this branch

@MelonChicken MelonChicken merged commit 541fe7a into main Jun 9, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2: Secondary essential, but not urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants