This commit is contained in:
Nathan Anderson 2026-01-23 08:48:30 -06:00
parent 519b870953
commit 38089e926e
2 changed files with 70 additions and 56 deletions

121
TODO.md
View File

@ -1,68 +1,79 @@
# CyberHybridHub TODO # CyberHybridHub TODO
## High Priority ## High Priority 🔴
### Implement Lease Creation for Landlord Dashboard ### Lease Creation Feature Implementation
- **Add "Create New Lease" button** to the landlord dashboard #### Frontend Components
- **Lease creation form** with basic price information: - [ ] **Create lease creation form component** (`components/LeaseForm.tsx`)
- Rent amount - Rent amount input field
- Security deposit amount - Security deposit amount input field
- Property selection - Property selection dropdown
- Lease term dates - Lease term start/end date pickers
- **Lease states implementation**: - Form validation and error handling
- `new` - Initial state when created by landlord - [ ] **Add "Create New Lease" button next to "Add Property" button** on landlord dashboard (`/dashboard/landlord` route)
- `signed` - After tenant accepts invitation - [ ] **Create lease creation modal/page** (`routes/landlord/create-lease.tsx`)
- **Tenant field handling**: - [ ] **Tenant invitation interface** - Email input and invitation sending UI
- Make tenant field optional during creation
- Allow landlord to invite tenant after lease creation
- Update tenant field when invitation is accepted
### Bug Fixes #### Backend API Endpoints
- [ ] **POST `/api/leases`** - Create new lease endpoint
- Request body validation (rent, deposit, propertyId, dates)
- Database insertion with `new` state
- Return created lease object
- [ ] **PUT `/api/leases/:id/invite`** - Send tenant invitation
- Generate invitation token
- Send email to tenant
- Update lease status
- [ ] **PUT `/api/leases/:id/accept`** - Tenant accepts invitation
- Validate invitation token
- Update lease tenant field and status to `signed`
- **Fix TypeScript import errors** in receipt API routes ## Medium Priority 🟡
- **Add missing `getTransactionByStripeId` function** to paymentService.ts
- **Fix type annotations** for API route handlers
- **Validate all changed files** with `deno check`, `deno fmt`, and `deno lint`
## Technical Implementation Details
### Lease Creation Flow
1. **Landlord Dashboard Enhancement**
- Add "Create New Lease" button component
- Create lease creation modal/page
- Form validation for required fields
2. **Database Schema Updates**
- Ensure lease table supports `new` and `signed` states
- Add tenant invitation workflow
- Handle optional tenant assignment
3. **API Endpoints**
- POST `/api/leases` - Create new lease
- PUT `/api/leases/:id/invite` - Send tenant invitation
- PUT `/api/leases/:id/accept` - Tenant accepts invitation
### Payment Service Fixes ### Payment Service Fixes
- [ ] **Implement `getTransactionByStripeId(stripeId: string)`** in `services/paymentService.ts`
- Query database by stripe transaction ID
- Return transaction object or null
- [ ] **Fix TypeScript import errors** in receipt API routes
- Check all `routes/api/receipts/` files
- Fix relative import paths
- [ ] **Add proper TypeScript types** for Fresh route handlers
- Define request/response types for API endpoints
- Update handler function signatures
- Implement `getTransactionByStripeId(stripeId: string)` function ### Code Quality & Testing
- Fix import paths in API routes - [ ] **Fix TypeScript compilation errors**
- Add proper TypeScript types for Fresh handlers - Run `deno check` to identify issues
- Fix all type mismatches
- [ ] **Validate all changed files**
- Run `deno fmt` for formatting
- Run `deno lint` for code quality
- Run `deno check` for type checking
- [ ] **Test lease creation workflow end-to-end**
- Manual testing in development environment
- Verify database state changes
- Test tenant invitation flow
## Development Tasks ## Low Priority 🟢
- [ ] Create lease creation UI components ### Testing Infrastructure
- [ ] Implement lease creation API endpoint - [ ] **Unit tests for lease creation** (`tests/unit/lease.test.ts`)
- [ ] Add tenant invitation system - [ ] **Integration tests for tenant invitation flow** (`tests/integration/invitation.test.ts`)
- [ ] Fix TypeScript compilation errors - [ ] **E2E tests for complete lease lifecycle** (`tests/e2e/lease-lifecycle.spec.ts`)
- [ ] Validate all changed files with `deno check`, `deno fmt`, and `deno lint` - [ ] **Payment service integration tests** (`tests/integration/payment.test.ts`)
- [ ] Test lease creation workflow end-to-end
- [ ] Update landlord dashboard with new lease button
## Testing ## Database Schema Verification Needed
- [ ] **Verify lease table supports required states**
- Check `state` column accepts `new` and `signed`
- Verify `tenant_id` column is nullable
- Confirm all required fields exist
- [ ] Unit tests for lease creation ## Current Blockers
- [ ] Integration tests for tenant invitation flow - ❌ **TypeScript compilation errors** preventing development
- [ ] E2E tests for complete lease lifecycle - ❌ **Missing payment service functions** breaking receipt functionality
- [ ] Payment service integration tests
## Next Steps
1. Fix immediate TypeScript and payment service issues
2. Implement lease creation API endpoints
3. Create frontend components for lease management
4. Test complete workflow end-to-end

View File

@ -1,6 +1,9 @@
import { App, Context, staticFiles } from "fresh"; import { App, Context, staticFiles } from "fresh";
import { type State } from "./utils.ts"; import { type State } from "./utils.ts";
import "$std/dotenv/load.ts"; import { loadSync } from "$std/dotenv/mod.ts";
// Allow empty values for optional Stripe variables
loadSync({ allowEmptyValues: true, export: true });
import { checkDatabaseConnection } from "./db/db.ts"; import { checkDatabaseConnection } from "./db/db.ts";
const isDevelopment = Deno.env.get("DEVELOPMENT") === "true"; const isDevelopment = Deno.env.get("DEVELOPMENT") === "true";