Apply patch [skip ci] (#80)
Co-authored-by: open-swe-dev-andrinoid[bot] <open-swe-dev-andrinoid@users.noreply.github.com>
This commit is contained in:
parent
38089e926e
commit
645e65626a
256
TODO.md
256
TODO.md
@ -2,8 +2,263 @@
|
||||
|
||||
## High Priority 🔴
|
||||
|
||||
### Environment Configuration
|
||||
|
||||
- [ ] **Create .env file from .env.example**
|
||||
- Copy .env.example to .env
|
||||
- Fill in all required environment variables
|
||||
- Ensure .env is added to .gitignore (already present)
|
||||
|
||||
- [ ] **Add missing environment variables to .env.example**
|
||||
- `AUTHORITY` - OAuth authority URL (used in routes/auth/login.ts, routes/index.tsx)
|
||||
- `CLIENT_ID` - OAuth client ID (used in multiple auth files)
|
||||
- `CLIENT_SECRET` - OAuth client secret (used in multiple auth files)
|
||||
- `REDIRECT_URI` - OAuth redirect URI (used in routes/auth/login.ts, routes/index.tsx)
|
||||
- `REDIRECT_HOME` - Home redirect URL (used in routes/auth/logout.ts, utils/cors.ts)
|
||||
- `REDIRECT_URL` - Base redirect URL (used in utils/database.ts)
|
||||
- `TOKEN_URL` - OAuth token endpoint (used in routes/auth/validate.ts, routes/auth/callback.ts)
|
||||
- `TENANT_ID` - Microsoft Graph tenant ID (used in services/graphAuth.ts)
|
||||
- `BLOB_PATH` - Blob storage path (used in utils/blobStorage.ts)
|
||||
- `BLOB_TOKEN_DEFAULT_EXPIRY` - Default blob token expiry (used in services/webTokenService.ts)
|
||||
- `BLOB_TOKEN_MAX_EXPIRY` - Maximum blob token expiry (used in services/webTokenService.ts)
|
||||
- `BLOB_CREATE_TOKEN_DEFAULT_EXPIRY` - Default create token expiry (used in services/webTokenService.ts)
|
||||
- `BLOB_CREATE_TOKEN_MAX_EXPIRY` - Maximum create token expiry (used in services/webTokenService.ts)
|
||||
- `EDGE_ALLOWED_ORIGINS` - Allowed CORS origins (used in utils/cors.ts)
|
||||
- `E2E_TEST` - Enable E2E test mode (used in services/e2eFixtures.ts)
|
||||
|
||||
### Error Handling Improvements
|
||||
|
||||
- [ ] **Replace console.log statements with proper logging**
|
||||
- routes/api/payments/set_auto_pay.ts (line 80)
|
||||
- routes/api/payments/cancel_auto_pay.ts (line 65)
|
||||
- routes/tenant/settings/index.tsx (line 50)
|
||||
- routes/tenant/payment-methods/index.tsx (lines 33, 43)
|
||||
- Use utils/logging.ts functions (writeAudioLog, writeImageLog, logBlobFetch) or create new logging utilities
|
||||
|
||||
- [ ] **Standardize error handling across API routes**
|
||||
- Many catch blocks use generic error handling without proper logging
|
||||
- Some routes return `JSON.stringify(e)` which may not be safe
|
||||
- Create proper error classes and error types
|
||||
- Implement consistent error response format
|
||||
|
||||
- [ ] **Add proper error logging infrastructure**
|
||||
- Extend utils/logging.ts with general error logging functions
|
||||
- Add request ID tracking for better debugging
|
||||
- Implement structured logging with log levels (error, warn, info, debug)
|
||||
|
||||
### TypeScript Type Safety
|
||||
|
||||
- [ ] **Replace `any` types with proper TypeScript types**
|
||||
- **Utils & Types:**
|
||||
- utils/request_handler.ts (line 7)
|
||||
- types/graph/ServicePrincipal.ts (lines 34, 43, 45, 46)
|
||||
- utils/TextToQuizTranslations.ts (line 33)
|
||||
- db/interfaces.ts (lines 60, 204, 251)
|
||||
- **Islands:**
|
||||
- islands/AsyncImageGenerater.tsx (line 35)
|
||||
- islands/ClearCheckedButton.tsx (lines 4-5)
|
||||
- islands/SyncButton.tsx (line 7)
|
||||
- islands/ArrangeQuiz.tsx (lines 145, 190, 235, 254)
|
||||
- islands/Card.tsx (line 332)
|
||||
- islands/StudyButton.tsx (line 7)
|
||||
- islands/AdminPage.tsx (line 187)
|
||||
- islands/dialogs/AddRentalDialog.tsx (line 4)
|
||||
- islands/dialogs/AddLeaseDialog.tsx (line 4)
|
||||
- islands/TranslationList.tsx (line 273)
|
||||
- islands/UserDashboard.tsx (lines 1136, 1167, 1196, 1235, 1264, 1349)
|
||||
- **Routes:**
|
||||
- routes/auth/validate.ts (line 96)
|
||||
- routes/landlord/onboarding/profile.tsx (line 111)
|
||||
- routes/api/update/payment_method.ts (line 51)
|
||||
- routes/landlord/maintenance/index.tsx (line 68)
|
||||
- **Services & Modules:**
|
||||
- services/stateMiddleware.ts (line 104)
|
||||
- modules/KvCacheStore.ts (lines 635, 636, 839, 850, 858)
|
||||
- **Tests:**
|
||||
- tests/e2e/helpers.ts (line 12)
|
||||
|
||||
- [ ] **Add proper type definitions for event handlers**
|
||||
- Create shared types for form event handlers
|
||||
- Define proper types for onChange, onSubmit, etc.
|
||||
- Use Preact's specific event types
|
||||
|
||||
## Medium Priority 🟡
|
||||
|
||||
### API Endpoints & Services
|
||||
|
||||
- [ ] **Create reminder API endpoints**
|
||||
- POST /api/create/reminder - Create new reminder
|
||||
- GET /api/retrieve/reminders - Get reminders for user
|
||||
- PUT /api/update/reminder - Update reminder
|
||||
- DELETE /api/delete/reminder - Delete reminder
|
||||
- PUT /api/update/reminder/complete - Mark reminder as completed
|
||||
- Service exists: services/reminderService.ts
|
||||
|
||||
- [ ] **Create financial data API endpoints**
|
||||
- GET /api/retrieve/obligations - Get user obligations
|
||||
- GET /api/retrieve/incomes - Get user incomes
|
||||
- Service exists: services/financhalServices.ts
|
||||
|
||||
- [ ] **Verify all API endpoints have proper error handling**
|
||||
- Review all routes/api/create/* files
|
||||
- Review all routes/api/update/* files
|
||||
- Review all routes/api/delete/* files
|
||||
- Review all routes/api/retrieve/* files
|
||||
- Ensure consistent error response format
|
||||
|
||||
### Code Quality & Testing
|
||||
|
||||
- [ ] **Run and fix TypeScript compilation errors**
|
||||
- Run `deno check` to identify issues
|
||||
- Fix all type mismatches
|
||||
- Ensure all files pass type checking
|
||||
|
||||
- [ ] **Validate all changed files**
|
||||
- Run `deno fmt` for formatting
|
||||
- Run `deno lint` for code quality
|
||||
- Run `deno check` for type checking
|
||||
|
||||
- [ ] **Add unit tests for services**
|
||||
- services/paymentService.ts
|
||||
- services/leaseService.ts
|
||||
- services/reminderService.ts
|
||||
- services/financhalServices.ts
|
||||
- services/tenantInviteService.ts
|
||||
|
||||
- [ ] **Add integration tests for API endpoints**
|
||||
- Test all create endpoints
|
||||
- Test all update endpoints
|
||||
- Test all delete endpoints
|
||||
- Test all retrieve endpoints
|
||||
|
||||
### Database & Schema
|
||||
|
||||
- [ ] **Verify database schema supports all features**
|
||||
- Check lease table supports required states (new, signed, active)
|
||||
- Verify tenant_id column is nullable in lease table
|
||||
- Confirm all required fields exist for reminders
|
||||
- Validate financial tables (obligations, incomes) schema
|
||||
|
||||
- [ ] **Add database migration documentation**
|
||||
- Document existing migrations in drizzle/ directory
|
||||
- Add migration rollback procedures
|
||||
- Document schema evolution
|
||||
|
||||
## Low Priority 🟢
|
||||
|
||||
### Documentation
|
||||
|
||||
- [ ] **Update README.md with setup instructions**
|
||||
- Add environment variable configuration guide
|
||||
- Document all required environment variables
|
||||
- Add troubleshooting section
|
||||
|
||||
- [ ] **Add API documentation**
|
||||
- Document all API endpoints
|
||||
- Include request/response examples
|
||||
- Add authentication requirements
|
||||
|
||||
- [ ] **Create developer onboarding guide**
|
||||
- Project structure overview
|
||||
- Development workflow
|
||||
- Testing guidelines
|
||||
- Code style guidelines
|
||||
|
||||
### Performance & Optimization
|
||||
|
||||
- [ ] **Optimize database queries**
|
||||
- Review all service functions for N+1 queries
|
||||
- Add proper indexes where needed
|
||||
- Implement query result caching
|
||||
|
||||
- [ ] **Add request/response caching**
|
||||
- Cache frequently accessed data
|
||||
- Implement cache invalidation strategy
|
||||
- Use Deno KV for caching (already configured)
|
||||
|
||||
- [ ] **Optimize bundle size**
|
||||
- Analyze production bundle
|
||||
- Remove unused dependencies
|
||||
- Implement code splitting
|
||||
|
||||
### Security
|
||||
|
||||
- [ ] **Add input validation middleware**
|
||||
- Validate all incoming request data
|
||||
- Sanitize user inputs
|
||||
- Prevent injection attacks
|
||||
|
||||
- [ ] **Add rate limiting**
|
||||
- Implement rate limiting for API endpoints
|
||||
- Add rate limiting for authentication endpoints
|
||||
- Configure rate limits per endpoint type
|
||||
|
||||
- [ ] **Add security headers**
|
||||
- Content Security Policy (CSP)
|
||||
- X-Frame-Options
|
||||
- X-Content-Type-Options
|
||||
- Strict-Transport-Security (HSTS)
|
||||
|
||||
## Completed Items ✅
|
||||
|
||||
### Lease Creation Feature Implementation
|
||||
|
||||
- [x] **Implement `getTransactionByStripeId(stripeId: string)`** in `services/paymentService.ts`
|
||||
- ✅ EXISTS at line 391
|
||||
- Used by routes/api/receipt/[id].ts and routes/api/payments/webhook.ts
|
||||
|
||||
- [x] **POST `/api/leases`** - Create new lease endpoint
|
||||
- ✅ EXISTS at routes/api/create/lease.ts
|
||||
- Request body validation (rent, deposit, propertyId, dates)
|
||||
- Database insertion with `new` state
|
||||
- Returns created lease object
|
||||
|
||||
- [x] **PUT `/api/leases/:id/invite`** - Send tenant invitation
|
||||
- ✅ EXISTS at routes/api/update/lease_invite.ts
|
||||
- Generates invitation token
|
||||
- Creates tenant invite
|
||||
- Updates lease status
|
||||
|
||||
- [x] **PUT `/api/leases/:id/accept`** - Tenant accepts invitation
|
||||
- ✅ EXISTS at routes/api/update/lease_accept.ts
|
||||
- Validates invitation token
|
||||
- Updates lease tenant field and status to `signed`
|
||||
|
||||
- [x] **Create lease creation form component**
|
||||
- ✅ AddLeaseDialog.tsx exists
|
||||
- ✅ PopAddLeaseDialog.tsx exists
|
||||
- Rent amount input field
|
||||
- Security deposit amount input field
|
||||
- Property selection dropdown
|
||||
- Lease term start/end date pickers
|
||||
- Form validation and error handling
|
||||
|
||||
- [x] **Add "Create New Lease" button on landlord dashboard**
|
||||
- ✅ Available at /leased-home route
|
||||
- ✅ LeasedHome island component exists
|
||||
|
||||
- [x] **Tenant invitation interface**
|
||||
- ✅ LandlordInviteTenant.tsx exists
|
||||
- Email input and invitation sending UI
|
||||
|
||||
## Current Blockers
|
||||
- ❌ **Missing environment variables** preventing proper authentication
|
||||
- ❌ **Missing .env file** for local development
|
||||
- ❌ **Inconsistent error handling** across API routes
|
||||
- ❌ **TypeScript any types** reducing type safety
|
||||
|
||||
## Next Steps
|
||||
1. Create .env file and add missing environment variables to .env.example
|
||||
2. Replace console.log statements with proper logging
|
||||
3. Standardize error handling across all API routes
|
||||
4. Replace TypeScript any types with proper types
|
||||
5. Create missing API endpoints for reminders and financial data
|
||||
6. Add comprehensive error logging infrastructure
|
||||
7. Run deno check, fmt, and lint to fix code quality issues
|
||||
8. Add unit and integration tests for services and API endpoints
|
||||
9. Update documentation with setup and API guides
|
||||
10. Implement performance optimizations and security enhancements
|
||||
|
||||
#### Frontend Components
|
||||
- [ ] **Create lease creation form component** (`components/LeaseForm.tsx`)
|
||||
- Rent amount input field
|
||||
@ -77,3 +332,4 @@
|
||||
2. Implement lease creation API endpoints
|
||||
3. Create frontend components for lease management
|
||||
4. Test complete workflow end-to-end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user