Backend Complete: Interface Refactoring & Service Container Enhancements
Repository Interface Optimization: - Created IBaseRepository.ts and IPaginatedRepository.ts - Refactored all 7 repository interfaces to extend base interfaces - Eliminated ~200 lines of redundant code (70% reduction) - Improved type safety and maintainability Dependency Injection Improvements: - Added EmailService and GameTokenService to DIContainer - Updated CreateUserCommandHandler constructor for DI - Updated RequestPasswordResetCommandHandler constructor for DI - Enhanced testability and service consistency Environment Configuration: - Created comprehensive .env.example with 40+ variables - Organized into 12 logical sections (Database, Security, Email, etc.) - Added security guidelines and best practices - Documented all backend environment requirements Documentation: - Added comprehensive codebase review - Created refactoring summary report - Added frontend implementation guide Impact: Improved code quality, reduced maintenance overhead, enhanced developer experience
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
# pgAdmin Database Administration Guide
|
||||
|
||||
## Access pgAdmin
|
||||
|
||||
- **URL**: http://localhost:8080
|
||||
- **Email**: admin@serpentrace.dev
|
||||
- **Password**: admin
|
||||
|
||||
## Pre-configured Server
|
||||
|
||||
The pgAdmin interface should have a pre-configured server named **"SerpentRace PostgreSQL Dev"** in the "Development" group.
|
||||
|
||||
## Manual Server Configuration (If Needed)
|
||||
|
||||
If the server is not automatically configured, add it manually:
|
||||
|
||||
### Server Details
|
||||
- **Name**: SerpentRace PostgreSQL Dev
|
||||
- **Host**: postgres (or localhost if connecting from outside Docker)
|
||||
- **Port**: 5432
|
||||
- **Database**: serpentrace
|
||||
- **Username**: postgres
|
||||
- **Password**: postgres
|
||||
|
||||
### Steps to Add Server Manually
|
||||
|
||||
1. Right-click on "Servers" in the left panel
|
||||
2. Select "Register" > "Server..."
|
||||
3. Fill in the "General" tab:
|
||||
- Name: `SerpentRace PostgreSQL Dev`
|
||||
- Server group: `Development`
|
||||
4. Fill in the "Connection" tab:
|
||||
- Host name/address: `postgres`
|
||||
- Port: `5432`
|
||||
- Maintenance database: `serpentrace`
|
||||
- Username: `postgres`
|
||||
- Password: `postgres`
|
||||
5. Click "Save"
|
||||
|
||||
## Common Database Operations
|
||||
|
||||
### View Tables
|
||||
1. Expand the server connection
|
||||
2. Expand "Databases" > "serpentrace"
|
||||
3. Expand "Schemas" > "public"
|
||||
4. Expand "Tables"
|
||||
|
||||
### Run SQL Queries
|
||||
1. Right-click on the database name
|
||||
2. Select "Query Tool"
|
||||
3. Write your SQL queries in the editor
|
||||
4. Click the "Execute" button or press F5
|
||||
|
||||
### View Data
|
||||
1. Right-click on any table
|
||||
2. Select "View/Edit Data" > "All Rows"
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Connection Issues
|
||||
- Ensure Docker containers are running: `docker ps`
|
||||
- Check container logs: `docker logs serpentrace-postgres-dev`
|
||||
- Test connections: `npm run test:connections`
|
||||
|
||||
### Authentication Failed
|
||||
- Verify the password is correct: `postgres`
|
||||
- Check if you're using the correct hostname: `postgres` (inside Docker) vs `localhost` (outside Docker)
|
||||
|
||||
### Server Not Appearing
|
||||
- Restart pgAdmin container:
|
||||
```bash
|
||||
docker-compose -f docker-compose.dev.yml restart pgadmin
|
||||
```
|
||||
- Clear browser cache and reload
|
||||
|
||||
## Development Tips
|
||||
|
||||
### Useful SQL Queries
|
||||
|
||||
```sql
|
||||
-- List all tables
|
||||
SELECT table_name FROM information_schema.tables
|
||||
WHERE table_schema = 'public';
|
||||
|
||||
-- Check database size
|
||||
SELECT pg_size_pretty(pg_database_size('serpentrace'));
|
||||
|
||||
-- View active connections
|
||||
SELECT * FROM pg_stat_activity WHERE datname = 'serpentrace';
|
||||
|
||||
-- Check migration status (if using TypeORM)
|
||||
SELECT * FROM migrations ORDER BY timestamp DESC;
|
||||
```
|
||||
|
||||
### Database Backup
|
||||
1. Right-click on database name
|
||||
2. Select "Backup..."
|
||||
3. Choose format (Custom recommended for pgAdmin restore)
|
||||
4. Set filename and location
|
||||
5. Click "Backup"
|
||||
|
||||
### Database Restore
|
||||
1. Right-click on "Databases"
|
||||
2. Select "Restore..."
|
||||
3. Choose the backup file
|
||||
4. Configure options as needed
|
||||
5. Click "Restore"
|
||||
|
||||
## Security Notes
|
||||
|
||||
⚠️ **Development Only**: The current configuration uses default credentials and is intended for development only. For production:
|
||||
|
||||
- Use strong, unique passwords
|
||||
- Enable SSL connections
|
||||
- Restrict network access
|
||||
- Use environment variables for credentials
|
||||
- Enable authentication and authorization features
|
||||
Reference in New Issue
Block a user