This commit is contained in:
Nathan Anderson 2026-01-21 20:35:16 -06:00
parent 3c27be316b
commit 5838d27249
3 changed files with 66 additions and 46 deletions

95
TODO.md
View File

@ -1,53 +1,62 @@
# Project TODO List # CyberHybridHub TODO
This document outlines the remaining tasks, incomplete features, and future
development plans for the application.
## High Priority ## 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` ## Technical Implementation Details
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.
## 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 2. **Database Schema Updates**
`routes/landlord/` directory. This includes: - Ensure lease table supports `new` and `signed` states
- Property management - Add tenant invitation workflow
- Tenant invitation and management (`islands/LandlordInviteTenant.tsx`) - Handle optional tenant assignment
- Messaging with tenants (`islands/LandlordMessageThreads.tsx`)
- Financial tracking and reporting
- **Complete Tenant Dashboard**: Finalize all features under the 3. **API Endpoints**
`routes/tenant/` directory. This includes: - POST `/api/leases` - Create new lease
- Viewing lease documents - PUT `/api/leases/:id/invite` - Send tenant invitation
- Tracking rent payments and financial obligations - PUT `/api/leases/:id/accept` - Tenant accepts invitation
- 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/`.
## 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/` ## Development Tasks
directory need further development and integration into the user experience. - [ ] Create lease creation UI components
This includes: - [ ] Implement lease creation API endpoint
- `BrainStudy.tsx` - [ ] Add tenant invitation system
- `Quizzing.tsx` - [ ] Fix TypeScript compilation errors
- `ImageGenerater.tsx` - [ ] Validate all changed files with `deno check`, `deno fmt`, and `deno lint`
- `VoiceRecorder.tsx` - [ ] Test lease creation workflow end-to-end
- **Calendar Functionality**: Expand the calendar features in `routes/calendar/` - [ ] Update landlord dashboard with new lease button
and improve the `islands/FinancialCalendar.tsx` component to be more
interactive and informative. ## Testing
- **Document Management**: Build out a robust document upload, storage, and - [ ] Unit tests for lease creation
sharing system for leases, notices, and other rental-related documents. - [ ] Integration tests for tenant invitation flow
- **Reminders and Notifications**: Implement a system for sending automated - [ ] E2E tests for complete lease lifecycle
reminders for rent payments, lease renewals, and other important events. - [ ] Payment service integration tests

View File

@ -1,8 +1,8 @@
import { define } from "../../../../utils.ts"; import { define } from "../../../utils.ts";
import { getTransactionByStripeId } from "../../../../services/paymentService.ts"; import { getTransactionByStripeId } from "../../../services/paymentService.ts";
export const handler = define.handlers({ export const handler = define.handlers({
async GET(ctx) { async GET(ctx: any) {
const stripeId = ctx.params.id; const stripeId = ctx.params.id;
if (!stripeId) { if (!stripeId) {
return new Response("Not Found", { status: 404 }); return new Response("Not Found", { status: 404 });

View File

@ -387,3 +387,14 @@ export async function cancelAutoPayment(
.where(eq(leases.id, lease_id)) .where(eq(leases.id, lease_id))
.returning(); .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;
}