From 5838d272494ff52fd54508e7a71eff60bde6170a Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Wed, 21 Jan 2026 20:35:16 -0600 Subject: [PATCH] TODO --- TODO.md | 95 +++++++++++++++++++++----------------- routes/api/receipt/[id].ts | 6 +-- services/paymentService.ts | 11 +++++ 3 files changed, 66 insertions(+), 46 deletions(-) diff --git a/TODO.md b/TODO.md index 9bf886b..ebdfa07 100644 --- a/TODO.md +++ b/TODO.md @@ -1,53 +1,62 @@ -# Project TODO List - -This document outlines the remaining tasks, incomplete features, and future -development plans for the application. +# CyberHybridHub TODO ## High Priority +### Implement Lease Creation for Landlord Dashboard +- **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 -## Backend & API +### Bug Fixes +- **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` -- **Add Well-Known Endpoint**: Implement a `/.well-known/acme-challenge/:token` - endpoint in `main.ts` to support services like Let's Encrypt for SSL - certificate validation in production. -- **Enforce Database Constraints**: Ensure the `owner_id` field in the - `AccessTokenResponse` interface is unique for each entry, as noted in - `utils/database.ts`. This is crucial for maintaining data integrity. +## Technical Implementation Details -## Feature Development +### Lease Creation Flow +1. **Landlord Dashboard Enhancement** + - Add "Create New Lease" button component + - Create lease creation modal/page + - Form validation for required fields -- **Complete Landlord Dashboard**: Flesh out all features under the - `routes/landlord/` directory. This includes: - - Property management - - Tenant invitation and management (`islands/LandlordInviteTenant.tsx`) - - Messaging with tenants (`islands/LandlordMessageThreads.tsx`) - - Financial tracking and reporting +2. **Database Schema Updates** + - Ensure lease table supports `new` and `signed` states + - Add tenant invitation workflow + - Handle optional tenant assignment -- **Complete Tenant Dashboard**: Finalize all features under the - `routes/tenant/` directory. This includes: - - Viewing lease documents - - Tracking rent payments and financial obligations - - Messaging with landlords (`islands/TenantMessageThreads.tsx`) - - Managing settings (`islands/TenantSettings.tsx`) -- **Enhance User Onboarding**: Improve the onboarding flow for both new - landlords and tenants in `routes/onboarding/`. -- **Develop User Profile Management**: Complete the user profile editing and - management features in `routes/user-profile/`. +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 -## Future Features & Refinements +### Payment Service Fixes +- Implement `getTransactionByStripeId(stripeId: string)` function +- Fix import paths in API routes +- Add proper TypeScript types for Fresh handlers -- **AI/ML Feature Integration**: The advanced features found in the `islands/` - directory need further development and integration into the user experience. - This includes: - - `BrainStudy.tsx` - - `Quizzing.tsx` - - `ImageGenerater.tsx` - - `VoiceRecorder.tsx` -- **Calendar Functionality**: Expand the calendar features in `routes/calendar/` - and improve the `islands/FinancialCalendar.tsx` component to be more - interactive and informative. -- **Document Management**: Build out a robust document upload, storage, and - sharing system for leases, notices, and other rental-related documents. -- **Reminders and Notifications**: Implement a system for sending automated - reminders for rent payments, lease renewals, and other important events. +## Development Tasks +- [ ] 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 +- [ ] Unit tests for lease creation +- [ ] Integration tests for tenant invitation flow +- [ ] E2E tests for complete lease lifecycle +- [ ] Payment service integration tests \ No newline at end of file diff --git a/routes/api/receipt/[id].ts b/routes/api/receipt/[id].ts index 9316308..bbd009c 100644 --- a/routes/api/receipt/[id].ts +++ b/routes/api/receipt/[id].ts @@ -1,8 +1,8 @@ -import { define } from "../../../../utils.ts"; -import { getTransactionByStripeId } from "../../../../services/paymentService.ts"; +import { define } from "../../../utils.ts"; +import { getTransactionByStripeId } from "../../../services/paymentService.ts"; export const handler = define.handlers({ - async GET(ctx) { + async GET(ctx: any) { const stripeId = ctx.params.id; if (!stripeId) { return new Response("Not Found", { status: 404 }); diff --git a/services/paymentService.ts b/services/paymentService.ts index bd5df7e..42667d4 100644 --- a/services/paymentService.ts +++ b/services/paymentService.ts @@ -387,3 +387,14 @@ export async function cancelAutoPayment( .where(eq(leases.id, lease_id)) .returning(); } + +export async function getTransactionByStripeId(stripeId: string) { + if (isE2EEnabled()) { + const transactions = getE2EPaymentTransactionsByOwner(""); // Get all transactions and filter + return transactions.find(tx => tx.stripe_payment_id === stripeId) || null; + } + const result = await db.select() + .from(payment_transactions) + .where(eq(payment_transactions.stripe_payment_id, stripeId)); + return result[0] || null; +}