diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6ff37dc..74b0b6c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -5,6 +5,8 @@ This is a FastAPI-based water network management system (供水管网智能管 ## Running the Server ```bash +# activate the server environment +conda activate server # Install dependencies pip install -r requirements.txt @@ -17,6 +19,8 @@ python scripts/run_server.py ## Running Tests ```bash +# activate the server environment +conda activate server # Run all tests pytest @@ -77,6 +81,7 @@ python tests/conftest.py - **Encryption**: Fernet symmetric encryption for sensitive data (`app.core.encryption`) Default admin accounts: + - `admin` / `admin123` - `tjwater` / `tjwater@123` @@ -95,9 +100,10 @@ Default admin accounts: - Database instances are initialized in `main.py` lifespan and stored in `app.state.db` - Access via dependency injection: + ```python from app.auth.dependencies import get_db - + async def endpoint(db = Depends(get_db)): # Use db connection ``` @@ -177,10 +183,12 @@ await log_audit_event( ### Database Migrations SQL migration scripts are in `migrations/`: + - `001_create_users_table.sql`: User authentication tables - `002_create_audit_logs_table.sql`: Audit logging tables Apply with: + ```bash psql -U postgres -d tjwater -f migrations/001_create_users_table.sql ```