- Python 3.11 or higher
- poetry
You can install the dependencies by running the following command:
poetry install
You can start the server by running the following command:
poetry run hypercorn start:app --reload
The postman collection used to test the API is available here
To facilitate testing, there is a toy database included in the test folder. To use it, add the following environment variable:
export TEST=1
It comes with:
- A user:
{
"name": "test",
"password": "$2b$12$iFMxI.xziyqiG7lS8jBnB.NLhU7aNTwlizXR8KrRil.zVrMncrwpi",
"cmd_token": null,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI5MTBkYzBjMC1jMGNhLTQ5NjctODkzMS05MmVkNmM5OGE0OGUiLCJleHAiOjE3MTI3OTQ1Njh9.B1edr-57h9LbID6BZvL5gCpM8GrANQRU1jT6K0CVZ2M",
"id": "910dc0c0c0ca4967893192ed6c98a48e",
"email": "text@example.com",
"nic": "237583734",
"role": "USER"
}
- A simple collection:
{
"name": "README.md",
"share_state": "private",
"access_from_date": null,
"id": "69c7cd429a94437bb222be8df0d1d112",
"owner_id": "910dc0c0c0ca4967893192ed6c98a48e"
}
- A complex collection:
{
"name": "c2023-adv-06.tar.gz",
"share_state": "private",
"access_from_date": null,
"id": "9872c9b88f5f4eb99290613fafc948f9",
"owner_id": "910dc0c0c0ca4967893192ed6c98a48e"
}
To create a migration, run the following command:
poetry run alembic revision --autogenerate -m "migration message"
To apply the migration, run the following command:
poetry run alembic upgrade head
To downgrade the migration, run the following command:
poetry run alembic downgrade -1
@mycsina on most platforms online