Skip to content
Liu Xiaoyu edited this page Nov 14, 2020 · 21 revisions

BACKEND API routes

CareTaker

POST /caretakers/full_timer/

POST /caretakers/part_timer/

PATCH /caretakers/full_timer/:email

PATCH /caretakers/part_timer/:email

req.body should contain a CareTaker interface

GET /caretakers/:email

response contains CareTakerSpecializesDetails

GET /caretakers/

response contains CareTakerDetails[]

GET api/caretakers/search?start_date=2020-11-06&end_date=2020-11-08&pet_category=dog

req.query = {
"start_date": "2020-11-06",
"end_date": "2020-11-10",
"pet_category": "dog"
}

response contains SpecializesDetails[]

DELETE api/caretakers/:email

Bids

PATCH /bids/:ct_email/:pet_owner/:pet_name/:start_date/:end_date

Update of bid identified by <ct_email, pet_owner, pet_name, start_date> for lifecycle
sample req.body

{
    "bid_status": {"confirmed", "closed", "reviewed"}
    "rating" : 4.2
    "feedback" : "The service was okay."
}

DELETE /bids/:ct_email/:pet_owner/:pet_name/:start_date/:end_date

Deletion of bid identified by <ct_email, pet_owner, pet_name, start_date>

POST /bids/

Creation of bid identified by <ct_email, pet_owner, pet_name, start_date>
sample req.body

{
    "ct_email": "[email protected]",
    "pet_owner": "[email protected]",
    "pet_name": 'Crab',
    "pet_category": 'dog'
    "ct_price": 69.69,
    "start_date": "2020-10-10",
    "end_date": "2020-10-12",
    "is_cash": true,
    "credit_card": ,
    "transport_method": {'pickup', 'deliver', 'pcs'},
}

GET /bids/owner/:pet_owner

For owner to view all bids he has made for any caretaker
sample response

Array of 
{
    "ct_email": "[email protected]",
    "pet_name": 'Crab',
    "pet_category": 'dog',
    "ct_status": {1,2},
    "ct_price": 69.69,
    "ct_rating": 4.2,
    "start_date": "2020-10-10",
    "end_date": "2020-10-12",
    "is_cash": true,
    "transport_method": {'pickup', 'deliver', 'pcs'}
}

GET /bids/caretaker/:ct_email

For caretaker to view all bids made for him/her
sample response

Array of 
{
    "pet_owner": "[email protected]",
    "pet_name": 'Crab',
    "pet_category": 'dog',
    "ct_price": 69.69,
    "start_date": "2020-10-10",
    "end_date": "2020-10-12",
    "is_cash": true,
    "transport_method": 'pickup',
    "owner_fullname": "jan",
    "owner_address": "bla",
    "owner_phone": 81000000,
    "owner_avatar_link": ""
}