remodeling table models and migration to postgres
This commit is contained in:
@@ -16,9 +16,11 @@ Postgresql
|
||||
```bash
|
||||
# Installation - Arch
|
||||
sudo pacman -Syu postgresql
|
||||
sudo dnf install postgresql-server postgresql-contrib # fedora
|
||||
|
||||
# Initialising db cluster
|
||||
sudo -u postgres initdb -D /var/lib/postgres/data
|
||||
sudo -u postgres initdb -D /var/lib/postgres/data # Arch
|
||||
sudo postgresql-setup --initdb # fedora
|
||||
|
||||
# enable + start service
|
||||
sudo systemctl enable --now postgresql
|
||||
@@ -28,20 +30,6 @@ sudo -u postgres createuser -P appuser
|
||||
# Creating db owned by this user
|
||||
sudo -u postgres createdb -O appuser db_name
|
||||
|
||||
# Test
|
||||
# Test user + db creation
|
||||
psql "postgresql://appuser:secret@localhost:5432/appdb"
|
||||
```
|
||||
### 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
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user