hinchley2018 / learning-ecommerce

Small e-commerce project to learn full-stack development
MIT License
7 stars 9 forks source link

Build create order endpoint #6

Open hinchley2018 opened 7 months ago

hinchley2018 commented 7 months ago

Create an endpoint /orders that accepts POST requests

An order is associated to a user id User email allowing system to notify users when item moves Each order has a list of products and a quantity of each product Order total

Any missing fields or null should throw a 400 bad request with the field that is missing

If the request has all fields then you can insert the record into the orders collection

On success return the order id

hinchley2018 commented 6 months ago

Talk with @saandre0217 to make sure you are both creating the same order schema this is what was discussed in discord

{
  OrderID: String
  Customer: {
    name: string
    ...
  },
  OrderDate: Date,
  PaymentAmount: Number,
  Products: [
    {
      ProductName: string
      ProductAmount: Number
      ...
    }
  ]
}