From f7f6d6a23ac4a44e5c15cbf10aa5c189af64bf1c Mon Sep 17 00:00:00 2001 From: Nathan Anderson Date: Wed, 28 Jan 2026 14:49:35 -0600 Subject: [PATCH] next dev --- TODO.md | 99 + drizzle/0001_spicy_sunset_bain.sql | 64 + .../0007_add_lease_id_to_tenant_invites.sql | 8 + drizzle/meta/0001_snapshot.json | 2578 +++++++++++++++++ drizzle/meta/_journal.json | 9 +- 5 files changed, 2757 insertions(+), 1 deletion(-) create mode 100644 drizzle/0001_spicy_sunset_bain.sql create mode 100644 drizzle/0007_add_lease_id_to_tenant_invites.sql create mode 100644 drizzle/meta/0001_snapshot.json diff --git a/TODO.md b/TODO.md index e69de29..59b7322 100644 --- a/TODO.md +++ b/TODO.md @@ -0,0 +1,99 @@ +# Lease Approval Implementation Plan + +## Overview +Implement landlord approval mechanism for tenant invitation workflow. Currently, tenants can click "Start Lease" without landlord oversight. This plan adds proper approval workflow. + +## Implementation Tasks + +### 1. Database Schema Changes (HIGH PRIORITY) +- [ ] Add approval workflow fields to `leases` table: + - `approval_status` TEXT DEFAULT 'pending_approval' + - `approval_requested_at` BIGINT + - `approved_at` BIGINT + - `approved_by` TEXT REFERENCES users(id) + - `rejection_reason` TEXT +- [ ] Create migration SQL file +- [ ] Update database interfaces + +### 2. API Endpoints (HIGH PRIORITY) +- [ ] Create `POST /api/lease/request-approval` - Tenant initiates lease +- [ ] Create `POST /api/lease/approve` - Landlord approval +- [ ] Create `POST /api/lease/reject` - Landlord rejection +- [ ] Create `GET /api/lease/pending-approvals` - Landlord dashboard +- [ ] Extend `leaseService.ts` with approval functions: + - `requestLeaseApproval()` + - `approveLease()` + - `rejectLease()` + - `getPendingApprovals()` + +### 3. Lease Finalization Mechanism (HIGH PRIORITY) +- [ ] Implement lease activation on approval +- [ ] Ensure proper record linking (tenant_id, lease_id) +- [ ] Update tenant invite to reference approved lease +- [ ] Set up access rights and permissions +- [ ] Create payment schedules and reminders +- [ ] Validate data integrity + +### 4. Tenant Invitation Page Updates (MEDIUM PRIORITY) +- [ ] Update `/tenant/invite/[invite_id].tsx` to check lease status +- [ ] Add status-based UI states: + - No lease: "Start Lease" button + - Pending: "Pending Landlord Approval" + - Approved: "Lease Approved - Continue" + - Rejected: "Lease Rejected" with contact info +- [ ] Add progress indicator showing approval steps +- [ ] Update POST handler to call approval API + +### 5. Landlord Notifications (MEDIUM PRIORITY) +- [ ] Create `notificationService.ts` for centralized notifications +- [ ] Implement email templates: + - "New Lease Approval Required" + - "Lease Approved" confirmation + - "Lease Rejected" confirmation +- [ ] Add dashboard notifications +- [ ] Integrate with user preference system + +### 6. Landlord Dashboard View (MEDIUM PRIORITY) +- [ ] Add "Pending Lease Approvals" section to dashboard +- [ ] Create approval cards with property/tenant details +- [ ] Add approval/rejection interface +- [ ] Update navigation with approval badge +- [ ] Create dedicated `/landlord/approvals` page + +### 7. Testing (LOW PRIORITY) +- [ ] Unit tests for lease service functions +- [ ] Integration tests for API endpoints +- [ ] E2E tests for complete approval workflow +- [ ] UI tests for dashboard and invite page + +## Verification Steps +After each major component, run: +```bash +deno check +deno fmt +deno lint +``` + +Note: `deno check` only works on TypeScript files (.ts), not Markdown files (.md). + +## Workflow Summary +1. Tenant clicks "Start Lease" → Creates lease with `approval_status: 'pending_approval'` +2. Landlord receives notification → Dashboard shows pending approval +3. Landlord reviews and approves/rejects → Updates lease status +4. System finalizes lease → Links records, sets up payments, grants access + +## Files to Modify +- `db/schema.ts` - Add approval fields +- `services/leaseService.ts` - Add approval functions +- `routes/tenant/invite/[invite_id].tsx` - Update UI and logic +- `routes/landlord/dashboard/index.tsx` - Add pending approvals +- `routes/api/lease/` - Create approval endpoints +- `services/notificationService.ts` - New notification service + +## Success Criteria +- [ ] All lease activations require landlord approval +- [ ] Tenants see clear approval status +- [ ] Landlords can easily review and approve/reject +- [ ] Notifications are sent reliably +- [ ] Lease finalization works correctly +- [ ] All tests pass \ No newline at end of file diff --git a/drizzle/0001_spicy_sunset_bain.sql b/drizzle/0001_spicy_sunset_bain.sql new file mode 100644 index 0000000..0108752 --- /dev/null +++ b/drizzle/0001_spicy_sunset_bain.sql @@ -0,0 +1,64 @@ +CREATE TABLE "reminders" ( + "id" text PRIMARY KEY NOT NULL, + "user_id" text NOT NULL, + "lease_id" text, + "reminder_type" text NOT NULL, + "title" text NOT NULL, + "description" text, + "due_date" bigint NOT NULL, + "is_completed" boolean DEFAULT false, + "created_on" bigint, + "updated_on" bigint +); +--> statement-breakpoint +CREATE TABLE "tenant_invites" ( + "id" text PRIMARY KEY NOT NULL, + "landlord_id" text, + "property_id" text, + "lease_id" text, + "available_on" bigint, + "invited_emails" text, + "created_on" bigint, + "updated_on" bigint +); +--> statement-breakpoint +CREATE TABLE "web_tokens" ( + "token_id" varchar(64) PRIMARY KEY NOT NULL, + "state_id" varchar(36) NOT NULL, + "user_id" text NOT NULL, + "token_type" text NOT NULL, + "token_value" text NOT NULL, + "expires_on" bigint NOT NULL, + "created_on" bigint NOT NULL, + "updated_on" bigint NOT NULL, + "last_used_on" bigint, + "is_active" boolean DEFAULT true, + "metadata" json +); +--> statement-breakpoint +ALTER TABLE "brain_question_progress" ADD COLUMN "current_mode" text DEFAULT 'photo-see-bisaya' NOT NULL;--> statement-breakpoint +ALTER TABLE "brain_question_progress" ADD COLUMN "mode_index" integer DEFAULT 0;--> statement-breakpoint +ALTER TABLE "brain_question_progress" ADD COLUMN "consecutive_first_try" integer DEFAULT 0;--> statement-breakpoint +ALTER TABLE "brain_question_progress" ADD COLUMN "is_review_only" boolean DEFAULT false;--> statement-breakpoint +ALTER TABLE "leases" ADD COLUMN "default_payment_method_id" text;--> statement-breakpoint +ALTER TABLE "messages" ADD COLUMN "parent_message_id" text;--> statement-breakpoint +ALTER TABLE "messages" ADD COLUMN "attachments_json" json;--> statement-breakpoint +ALTER TABLE "properties" ADD COLUMN "default_payment_method_id" text;--> statement-breakpoint +ALTER TABLE "quiz_configs" ADD COLUMN "tab_name" text;--> statement-breakpoint +ALTER TABLE "quiz_configs" ADD COLUMN "tab_index" integer DEFAULT 0;--> statement-breakpoint +ALTER TABLE "quiz_configs" ADD COLUMN "list_index" integer DEFAULT 0;--> statement-breakpoint +ALTER TABLE "quiz_questions" ADD COLUMN "question_index" integer DEFAULT 0;--> statement-breakpoint +ALTER TABLE "tenant_applications" ADD COLUMN "document_urls_json" json;--> statement-breakpoint +ALTER TABLE "users" ADD COLUMN "onboarded_landlord" boolean DEFAULT false;--> statement-breakpoint +ALTER TABLE "users" ADD COLUMN "onboarded_tenant" boolean DEFAULT false;--> statement-breakpoint +ALTER TABLE "users" ADD COLUMN "notification_preferences_json" json;--> statement-breakpoint +ALTER TABLE "users" ADD COLUMN "payment_preferences_json" json;--> statement-breakpoint +ALTER TABLE "reminders" ADD CONSTRAINT "reminders_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "reminders" ADD CONSTRAINT "reminders_lease_id_leases_id_fk" FOREIGN KEY ("lease_id") REFERENCES "public"."leases"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tenant_invites" ADD CONSTRAINT "tenant_invites_landlord_id_users_id_fk" FOREIGN KEY ("landlord_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tenant_invites" ADD CONSTRAINT "tenant_invites_property_id_properties_id_fk" FOREIGN KEY ("property_id") REFERENCES "public"."properties"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tenant_invites" ADD CONSTRAINT "tenant_invites_lease_id_leases_id_fk" FOREIGN KEY ("lease_id") REFERENCES "public"."leases"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "web_tokens" ADD CONSTRAINT "web_tokens_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "leases" ADD CONSTRAINT "leases_default_payment_method_id_payment_methods_id_fk" FOREIGN KEY ("default_payment_method_id") REFERENCES "public"."payment_methods"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "properties" ADD CONSTRAINT "properties_default_payment_method_id_payment_methods_id_fk" FOREIGN KEY ("default_payment_method_id") REFERENCES "public"."payment_methods"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "brain_question_progress" DROP COLUMN "mode"; \ No newline at end of file diff --git a/drizzle/0007_add_lease_id_to_tenant_invites.sql b/drizzle/0007_add_lease_id_to_tenant_invites.sql new file mode 100644 index 0000000..29a897e --- /dev/null +++ b/drizzle/0007_add_lease_id_to_tenant_invites.sql @@ -0,0 +1,8 @@ +-- Migration: Add lease_id column to tenant_invites table + +ALTER TABLE "tenant_invites" ADD COLUMN "lease_id" text REFERENCES "leases"("id"); + +--> statement-breakpoint + +CREATE INDEX IF NOT EXISTS "tenant_invites_lease_id_idx" + ON "tenant_invites" ("lease_id"); diff --git a/drizzle/meta/0001_snapshot.json b/drizzle/meta/0001_snapshot.json new file mode 100644 index 0000000..96c3ad9 --- /dev/null +++ b/drizzle/meta/0001_snapshot.json @@ -0,0 +1,2578 @@ +{ + "id": "f219e23c-e21d-456e-9394-f980d7544cdf", + "prevId": "3155f1c0-be0a-4d01-8992-c2a1e9f123a9", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.brain_question_progress": { + "name": "brain_question_progress", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "quiz_id": { + "name": "quiz_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "question_id": { + "name": "question_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "current_mode": { + "name": "current_mode", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'photo-see-bisaya'" + }, + "mode_index": { + "name": "mode_index", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "attempts": { + "name": "attempts", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "first_try_successes": { + "name": "first_try_successes", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "consecutive_first_try": { + "name": "consecutive_first_try", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "last_result": { + "name": "last_result", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "next_due_at": { + "name": "next_due_at", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "interval_days": { + "name": "interval_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "ease_factor": { + "name": "ease_factor", + "type": "double precision", + "primaryKey": false, + "notNull": false, + "default": 2.5 + }, + "is_review_only": { + "name": "is_review_only", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "brain_question_progress_user_id_users_id_fk": { + "name": "brain_question_progress_user_id_users_id_fk", + "tableFrom": "brain_question_progress", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "brain_question_progress_quiz_id_quiz_configs_quiz_config_id_fk": { + "name": "brain_question_progress_quiz_id_quiz_configs_quiz_config_id_fk", + "tableFrom": "brain_question_progress", + "tableTo": "quiz_configs", + "columnsFrom": [ + "quiz_id" + ], + "columnsTo": [ + "quiz_config_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.financial_balances": { + "name": "financial_balances", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "balance": { + "name": "balance", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "balance_date": { + "name": "balance_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "financial_balances_user_id_users_id_fk": { + "name": "financial_balances_user_id_users_id_fk", + "tableFrom": "financial_balances", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.incomes": { + "name": "incomes", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "source": { + "name": "source", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "frequency": { + "name": "frequency", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "received_date": { + "name": "received_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "incomes_user_id_users_id_fk": { + "name": "incomes_user_id_users_id_fk", + "tableFrom": "incomes", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.lease_documents": { + "name": "lease_documents", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "lease_id": { + "name": "lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "document_type": { + "name": "document_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_url": { + "name": "file_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "signed_by_landlord": { + "name": "signed_by_landlord", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "signed_by_tenant": { + "name": "signed_by_tenant", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "signature_date": { + "name": "signature_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "lease_documents_lease_id_leases_id_fk": { + "name": "lease_documents_lease_id_leases_id_fk", + "tableFrom": "lease_documents", + "tableTo": "leases", + "columnsFrom": [ + "lease_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.leases": { + "name": "leases", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "property_address": { + "name": "property_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_date": { + "name": "start_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "end_date": { + "name": "end_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "rent": { + "name": "rent", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "security_deposit": { + "name": "security_deposit", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "default_payment_method_id": { + "name": "default_payment_method_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lease_status": { + "name": "lease_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lease_document_url": { + "name": "lease_document_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "payment_schedule_id": { + "name": "payment_schedule_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "late_fee_rules": { + "name": "late_fee_rules", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "auto_renewal": { + "name": "auto_renewal", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "leases_property_id_properties_id_fk": { + "name": "leases_property_id_properties_id_fk", + "tableFrom": "leases", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "leases_tenant_id_users_id_fk": { + "name": "leases_tenant_id_users_id_fk", + "tableFrom": "leases", + "tableTo": "users", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "leases_owner_id_users_id_fk": { + "name": "leases_owner_id_users_id_fk", + "tableFrom": "leases", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "leases_default_payment_method_id_payment_methods_id_fk": { + "name": "leases_default_payment_method_id_payment_methods_id_fk", + "tableFrom": "leases", + "tableTo": "payment_methods", + "columnsFrom": [ + "default_payment_method_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "leases_payment_schedule_id_rent_schedules_id_fk": { + "name": "leases_payment_schedule_id_rent_schedules_id_fk", + "tableFrom": "leases", + "tableTo": "rent_schedules", + "columnsFrom": [ + "payment_schedule_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.maintenance_requests": { + "name": "maintenance_requests", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tenant_id": { + "name": "tenant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "request_type": { + "name": "request_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "priority": { + "name": "priority", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "resolved_on": { + "name": "resolved_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "maintenance_requests_property_id_properties_id_fk": { + "name": "maintenance_requests_property_id_properties_id_fk", + "tableFrom": "maintenance_requests", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "maintenance_requests_tenant_id_users_id_fk": { + "name": "maintenance_requests_tenant_id_users_id_fk", + "tableFrom": "maintenance_requests", + "tableTo": "users", + "columnsFrom": [ + "tenant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.messages": { + "name": "messages", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "lease_id": { + "name": "lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "sender_id": { + "name": "sender_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "recipient_id": { + "name": "recipient_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message_type": { + "name": "message_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "subject": { + "name": "subject", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "parent_message_id": { + "name": "parent_message_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "attachments_json": { + "name": "attachments_json", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "content": { + "name": "content", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "content_encrypted": { + "name": "content_encrypted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_read": { + "name": "is_read", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "messages_lease_id_leases_id_fk": { + "name": "messages_lease_id_leases_id_fk", + "tableFrom": "messages", + "tableTo": "leases", + "columnsFrom": [ + "lease_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "messages_sender_id_users_id_fk": { + "name": "messages_sender_id_users_id_fk", + "tableFrom": "messages", + "tableTo": "users", + "columnsFrom": [ + "sender_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "messages_recipient_id_users_id_fk": { + "name": "messages_recipient_id_users_id_fk", + "tableFrom": "messages", + "tableTo": "users", + "columnsFrom": [ + "recipient_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.obligations": { + "name": "obligations", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "frequency": { + "name": "frequency", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "obligations_user_id_users_id_fk": { + "name": "obligations_user_id_users_id_fk", + "tableFrom": "obligations", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_methods": { + "name": "payment_methods", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "method_type": { + "name": "method_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bank_name": { + "name": "bank_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "account_type": { + "name": "account_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "routing_number_encrypted": { + "name": "routing_number_encrypted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "account_number_encrypted": { + "name": "account_number_encrypted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "is_default": { + "name": "is_default", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "payment_methods_user_id_users_id_fk": { + "name": "payment_methods_user_id_users_id_fk", + "tableFrom": "payment_methods", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.payment_transactions": { + "name": "payment_transactions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "lease_id": { + "name": "lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "amount": { + "name": "amount", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "payment_date": { + "name": "payment_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "payment_method": { + "name": "payment_method", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "transaction_status": { + "name": "transaction_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "stripe_payment_id": { + "name": "stripe_payment_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "payment_transactions_lease_id_leases_id_fk": { + "name": "payment_transactions_lease_id_leases_id_fk", + "tableFrom": "payment_transactions", + "tableTo": "leases", + "columnsFrom": [ + "lease_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.properties": { + "name": "properties", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_1": { + "name": "address_1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_2": { + "name": "address_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "zip": { + "name": "zip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "bedrooms": { + "name": "bedrooms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "bathrooms": { + "name": "bathrooms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "square_footage": { + "name": "square_footage", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "lot_size": { + "name": "lot_size", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "year_built": { + "name": "year_built", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "price": { + "name": "price", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "property_type": { + "name": "property_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "listing_status": { + "name": "listing_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rental_status": { + "name": "rental_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "monthly_rent": { + "name": "monthly_rent", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "security_deposit": { + "name": "security_deposit", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "default_payment_method_id": { + "name": "default_payment_method_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lease_duration_months": { + "name": "lease_duration_months", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "amenities": { + "name": "amenities", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "property_photos_count": { + "name": "property_photos_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "image_url": { + "name": "image_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "properties_default_payment_method_id_payment_methods_id_fk": { + "name": "properties_default_payment_method_id_payment_methods_id_fk", + "tableFrom": "properties", + "tableTo": "payment_methods", + "columnsFrom": [ + "default_payment_method_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "properties_owner_id_users_id_fk": { + "name": "properties_owner_id_users_id_fk", + "tableFrom": "properties", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.property_media": { + "name": "property_media", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "media_type": { + "name": "media_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_url": { + "name": "file_url", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "file_name": { + "name": "file_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_order": { + "name": "display_order", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "property_media_property_id_properties_id_fk": { + "name": "property_media_property_id_properties_id_fk", + "tableFrom": "property_media", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.quiz_configs": { + "name": "quiz_configs", + "schema": "", + "columns": { + "quiz_config_id": { + "name": "quiz_config_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "quiz_name": { + "name": "quiz_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "quiz_mode": { + "name": "quiz_mode", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active_date": { + "name": "active_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "tab_name": { + "name": "tab_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "tab_index": { + "name": "tab_index", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "list_index": { + "name": "list_index", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "questions": { + "name": "questions", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "results": { + "name": "results", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "quiz_configs_owner_id_users_id_fk": { + "name": "quiz_configs_owner_id_users_id_fk", + "tableFrom": "quiz_configs", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.quiz_questions": { + "name": "quiz_questions", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "quiz_id": { + "name": "quiz_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "owner_id": { + "name": "owner_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "question_index": { + "name": "question_index", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "language_1": { + "name": "language_1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "language_2": { + "name": "language_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "text_1": { + "name": "text_1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "audio_file_1": { + "name": "audio_file_1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "text_2": { + "name": "text_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "audio_file_2": { + "name": "audio_file_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "order_num": { + "name": "order_num", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "background_file": { + "name": "background_file", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "background_image_data": { + "name": "background_image_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "video_file": { + "name": "video_file", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "video_file_data": { + "name": "video_file_data", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "quiz_questions_quiz_id_quiz_configs_quiz_config_id_fk": { + "name": "quiz_questions_quiz_id_quiz_configs_quiz_config_id_fk", + "tableFrom": "quiz_questions", + "tableTo": "quiz_configs", + "columnsFrom": [ + "quiz_id" + ], + "columnsTo": [ + "quiz_config_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "quiz_questions_owner_id_users_id_fk": { + "name": "quiz_questions_owner_id_users_id_fk", + "tableFrom": "quiz_questions", + "tableTo": "users", + "columnsFrom": [ + "owner_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.quiz_results": { + "name": "quiz_results", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "quiz_config_id": { + "name": "quiz_config_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "success": { + "name": "success", + "type": "boolean", + "primaryKey": false, + "notNull": false + }, + "total_time": { + "name": "total_time", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "help_count": { + "name": "help_count", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "completed_on": { + "name": "completed_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "quiz_results_quiz_config_id_quiz_configs_quiz_config_id_fk": { + "name": "quiz_results_quiz_config_id_quiz_configs_quiz_config_id_fk", + "tableFrom": "quiz_results", + "tableTo": "quiz_configs", + "columnsFrom": [ + "quiz_config_id" + ], + "columnsTo": [ + "quiz_config_id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "quiz_results_user_id_users_id_fk": { + "name": "quiz_results_user_id_users_id_fk", + "tableFrom": "quiz_results", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.reminders": { + "name": "reminders", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "lease_id": { + "name": "lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "reminder_type": { + "name": "reminder_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "title": { + "name": "title", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "due_date": { + "name": "due_date", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "is_completed": { + "name": "is_completed", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "reminders_user_id_users_id_fk": { + "name": "reminders_user_id_users_id_fk", + "tableFrom": "reminders", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "reminders_lease_id_leases_id_fk": { + "name": "reminders_lease_id_leases_id_fk", + "tableFrom": "reminders", + "tableTo": "leases", + "columnsFrom": [ + "lease_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.rent_schedules": { + "name": "rent_schedules", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "rent_amount": { + "name": "rent_amount", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "due_day": { + "name": "due_day", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "late_fee_amount": { + "name": "late_fee_amount", + "type": "double precision", + "primaryKey": false, + "notNull": false + }, + "grace_period_days": { + "name": "grace_period_days", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "payment_methods_allowed": { + "name": "payment_methods_allowed", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "rent_schedules_property_id_properties_id_fk": { + "name": "rent_schedules_property_id_properties_id_fk", + "tableFrom": "rent_schedules", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.roles": { + "name": "roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session_configs": { + "name": "session_configs", + "schema": "", + "columns": { + "device_id": { + "name": "device_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "other_data": { + "name": "other_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active_date": { + "name": "active_date", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "quiz_configs": { + "name": "quiz_configs", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "active_route": { + "name": "active_route", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "page_data": { + "name": "page_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active_quiz_index": { + "name": "active_quiz_index", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "active_question_index": { + "name": "active_question_index", + "type": "integer", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "session_configs_user_id_users_id_fk": { + "name": "session_configs_user_id_users_id_fk", + "tableFrom": "session_configs", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.state_keys": { + "name": "state_keys", + "schema": "", + "columns": { + "seal_key": { + "name": "seal_key", + "type": "varchar(32)", + "primaryKey": true, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": true + }, + "cookie_hash": { + "name": "cookie_hash", + "type": "varchar(64)", + "primaryKey": false, + "notNull": true + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenant_applications": { + "name": "tenant_applications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "applicant_id": { + "name": "applicant_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "application_status": { + "name": "application_status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "application_data_encrypted": { + "name": "application_data_encrypted", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "document_urls_json": { + "name": "document_urls_json", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "submitted_on": { + "name": "submitted_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "reviewed_on": { + "name": "reviewed_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tenant_applications_property_id_properties_id_fk": { + "name": "tenant_applications_property_id_properties_id_fk", + "tableFrom": "tenant_applications", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tenant_applications_applicant_id_users_id_fk": { + "name": "tenant_applications_applicant_id_users_id_fk", + "tableFrom": "tenant_applications", + "tableTo": "users", + "columnsFrom": [ + "applicant_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.tenant_invites": { + "name": "tenant_invites", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "landlord_id": { + "name": "landlord_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "property_id": { + "name": "property_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lease_id": { + "name": "lease_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "available_on": { + "name": "available_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "invited_emails": { + "name": "invited_emails", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "tenant_invites_landlord_id_users_id_fk": { + "name": "tenant_invites_landlord_id_users_id_fk", + "tableFrom": "tenant_invites", + "tableTo": "users", + "columnsFrom": [ + "landlord_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tenant_invites_property_id_properties_id_fk": { + "name": "tenant_invites_property_id_properties_id_fk", + "tableFrom": "tenant_invites", + "tableTo": "properties", + "columnsFrom": [ + "property_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "tenant_invites_lease_id_leases_id_fk": { + "name": "tenant_invites_lease_id_leases_id_fk", + "tableFrom": "tenant_invites", + "tableTo": "leases", + "columnsFrom": [ + "lease_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_roles": { + "name": "user_roles", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "role_id": { + "name": "role_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_roles_user_id_users_id_fk": { + "name": "user_roles_user_id_users_id_fk", + "tableFrom": "user_roles", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + }, + "user_roles_role_id_roles_id_fk": { + "name": "user_roles_role_id_roles_id_fk", + "tableFrom": "user_roles", + "tableTo": "roles", + "columnsFrom": [ + "role_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_tokens": { + "name": "user_tokens", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "user_tokens_user_id_users_id_fk": { + "name": "user_tokens_user_id_users_id_fk", + "tableFrom": "user_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user_pins": { + "name": "user_pins", + "schema": "", + "columns": { + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "pin": { + "name": "pin", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "modified_on": { + "name": "modified_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + } + }, + "indexes": {}, + "foreignKeys": { + "user_pins_user_id_users_id_fk": { + "name": "user_pins_user_id_users_id_fk", + "tableFrom": "user_pins", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.users": { + "name": "users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "phone": { + "name": "phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_1": { + "name": "address_1", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "address_2": { + "name": "address_2", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "city": { + "name": "city", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "state": { + "name": "state", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "zip": { + "name": "zip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "country": { + "name": "country", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_type": { + "name": "user_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "onboarded_landlord": { + "name": "onboarded_landlord", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "onboarded_tenant": { + "name": "onboarded_tenant", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "banking_setup_complete": { + "name": "banking_setup_complete", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "notification_preferences_json": { + "name": "notification_preferences_json", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "payment_preferences_json": { + "name": "payment_preferences_json", + "type": "json", + "primaryKey": false, + "notNull": false + }, + "onboarding_step": { + "name": "onboarding_step", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "encrypted_data": { + "name": "encrypted_data", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "started_on": { + "name": "started_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.web_tokens": { + "name": "web_tokens", + "schema": "", + "columns": { + "token_id": { + "name": "token_id", + "type": "varchar(64)", + "primaryKey": true, + "notNull": true + }, + "state_id": { + "name": "state_id", + "type": "varchar(36)", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_type": { + "name": "token_type", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "token_value": { + "name": "token_value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_on": { + "name": "expires_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "created_on": { + "name": "created_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "updated_on": { + "name": "updated_on", + "type": "bigint", + "primaryKey": false, + "notNull": true + }, + "last_used_on": { + "name": "last_used_on", + "type": "bigint", + "primaryKey": false, + "notNull": false + }, + "is_active": { + "name": "is_active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "metadata": { + "name": "metadata", + "type": "json", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": { + "web_tokens_user_id_users_id_fk": { + "name": "web_tokens_user_id_users_id_fk", + "tableFrom": "web_tokens", + "tableTo": "users", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "no action", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": {}, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/drizzle/meta/_journal.json b/drizzle/meta/_journal.json index dc7f93b..8f4ca95 100644 --- a/drizzle/meta/_journal.json +++ b/drizzle/meta/_journal.json @@ -8,6 +8,13 @@ "when": 1765422865294, "tag": "0000_gifted_stepford_cuckoos", "breakpoints": true + }, + { + "idx": 1, + "version": "7", + "when": 1769631945820, + "tag": "0001_spicy_sunset_bain", + "breakpoints": true } ] -} +} \ No newline at end of file