Update copilot-instructions.md
This commit is contained in:
4
.github/copilot-instructions.md
vendored
4
.github/copilot-instructions.md
vendored
@@ -33,6 +33,10 @@ This monorepo contains a Django backend and a Vite/React frontend, orchestrated
|
|||||||
- Static/media files: S3 in production, local in dev (see `settings.py`).
|
- Static/media files: S3 in production, local in dev (see `settings.py`).
|
||||||
- API versioning and docs: DRF Spectacular config in `settings.py`.
|
- API versioning and docs: DRF Spectacular config in `settings.py`.
|
||||||
- Custom permissions, filters, and serializers in each app.
|
- Custom permissions, filters, and serializers in each app.
|
||||||
|
- **Serializer Best Practices**:
|
||||||
|
- **Prevent Duplicate Schemas**: When the same `ChoiceField` or complex field appears in multiple serializers, define it once as a reusable field class and use it everywhere instead of repeated definitions.
|
||||||
|
- Example: Create `OrderStatusField(serializers.ChoiceField)` with `choices=Order.OrderStatus.choices` and reuse it in all serializers that need order status.
|
||||||
|
- This ensures consistent OpenAPI schema generation and reduces maintenance overhead.
|
||||||
- **Frontend**
|
- **Frontend**
|
||||||
- Use React Router layouts for shared UI (see `src/layouts/`, `LAYOUTS.md`).
|
- Use React Router layouts for shared UI (see `src/layouts/`, `LAYOUTS.md`).
|
||||||
- API calls and JWT handling in `src/api/`.
|
- API calls and JWT handling in `src/api/`.
|
||||||
|
|||||||
Reference in New Issue
Block a user