feat(maintenance): Prisma Decimal migration and schema hardening - #199
Merged
Conversation
- Migrated all monetary fields from Float to Decimal for financial precision - Added LeaseAgreement and LeaseSignature models for contract lifecycle - Added LeasePaymentSchedule for payment obligations tracking - Added LeaseEvent for immutable lease audit timeline - Added LandAvailabilityStatus to prevent double-leasing - Added PaymentWebhookEvent for idempotent Razorpay webhook processing - Added PaymentProvider and PaymentType enums - Changed AdminSession token to tokenHash for security - Replaced onDelete: Cascade with Restrict/SetNull for financial records - Added optimistic concurrency (version fields) to critical entities - Added composite indexes for query performance - Added Decimal utility functions for consistent money handling - Fixed all TypeScript Decimal boundary errors across 30+ files - Updated session-manager for token hashing - Fixed notification service for Decimal formatting Breaking: Float monetary fields now use Decimal type Migration: 20260811181655_lease_execution_foundation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Hardened Fieldly's persistence and financial domain model by completing the Prisma Decimal migration and introducing stronger lease, payment, security, and concurrency guarantees.
This change establishes the data-layer foundation required for reliable lease execution and payment processing while tightening destructive operations and sensitive session handling.
Financial Data Integrity
Decimal Migration
FloattoDecimalThis removes floating-point representation from financial calculations and establishes consistent monetary precision across the application.
Lease Lifecycle
Added dedicated persistence models for the lease execution lifecycle:
LeaseAgreement— contract representationLeaseSignature— contract signing stateLeasePaymentSchedule— payment obligationsLeaseEvent— immutable lease audit timelineLandAvailabilityStatus— land availability stateThese models establish explicit state and audit boundaries instead of relying on loosely coupled application records.
Payment Integrity
PaymentWebhookEventfor idempotent Razorpay webhook processingPaymentProviderandPaymentTypeenumsConcurrency & Leasing Protection
Security Hardening
AdminSessiontokens withtokenHashRestrict/SetNullsemanticsThis reduces the risk of accidental financial-record deletion and limits exposure of sensitive session credentials.
Schema & Migration Safety
20260811181655_lease_execution_foundationLandListingindexesImpact
Validation
Breaking Change
Monetary fields previously represented as
Floatnow useDecimal.Existing integrations and application boundaries handling monetary values were updated accordingly.
Outcome
Fieldly's data layer now provides stronger guarantees around financial precision, lease lifecycle integrity, payment idempotency, concurrency, and sensitive session data.
This establishes the persistence foundation required for reliable lease execution and future payment workflows.