Here app description
- Server: Node.js | Express
- Authentication: Bcryptjs & JsonWebToken
- Database Builder: Knex.js
- Production Database: PostgreSQL
- Package management: yarn
https://replate-backend-turcan.herokuapp.com/api/users
Arguments
{
"type": "string", // can be either company or volunteer
"name": "string", // is unique
"phone": integer,
"email": "string", // is unique
"password": "string"
}
Return
{
"user": {
"id": 2,
"name": "test volunteer name 1",
"email": "b@b.com",
"phone": 2345678976543,
"type": "volunteer",
"password": "$2a$08$Ehjfxw30Er0ayIzi8JdDZOPiIcrtxIG6grxBpXYoERKIl5fi2cxTm"
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoyLCJuYW1lIjoidGVzdCB2b2x1bnRlZXIgbmFtZSAxIiwidHlwZSI6InZvbHVudGVlciIsImlhdCI6MTU1NTMzODgxMCwiZXhwIjoxNTU1NDI1MjEwfQ.eqBHAfae-akB6KyE-p8JRhYZEnLJFtTk3QggooYIaE4"
}
https://replate-backend-turcan.herokuapp.com/api/users/login
Arguments
{
"email": “string",
"password": “string"
}
Return
{
"user": {
"id": 1,
"name": "test company name 1",
"email": "a@a.com",
"phone": 2345678976543,
"type": "company",
"password": "$2a$08$pfgKJgNmQbj/enJxoTgxQ.VfPxUfjy523yW1a1pMcTdi7keZl.rC."
},
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoxLCJuYW1lIjoidGVzdCBjb21wYW55IG5hbWUgMSIsInR5cGUiOiJjb21wYW55IiwiaWF0IjoxNTU1MzQ3MjE0LCJleHAiOjE1NTU0MzM2MTR9.3FdAaqvM597Qs1SjyrnnkH_fT9kfcv4If_QidO39miE"
}
https://replate-backend-turcan.herokuapp.com/api/users
Return
[
{
"id": 1,
"name": "test company name 1",
"email": "a@a.com",
"phone": 2345678976543,
"type": "company",
"password": "$2a$08$pfgKJgNmQbj/enJxoTgxQ.VfPxUfjy523yW1a1pMcTdi7keZl.rC."
},
{
"id": 2,
"name": "test volunteer name 1",
"email": "b@b.com",
"phone": 2345678976543,
"type": "volunteer",
"password": "$2a$08$Ehjfxw30Er0ayIzi8JdDZOPiIcrtxIG6grxBpXYoERKIl5fi2cxTm"
},
...
]
https://replate-backend-turcan.herokuapp.com/api/users/:id
Return
{
"id": 1,
"name": "test company name 1",
"email": "a@a.com",
"phone": 2345678976543,
"type": "company",
"password": "$2a$08$pfgKJgNmQbj/enJxoTgxQ.VfPxUfjy523yW1a1pMcTdi7keZl.rC."
}
https://replate-backend-turcan.herokuapp.com/api/locations/:companyId
[
{
"id": 1,
"office_name": "Apple",
"office_address": "Cupertino, CA",
"office_email": null,
"company_id": 1
}
]
https://replate-backend-turcan.herokuapp.com/api/locations
{
"office_name": "string"
"office_address": "string"
"office_email": "string" // optional
}
https://replate-backend-turcan.herokuapp.com/api/schedules
{
"pickup_name": "string",
"pickup_date": "string",
"pickup_time": "string",
"pickup_comment": "string",
"pickup_additional_comment": "string" // optional,
"location_id": integer
}
Returns the schedule id
[
id
]
https://replate-backend-turcan.herokuapp.com/api/schedules
[
{
"id": 1,
"pickup_name": "in db",
"pickup_date": "14 september",
"pickup_time": "midnight",
"pickup_comment": " this is a test comment",
"pickup_additional_comment": null,
"taken": 0,
"volunteer_id": null,
"location_id": 1,
"company_id": 1,
"office_name": "Apple",
"office_address": "Cupertino, CA",
"office_email": null
}
]
]
https://replate-backend-turcan.herokuapp.com/api/schedules/:id
where id is the one of a schedule
{
"pickup_name": "string",
"pickup_date": "string",
"pickup_time": "string",
"pickup_comment": "string",
"pickup_additional_comment": "string" // optional,
"location_id": integer
}
https://replate-backend-turcan.herokuapp.com/api/schedules/:id/take
It is an empty request, all you have to do is provide the token.
NOTE: A company can not take a schedule, it must be a volunteer
https://replate-backend-turcan.herokuapp.com/api/schedules/:id/
will delete the schedule with the specified id