|
@@ -32,92 +32,37 @@ from a Google Sheet import.
|
|
|
|
|
|
|
|
For running the application
|
|
For running the application
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-git clone ...
|
|
|
|
|
-cd ...
|
|
|
|
|
-python -m venv venv
|
|
|
|
|
-venv/scripts/activate
|
|
|
|
|
-poetry install
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-Note, be sure to use python3.11 with this application
|
|
|
|
|
-
|
|
|
|
|
-* Copy .env.example to .env and edit it to configure your setup
|
|
|
|
|
-
|
|
|
|
|
-```bash
|
|
|
|
|
-init.sh
|
|
|
|
|
-uvicorn app.main:app --reload
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-### Bootstrapping the first organization / super_admin
|
|
|
|
|
|
|
+> git clone ...
|
|
|
|
|
+> cd ...
|
|
|
|
|
|
|
|
-New databases start with no organizations and no `super_admin`. After
|
|
|
|
|
-running migrations, promote the first user manually (there is currently
|
|
|
|
|
-no API endpoint for this, by design — it's a one-time operational step):
|
|
|
|
|
|
|
+> python -m venv venv
|
|
|
|
|
+> venv/scripts/activate
|
|
|
|
|
+> poetry install
|
|
|
|
|
|
|
|
-```sql
|
|
|
|
|
-UPDATE user_model
|
|
|
|
|
-SET global_role = 'SUPER_ADMIN'
|
|
|
|
|
-WHERE email = '<you>';
|
|
|
|
|
-```
|
|
|
|
|
|
|
+Note, be sure to use python3.11 with this application
|
|
|
|
|
|
|
|
-From there, that user can create organizations and add members via the
|
|
|
|
|
-`/organizations` endpoints.
|
|
|
|
|
|
|
+> Copy .env.example to .env and edit it to configure your setup
|
|
|
|
|
+> init.sh
|
|
|
|
|
+> uvicorn app.main:app --reload
|
|
|
|
|
|
|
|
## Debug
|
|
## Debug
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-python -m app.debug
|
|
|
|
|
-```
|
|
|
|
|
|
|
+> python -m app.debug
|
|
|
|
|
|
|
|
Run tests
|
|
Run tests
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-pytest
|
|
|
|
|
-pytest app\test\test_volunteer.py
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-Run coverage tests
|
|
|
|
|
|
|
+> pytest
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-coverage run -m pytest
|
|
|
|
|
-coverage html
|
|
|
|
|
-```
|
|
|
|
|
|
|
+Run specific tests
|
|
|
|
|
|
|
|
-## Database migrations
|
|
|
|
|
-
|
|
|
|
|
-```bash
|
|
|
|
|
-# create migration
|
|
|
|
|
-alembic revision --autogenerate -m "migration_name"
|
|
|
|
|
-# apply all migrations
|
|
|
|
|
-alembic upgrade head
|
|
|
|
|
-```
|
|
|
|
|
-
|
|
|
|
|
-Autogenerated migrations are a starting point, not a final draft —
|
|
|
|
|
-review them by hand, especially for:
|
|
|
|
|
-
|
|
|
|
|
-- new `NOT NULL` columns on tables that may already have data (add
|
|
|
|
|
- nullable, backfill, then tighten in the same migration)
|
|
|
|
|
-- new Postgres ENUM types referenced outside a `create_table` block
|
|
|
|
|
- (need an explicit `create_type=False` + manual `CREATE TYPE`/`DROP TYPE`)
|
|
|
|
|
-- FK `ondelete` behavior vs. the SQLAlchemy relationship's own cascade
|
|
|
|
|
- config (see `passive_deletes=True` on `Organization.projects` — without
|
|
|
|
|
- it, `session.delete(org)` tries to null out `Project.organization_id`
|
|
|
|
|
- in Python before the DB's `ON DELETE CASCADE` ever runs, which fails
|
|
|
|
|
- since that column is `NOT NULL`)
|
|
|
|
|
|
|
+> pytest app\test\test_volunteer.py
|
|
|
|
|
|
|
|
## Update requirements
|
|
## Update requirements
|
|
|
|
|
|
|
|
-```bash
|
|
|
|
|
-poetry lock
|
|
|
|
|
-poetry export -f requirements.txt --output requirements.txt --without-hashes
|
|
|
|
|
-poetry export -f requirements.txt --output requirements-dev.txt --without-hashes --with dev
|
|
|
|
|
```
|
|
```
|
|
|
-
|
|
|
|
|
-## Update frontend API types
|
|
|
|
|
-
|
|
|
|
|
-```bash
|
|
|
|
|
-npm run update-schema
|
|
|
|
|
|
|
+> poetry lock
|
|
|
|
|
+> poetry export -f requirements.txt --output requirements.txt --without-hashes
|
|
|
|
|
+> poetry export -f requirements.txt --output requirements-dev.txt --without-hashes --with dev
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
Regenerate after any backend route or schema change — see the frontend
|
|
Regenerate after any backend route or schema change — see the frontend
|