You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Configuration in `SPECTACULAR_SETTINGS` in `settings.py`
156
+
- Views use `@extend_schema` decorators and `serializer_class` attributes for schema generation
157
+
- JWT auth is configured in the schema — use `JWT <token>` (not `Bearer`) in Swagger UI's Authorize dialog
158
+
- To document a new endpoint: add `serializer_class` to the view if it has one, or add `@extend_schema` with `inline_serializer` for views returning raw dicts
159
+
150
160
#### Key Data Models
151
161
-**Medication** (`api.views.listMeds.models`) - Medication catalog with benefits/risks
152
162
-**MedRule** (`api.models.model_medRule`) - Include/Exclude rules for medications based on patient history
Most endpoints require JWT authentication. To test them in Swagger UI:
88
+
89
+
1.**Get a token**: Find the `POST /auth/jwt/create/` endpoint in Swagger UI, click **Try it out**, enter an authorized `email` and `password`, and click **Execute**. Copy the `access` token from the response.
90
+
2.**Authorize**: Click the **Authorize** button (lock icon) at the top of the page. Enter `JWT <your-access-token>` in the value field. The prefix must be `JWT`, not `Bearer`.
91
+
3.**Test endpoints**: All subsequent requests will include your token. Use **Try it out** on any protected endpoint.
92
+
4.**Token refresh**: Access tokens expire after 60 minutes. Use `POST /auth/jwt/refresh/` with your `refresh` token, or repeat step 1.
93
+
77
94
## Architecture
78
95
79
96
The Balancer website is a Postgres, Django REST, and React project. The source code layout is:
0 commit comments