Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| AccountDeletionLog | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Models; |
| 4 | |
| 5 | /** |
| 6 | * Audit trail for account deletion and deactivation events. |
| 7 | * |
| 8 | * Each document captures the outcome of every external-service step so that |
| 9 | * support can reconstruct exactly what happened (and what may have failed) for |
| 10 | * any given user deletion. |
| 11 | * |
| 12 | * @property string $user_id Original MongoDB user _id |
| 13 | * @property string $email Original email address (before anonymisation) |
| 14 | * @property string $action 'deleted' | 'deactivated' |
| 15 | * @property string $triggered_by 'self' | 'admin' |
| 16 | * @property string|null $admin_id Admin user _id if triggered_by = 'admin' |
| 17 | * @property string|null $admin_email Admin email if triggered_by = 'admin' |
| 18 | * @property string $overall_status 'success' | 'partial_failure' | 'failed' |
| 19 | * @property array $steps Keyed step results – see step schema below |
| 20 | * @property array|null $context Arbitrary extra context (plan name, company_id, etc.) |
| 21 | * |
| 22 | * Step schema (each key in $steps): |
| 23 | * [ |
| 24 | * 'success' => bool, |
| 25 | * 'error' => string|null, |
| 26 | * 'detail' => string|null, // e.g. stripe_subscription_id |
| 27 | * 'timestamp' => UTCDateTime, |
| 28 | * ] |
| 29 | * |
| 30 | * Step keys used: |
| 31 | * stripe_cancelled | instancy_cancelled | hubspot_opt_out | db_anonymised |
| 32 | */ |
| 33 | class AccountDeletionLog extends Moloquent |
| 34 | { |
| 35 | protected $table = 'account_deletion_logs'; |
| 36 | |
| 37 | protected $guarded = []; |
| 38 | |
| 39 | protected $casts = [ |
| 40 | 'steps' => 'array', |
| 41 | 'context' => 'array', |
| 42 | ]; |
| 43 | } |