You are browsing as a guest. Sign up (or log in) to start making projects!

2h 39m 49s logged

Summary

Today’s work focused on aligning the project with the intended business flow: guest checkout with email OTP validation, instead of traditional user registration/login. The backend, schema, and cart payload were cleaned up to remove account-based flow and enforce a consistent transaction model.

What changed

  • Removed the account-based auth flow from the project.
    • No more users table in the database.
    • No more login and register endpoints.
  • Kept the guest checkout path as the only legitimate order flow.
    • Customer browses without logging in.
    • Customer enters name, phone, and email on checkout.
    • Email OTP is sent and validated before the order is placed.
  • Fixed the order schema to match the real business model.
    • orders.customer_phone is used as the canonical phone field.
    • orders.total remains the canonical total value.
  • Refined the order item model.
    • order_items now stores either menu_id or product_id, never both.
    • This avoids the earlier issue where product_id was effectively a stringly-typed placeholder and not a real product reference.
  • Resolved cart identity collisions.
    • Menu and product items can share the same numeric id, so the cart now distinguishes them using item_type.
  • Created a separate seed.sql file for catalog data.
    • Schema file now defines structure only.
    • Seed file loads initial menu and product records.

Key architecture decision

The system now follows a single contract:

  • Guest checkout only
  • Email OTP verification required before order placement
  • Orders stored in orders
  • Line items stored in order_items
  • Each order item references either:
    • a menu item, or
    • a product item

This avoids duplicated and confusing legacy fields such as phone, total_amount, and users authentication.

Validation

I verified the JavaScript syntax for the changed backend and cart code:

  • node --check passed for the modified JavaScript files.
  • No editor errors were reported for the updated route and cart logic.

Notes / Follow-up

The remaining operational step is database migration/import:

  • recreate the local MariaDB database
  • import the cleaned schema
  • import the seed file
  • start the app and test the OTP checkout flow end-to-end
0
14

Comments 0

No comments yet. Be the first!