The backend that powers CoCo's hotline and front-end. It is developed using the serverless framework and is inteded to be deployed on AWS Lambda.
Add a new helper to the database. After a successful request, the helper can be matched.
/register
{
"name": "Mark Test",
"phone": "+4917612345678",
"zip": "21037",
"email": "[email protected]"
}
{
"message": "User created",
"phone": "+4917612345678",
}
Send a login code to a helper's phone number.
/login/+4917612345678
None
{
"message": "user_message_sent"
}
Verify that a phone number is accessible to a helper with a code sent by SMS.
/verify/+4917612345678?code=1234
None
{
"message": "user_verified",
"user": {
"phone": "+4917612345678",
"first_name": "Mark",
"last_name": "Test"
},
"token": "eyJ0eXAiOiJLT1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ5MTI1NTksImV4cCI6MTU4NDkxMzQ1OSwicGhvbmUiOiIrNDkxNzY0MjA5MDgyMSJ9.ceaqi-SGNhX6AYEsypGty9Y1C3_Jwx46SQO2iGjek3I"
}
Get data of a registered helper.
/helper/+4917612345678
Key | Value |
---|---|
Authorization | eyJ0eXAiOiJLT1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ5MTI1NTksImV4cCI6MTU4NDkxMzQ1OSwicGhvbmUiOiIrNDkxNzY0MjA5MDgyMSJ9.ceaqi-SGNhX6AYEsypGty9Y1C3_Jwx46SQO2iGjek3I |
None
{
"phone": "+4917612345678",
"first_name": "Mark",
"last_name": "Test",
"email": "[email protected]",
"lon": 10.1329393,
"lat": 53.4493502,
"zip_code": "21037",
"location_name": "Hamburg",
"is_active": true,
"verified": true
}
Update data of a registered helper.
/helper/+4917612345678
Key | Value |
---|---|
Authorization | eyJ0eXAiOiJLT1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ5MTI1NTksImV4cCI6MTU4NDkxMzQ1OSwicGhvbmUiOiIrNDkxNzY0MjA5MDgyMSJ9.ceaqi-SGNhX6AYEsypGty9Y1C3_Jwx46SQO2iGjek3I |
{
"first_name": "Mark",
"last_name": "Test",
"email": "[email protected]",
"zip_code": "21037",
"is_active": false
}
{
"phone": "+4917612345678",
"first_name": "Mark",
"last_name": "Test",
"email": "[email protected]",
"lon": 10.1329393,
"lat": 53.4493502,
"zip_code": "21037",
"location_name": "Hamburg",
"is_active": false,
"verified": true
}
Delete a registered helper.
/helper/+4917612345678
Key | Value |
---|---|
Authorization | eyJ0eXAiOiJLT1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1ODQ5MTI1NTksImV4cCI6MTU4NDkxMzQ1OSwicGhvbmUiOiIrNDkxNzY0MjA5MDgyMSJ9.ceaqi-SGNhX6AYEsypGty9Y1C3_Jwx46SQO2iGjek3I |
None
{
"message": "deleted"
}
Get the best matching helper for a zip code based on their distance to the zip code and the duration since they have last been called.
/phone?zip=21039
None
{
"phone": "+4917612345678",
"name": "Mark Test",
"location": "Hamburg",
}
- Poetry
- Python 3.7
poetry install
poetry run task setup
poetry run task lint
poetry run task test
make sure you have npm
installed at a recent version.
npx serverless deploy --stage dev/<your_name>`
look at the sql scripts in migrations/