Files
CMT/backend/BACKEND.md
T

29 lines
727 B
Markdown

# CMT Backend
## Usage
### API
### Alembic
```bash
# updating changes to table models to the db
cd backend
alembic revision --autogenerate -m "Header message"
alembic upgrade head
# Forcing alembic DB is up-to-date without actually running the migration
alembic stamp head
```
### Testing
```
cd backend
pytest app/test.py
# Curl POST command
curl -X POST "http://localhost:8000/clients/" -H "Content-Type: application/json" -d '{"tin_number": 100752121, "names": "Pax au Telemanus", "phone_number": "0788475021"}'
# Trying updating client details
curl -X PATCH "http://localhost:8000/clients/1" -H "Content-Type: application/json" -d '{"names": "John Wick"}'
# Deletion
curl -X DELETE http://localhost:8000/clients/2
```