feat(reports): parameterized renewal-notice report + legacy report reference
Replaces ~40 legacy Access renewal-notice report clones (one per carrier per coverage tier, e.g. AMPL/RC/LIC RENEW X MES/VENCE ATLAS 13/2013) with one parameterized aviso-renovacion report driven by real Policy/Vehicle/ coveragesJson data instead of hand-typed label text per clone. - schema.prisma: add RenewalNotice, replacing the legacy CONTROL <ramo> RENEW[2/3] X MES paper log of which notice generation was sent - reports: new "letter" ReportFormat + aviso-renovacion registry entry + LetterLayout renderer in ReportRunner.tsx - docs/RENEWAL_NOTICES.md + migration/legacy_report_defs/: extracted (via Application.SaveAsText, since the VBA project wouldn't load) and documented the legacy report/query chain this replaces Coveragesjson key names and a mark-as-sent mutation are still unverified/ unbuilt — see caveats in docs/RENEWAL_NOTICES.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -181,12 +181,42 @@ model Policy {
|
||||
claims Claim[]
|
||||
documents PolicyDocument[]
|
||||
properties Property[]
|
||||
renewalNotices RenewalNotice[]
|
||||
|
||||
@@unique([legacySourceDb, legacySourceTable, legacyId])
|
||||
@@index([policyNumber])
|
||||
@@map("policies")
|
||||
}
|
||||
|
||||
enum RenewalNoticeChannel {
|
||||
MAIL
|
||||
EMAIL
|
||||
}
|
||||
|
||||
/// Replaces the legacy `CONTROL <ramo> RENEW[2/3] X MES` reports — a
|
||||
/// per-batch printed checklist of who'd been sent which reminder. One row
|
||||
/// per notice generation actually sent for a policy, so "who got a 1st/2nd/
|
||||
/// 3rd notice and when" is a query instead of a paper trail. See
|
||||
/// docs/RENEWAL_NOTICES.md for the legacy report chain this replaces.
|
||||
model RenewalNotice {
|
||||
id String @id @default(uuid())
|
||||
policyId String
|
||||
policy Policy @relation(fields: [policyId], references: [id])
|
||||
// 1 = first notice (bare RENEW), 2 = RENEW2, 3 = RENEW3 in the legacy naming.
|
||||
generation Int
|
||||
channel RenewalNoticeChannel @default(MAIL)
|
||||
sentAt DateTime?
|
||||
sentById String?
|
||||
notes String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
// One row per generation per policy — matches the legacy's 1st/2nd/3rd
|
||||
// notice cadence; re-running the same generation for a policy updates it
|
||||
// rather than duplicating a log entry.
|
||||
@@unique([policyId, generation])
|
||||
@@map("renewal_notices")
|
||||
}
|
||||
|
||||
/// Unpivots the 4 hardcoded payment-installment columns found on every
|
||||
/// legacy policy table (1ER PAGO/FECHA PAGO/NO CHEQUE, ...2, ...3, ...4).
|
||||
model PolicyPaymentInstallment {
|
||||
|
||||
Reference in New Issue
Block a user