Coverage for apps/disclosures/schemas.py: 100%
37 statements
« prev ^ index » next coverage.py v7.17.0, created at 2026-11-04 14:06 +0000
« prev ^ index » next coverage.py v7.17.0, created at 2026-11-04 14:06 +0000
1"""Ninja schemas for the disclosures API."""
3from __future__ import annotations
5from datetime import date
7from ninja import ModelSchema, Schema
9from apps.disclosures.models import Disclosure, DisclosureRecipient
10from apps.fees_trid.schemas import FeeIn, FeeOut, ToleranceOut
13class DisclosureRecipientOut(ModelSchema):
14 class Meta:
15 model = DisclosureRecipient
16 exclude = ["disclosure"]
19class DisclosureOut(ModelSchema):
20 recipients: list[DisclosureRecipientOut] = []
22 class Meta:
23 model = Disclosure
24 exclude = ["loan"]
27class PackageTypeIn(Schema):
28 package_type: str
31class AuditFindingOut(Schema):
32 code: str
33 severity: str
34 message: str
37class AuditResultOut(Schema):
38 findings: list[AuditFindingOut]
41class RecipientIn(Schema):
42 borrower_id: int
43 email: str
46class SendIn(Schema):
47 recipients: list[RecipientIn]
50class SignIn(Schema):
51 signed: bool = True
54class ChangeOfCircumstanceIn(Schema):
55 reason: str
56 discovered_date: date | None = None
57 fees: list[FeeIn]
60class ChangeOfCircumstanceOut(Schema):
61 disclosure: DisclosureOut
62 tolerance_cure: ToleranceOut
63 lender_credit: FeeOut | None = None