People - Pan-Lang/backend GitHub Wiki

People

Endpoint

https://us-central1-pan-lang.cloudfunctions.net/people

GET

Expects a request with a query of:

{
    pantry: pantry_id
    month: 12
    year: 2021
}

Return Codes and Object Results

200 OK

  • A csv file of the orders from that pantry within that month and year

422 UNPROCESSABLE ENTITY

  • A result body with the message "Error, likely with Pantry name." Occurs when the the pantry_id is invalid and cannot be found within the database

POST

Expects a request with a body of:

{
     pantry: pantry_email,
     firstName: Kevin,
     lastName: Zhou,
     numAdults: 2,
     numChildren: 3,
     zipcode: 16046,
     orderNotes: 2 boxes, 2 hotdogs,
     fulfilled: false
}

Return Codes and Object Results

200 OK

  • Returns when the person object is successfully placed in the database

422 UNPROCESSABLE ENTITY

  • Returns when the database throws an unexpected error and cannot place the object in the database

PUT

Expects a request with a body of:

{
    pantry: pantry_email
    _id: person_id
}

Return Codes and Object Results

200 OK

  • Person object in the database gets updated so that their order is fulfilled

400 BAD REQUEST

  • Returns when there is no such document