Admin: manage the catalog (E-commerce Store (full stack))

Admins manage products: POST /admin/products {"category","id","name","price","stock"} (price and stock whole non-negative cents/units) → 201 {"product":…} or 409 {"error":"product exists"}; PATCH /admin/products/<id with any of name, price, stock, category → 200 {"product":…}; DELETE /admin/products/<id → 200 {"deleted":"<id"} (it disappears from carts and wishlists). GET /admin/low-stock?under=<n (default 5) → 200 {"products":[{"id","stock"}]} with stock below n, lowest first (ties by id). Bad bodies → 400 {"error":"bad body"}.

Input: As before.

Output: As before.

Difficulty: Hard. Write your answer in the browser editor, run the examples, then submit it against hidden tests. Python and JavaScript are free; other languages are part of licode Club.

Hint

  • Validate every field’s type: true is not a number.

More E-commerce Store (full stack) practice