feat: associer les garanties aux locataires (#76)

This commit is contained in:
nessar authored and Nessar committed 2026-08-17 14:18:17 +02:00
1 parent 968e2c2cd2
commit 68fad6e6e5
71 files changed
+1493 -613

No files matched your search

+1 -1
View File
@@ -2,7 +2,7 @@
**Status**: accepted
Within Rental Management, `Lease` owns its contractual lifecycle, dates, rent terms, and lease-party relationships while referencing independent `Apartment` and `Tenant` aggregates by ID. Activation freezes the landlord identity and address, apartment address, tenant identities and addresses, guarantors, and financial terms; later changes are effective-dated immutable `LeaseAmendment` records that preserve both contract versions and may only recalculate future unpaid dues. `RentDue` and `RentPayment` are independent aggregates; a positive payment owns allocations whose sum cannot exceed the amount received, each allocation cannot exceed its due's remaining balance, and one payment may cover multiple dues only within the same lease. Any surplus stays unallocated. `Guarantor` remains internal to `Lease` until it gains an independent lifecycle or must be shared across leases.
Within Rental Management, `Lease` owns its contractual lifecycle, dates, rent terms, and lease-party relationships while referencing independent `Apartment` and `Tenant` aggregates by ID. Activation freezes the landlord identity and address, apartment address, tenant identities and addresses, guarantees, and financial terms; later changes are effective-dated immutable `LeaseAmendment` records that preserve both contract versions and may only recalculate future unpaid dues. A `LeaseGuarantee` is an internal lease entity for one physical guarantor and exactly one tenant already named by that lease; it is never expanded into every guarantor-tenant combination. `RentDue` and `RentPayment` are independent aggregates; a positive payment owns allocations whose sum cannot exceed the amount received, each allocation cannot exceed its due's remaining balance, and one payment may cover multiple dues only within the same lease. Any surplus stays unallocated. `LeaseGuarantee` remains internal to `Lease` until it gains an independent lifecycle or must be shared across leases.
`Apartment` owns stable `PrivateArea` values covering rooms and annexes under the tenant's exclusive use. A lease snapshot freezes those identifiers and descriptions; furniture-inventory lines, property-condition observations, and photo evidence all reference them, while the regulatory main-room count is derived rather than stored independently.
+1 -1
View File
@@ -15,7 +15,7 @@ A containerized web application comprising a Java 25 / Spring Boot 4 backend and
3. As a Landlord (`Bailleur`), I want to create a Lease (`Bail`) linking an apartment to one or more Tenants (`Locataires`), so that the legal relationship and rental parameters (start date, end date, rent, charges) are documented.
4. As a Landlord (`Bailleur`), I want to generate a lease contract document based on a template, so that I can print it or send it by email to the tenants.
5. As a Landlord (`Bailleur`), I want to record a Security Deposit (`Dépôt de garantie`) paid by the tenants at the beginning of the lease, so that I can track the balance to be returned later.
6. As a Landlord (`Bailleur`), I want to associate one or more Guarantors (`Garants`) to a Lease (`Bail`), so that I can contact them in case the tenants default.
6. As a Landlord (`Bailleur`), I want to associate one or more physical-person Lease Guarantees (`Garanties du bail`) to an explicitly selected Tenant (`Locataire`) of a Lease (`Bail`), so that I can contact them in case that tenant defaults.
7. As a Landlord (`Bailleur`), I want to generate monthly Rent Receipts (`Quittances de loyer`) for active leases, so that I can send them as PDFs to tenants who paid their rent.
8. As a Landlord (`Bailleur`), I want to record rent payments already received and see how they settle monthly rent dues, so that I can monitor my rental income flow without manually marking dues as paid.
9. As a Landlord (`Bailleur`), I want to record and view a Furniture Inventory (`Inventaire du mobilier`) for each apartment, so that I can meet LMNP legal requirements.
+7 -5
View File
@@ -110,7 +110,7 @@ attachment-transfer endpoint or `targetTenantId` request.
## 5. Lease drafts, amendments, clauses, and document revisions
- **Angular**: `LeaseForm`, `GuarantorForm`, `LeaseClauseEditor`, `LeaseLegalTerms`,
- **Angular**: `LeaseForm`, `LeaseGuaranteeForm`, `LeaseClauseEditor`, `LeaseLegalTerms`,
`LeaseAmendmentForm`, `LeasesPage`
- **Mutable commands**:
- `POST /api/leases`
@@ -124,7 +124,8 @@ attachment-transfer endpoint or `targetTenantId` request.
- `apartmentId` is non-blank and `tenantIds` is a non-empty list of distinct, non-blank IDs.
- `startDate`, `monthlyRent`, `monthlyCharges`, and `securityDeposit` are non-null.
- Rent is strictly positive; charges and deposit are positive or zero; `dueDay` is 1 through 28.
- Guarantor first name, last name, and email are required; email syntax is validated.
- Each `guarantees[]` entry names one `tenantId` already present in `tenantIds`; first name,
last name, and email are required, and email syntax is validated.
- At most 20 special clauses and 20 parameters per clause are accepted. Parameter values are at
most 500 characters, custom clause text 4,000, supplement justification 2,000, IRL series ID
100, recent-work description 4,000, and other terms 8,000.
@@ -135,9 +136,10 @@ attachment-transfer endpoint or `targetTenantId` request.
`monthlyCharges` are required.
- `effectiveDate` cannot be in the past; `endDate` cannot precede it.
- Amount and due-day constraints match the draft request.
- **Angular mirror**: important required fields, amount/day bounds, dates, guarantor contact data,
- **Angular mirror**: important required fields, amount/day bounds, dates, the selected tenant and
guarantee contact data,
clause inputs, and conditional legal terms are checked before submit. Known nested server paths
are routed to the core form, guarantor, legal-terms, or clause editor without clearing the draft.
are routed to the core form, guarantee, legal-terms, or clause editor without clearing the draft.
- **Document revision command**: generating a revision has no editable request payload; its
operation-local pending/error state is separate from lease editing and downloads.
@@ -164,7 +166,7 @@ attachment-transfer endpoint or `targetTenantId` request.
- `POST /api/leases/{leaseId}/finalization` (multipart)
- **Backend**: `LeaseFinalizationController`, `LeaseFinalizationApi`
- **Guarantee-deed multipart contract**: optional request parameters are validated together as
`requirementIndex`, `guarantorId`, `tenantId`, and true `attestation`; `file` is a required,
`requirementIndex`, `guaranteeId`, `tenantId`, and true `attestation`; `file` is a required,
valid, non-empty PDF.
- **Finalization multipart contract**:
- `signedLease` is a required valid PDF.