Skip to content

Task 1: Fix stacked free-shipping pricing logic - #7

Open
iamkarthik2004 wants to merge 3 commits into
MulearnMCE:masterfrom
iamkarthik2004:master
Open

Task 1: Fix stacked free-shipping pricing logic#7
iamkarthik2004 wants to merge 3 commits into
MulearnMCE:masterfrom
iamkarthik2004:master

Conversation

@iamkarthik2004

Copy link
Copy Markdown

No description provided.

@iamkarthik2004

Copy link
Copy Markdown
Author

Completes all three OrbitStack challenge tasks, including the required AI usage documentation.

Task 1: Fix Pricing Logic

  • Fixed stacked free-shipping logic for Pro users.
  • Removed the incorrect addition of the standard shipping amount to the product discount.
  • Added regression tests for stacked free-shipping benefits, code-only free shipping, and standard paid shipping.

Task 2: Optimize Dashboard Performance

  • Removed the N+1 order-history query pattern.
  • Loads orders, items, and products through a single Prisma relation query.
  • Limits dashboard history to the last 30 days.
  • Added a composite (userId, createdAt) index and reduced fetched fields to those used by the dashboard.

Task 3: Duplicate Order Feature

  • Added POST /api/orders/[id]/duplicate.
  • Enforces authentication and order ownership.
  • Adds only active products with sufficient current stock to the cart and skips unavailable items.
  • Added a Duplicate Order dashboard button with loading, success, partial-stock, and error feedback.

Documentation and Verification

  • Updated README.md with Task 1, Task 2 and Task 3 implementation details.
  • Completed AI_LOG.md.

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.

1 participant