adding player delete feature - #39
Merged
Merged
Conversation
Greptile SummaryThe PR adds per-project player deletion with a configurable grace period, cancellation paths, and an hourly permanent-purge job.
|
| Filename | Overview |
|---|---|
| db/migrations/0043_player_delete_request.up.sql | Adds deletion-request state, a purge index, audit actor nullification on player deletion, and portal-visible deletion status. |
| internal/httpapi/auth_account.go | Adds authenticated deletion requests and credential-based cancellation with project scoping and password reauthentication. |
| internal/players/account.go | Adds account-portal request and cancellation flows scoped to players linked to the active global account. |
| internal/controlpanel/players.go | Adds administrator request/cancel handlers with tenant, project, and player scoping. |
| internal/jobs/player_delete_purge.go | Implements tenant-scoped transactional batches that lock due requests, clean non-cascading signals, hard-delete players, audit purges, and release quota slots. |
| internal/db/queries/player_delete.sql | Defines account-scoped request/cancel operations and locked tenant-scoped purge queries. |
| internal/db/queries/auth.sql | Adds self-service request and cancellation queries while preserving pre-existing suspensions. |
| cmd/ggscale-server/main.go | Wires the validated grace period into all deletion surfaces and registers the purge worker. |
Sequence Diagram
sequenceDiagram
actor Player
participant API as API / Portal / Control Panel
participant DB as PostgreSQL
participant Job as Hourly Purge Job
Player->>API: Request project-player deletion
API->>DB: Set delete_requested_at and disabled_at
API->>DB: Increment session_epoch and revoke sessions
DB-->>API: Deletion timestamp
API-->>Player: Scheduled purge time
alt Cancellation before cutoff
Player->>API: Cancel deletion
API->>DB: Lock/update pending player row
DB->>DB: Clear request and request-owned disable
API-->>Player: Deletion cancelled
else Grace period elapsed
Job->>DB: Select due rows FOR UPDATE
Job->>DB: Delete signals and player rows
DB->>DB: Cascade project data and preserve audits
Job->>DB: Release quota slots
end
Reviews (1): Last reviewed commit: "adding player delete feature" | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding disable then delete after grace period feature.