|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
3 | 3 | import json |
| 4 | +from datetime import datetime |
4 | 5 | from typing import Any |
5 | 6 |
|
6 | 7 | from pydantic import BaseModel, Field, field_validator, model_validator |
@@ -709,6 +710,101 @@ class FavoriteRecord(BaseModel): |
709 | 710 | ) |
710 | 711 |
|
711 | 712 |
|
| 713 | +class UserDataPurgePreviewResponse(BaseModel): |
| 714 | + """Preview of user-owned data that will be removed by a purge request.""" |
| 715 | + |
| 716 | + user_id: int = Field( |
| 717 | + ..., |
| 718 | + description="Authenticated user id.", |
| 719 | + json_schema_extra={"example": 12}, |
| 720 | + ) |
| 721 | + history_records: int = Field( |
| 722 | + ..., |
| 723 | + description="Number of saved history records that will be deleted.", |
| 724 | + json_schema_extra={"example": 4}, |
| 725 | + ) |
| 726 | + favorite_records: int = Field( |
| 727 | + ..., |
| 728 | + description="Number of favorite records that will be deleted.", |
| 729 | + json_schema_extra={"example": 2}, |
| 730 | + ) |
| 731 | + account_will_be_deleted: bool = Field( |
| 732 | + ..., |
| 733 | + description="Whether the user account row will be deleted.", |
| 734 | + json_schema_extra={"example": True}, |
| 735 | + ) |
| 736 | + confirmation_phrase: str = Field( |
| 737 | + ..., |
| 738 | + description="Phrase required to confirm irreversible deletion.", |
| 739 | + json_schema_extra={"example": "DELETE MY DATA"}, |
| 740 | + ) |
| 741 | + deletion_status: str = Field( |
| 742 | + ..., |
| 743 | + description="Current user deletion lifecycle status.", |
| 744 | + json_schema_extra={"example": "active"}, |
| 745 | + ) |
| 746 | + retention_days: int = Field( |
| 747 | + ..., |
| 748 | + description="Number of days before final erase becomes eligible.", |
| 749 | + json_schema_extra={"example": 30}, |
| 750 | + ) |
| 751 | + deletion_scheduled_for: datetime | None = Field( |
| 752 | + None, |
| 753 | + description="Timestamp when final erase becomes eligible, if already scheduled.", |
| 754 | + ) |
| 755 | + |
| 756 | + |
| 757 | +class UserDataPurgeRequest(BaseModel): |
| 758 | + """Confirmation body for irreversible account and data purge.""" |
| 759 | + |
| 760 | + confirmation: str = Field( |
| 761 | + ..., |
| 762 | + min_length=1, |
| 763 | + max_length=64, |
| 764 | + description="Must exactly match the confirmation phrase.", |
| 765 | + json_schema_extra={"example": "DELETE MY DATA"}, |
| 766 | + ) |
| 767 | + |
| 768 | + |
| 769 | +class UserDataPurgeResponse(BaseModel): |
| 770 | + """Result returned after successful user data purge.""" |
| 771 | + |
| 772 | + status: str = Field( |
| 773 | + ..., |
| 774 | + description="Purge status.", |
| 775 | + json_schema_extra={"example": "purged"}, |
| 776 | + ) |
| 777 | + history_deleted: int = Field( |
| 778 | + ..., |
| 779 | + description="Deleted history record count.", |
| 780 | + json_schema_extra={"example": 4}, |
| 781 | + ) |
| 782 | + favorites_deleted: int = Field( |
| 783 | + ..., |
| 784 | + description="Deleted favorite record count.", |
| 785 | + json_schema_extra={"example": 2}, |
| 786 | + ) |
| 787 | + account_deleted: bool = Field( |
| 788 | + ..., |
| 789 | + description="Whether the user account was deleted.", |
| 790 | + json_schema_extra={"example": True}, |
| 791 | + ) |
| 792 | + audit_recorded: bool = Field( |
| 793 | + ..., |
| 794 | + description="Whether a non-sensitive audit record was stored.", |
| 795 | + json_schema_extra={"example": True}, |
| 796 | + ) |
| 797 | + deletion_scheduled_for: datetime | None = Field( |
| 798 | + None, |
| 799 | + description="Timestamp when final erase becomes eligible.", |
| 800 | + ) |
| 801 | + retention_days: int = Field( |
| 802 | + ..., |
| 803 | + description="Number of days before final erase becomes eligible.", |
| 804 | + json_schema_extra={"example": 30}, |
| 805 | + ) |
| 806 | + |
| 807 | + |
712 | 808 | # ── Share ───────────────────────────────────────────────────────────────────── |
713 | 809 |
|
714 | 810 |
|
|
0 commit comments