diff --git a/TODO.md b/TODO.md index c215d72..fca18c8 100644 --- a/TODO.md +++ b/TODO.md @@ -1,68 +1,79 @@ # 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 -- **Lease creation form** with basic price information: - - Rent amount - - Security deposit amount - - Property selection - - Lease term dates -- **Lease states implementation**: - - `new` - Initial state when created by landlord - - `signed` - After tenant accepts invitation -- **Tenant field handling**: - - Make tenant field optional during creation - - Allow landlord to invite tenant after lease creation - - Update tenant field when invitation is accepted +#### Frontend Components +- [ ] **Create lease creation form component** (`components/LeaseForm.tsx`) + - Rent amount input field + - Security deposit amount input field + - Property selection dropdown + - Lease term start/end date pickers + - Form validation and error handling +- [ ] **Add "Create New Lease" button next to "Add Property" button** on landlord dashboard (`/dashboard/landlord` route) +- [ ] **Create lease creation modal/page** (`routes/landlord/create-lease.tsx`) +- [ ] **Tenant invitation interface** - Email input and invitation sending UI -### 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 -- **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 +## Medium Priority 🟡 ### 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 -- Fix import paths in API routes -- Add proper TypeScript types for Fresh handlers +### Code Quality & Testing +- [ ] **Fix TypeScript compilation errors** + - 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 -- [ ] Implement lease creation API endpoint -- [ ] Add tenant invitation system -- [ ] Fix TypeScript compilation errors -- [ ] Validate all changed files with `deno check`, `deno fmt`, and `deno lint` -- [ ] Test lease creation workflow end-to-end -- [ ] Update landlord dashboard with new lease button +### Testing Infrastructure +- [ ] **Unit tests for lease creation** (`tests/unit/lease.test.ts`) +- [ ] **Integration tests for tenant invitation flow** (`tests/integration/invitation.test.ts`) +- [ ] **E2E tests for complete lease lifecycle** (`tests/e2e/lease-lifecycle.spec.ts`) +- [ ] **Payment service integration tests** (`tests/integration/payment.test.ts`) -## 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 -- [ ] Integration tests for tenant invitation flow -- [ ] E2E tests for complete lease lifecycle -- [ ] Payment service integration tests +## Current Blockers +- ❌ **TypeScript compilation errors** preventing development +- ❌ **Missing payment service functions** breaking receipt functionality + +## 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 diff --git a/main.ts b/main.ts index 1b9ea66..b0c2b64 100755 --- a/main.ts +++ b/main.ts @@ -1,6 +1,9 @@ import { App, Context, staticFiles } from "fresh"; 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"; const isDevelopment = Deno.env.get("DEVELOPMENT") === "true";