Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/services/account-deletion-service

lib/services/account-deletion-service

Service for managing account deletion with grace period support.

Classes

AccountDeletionService

Service for managing account deletion.

Constructors

Constructor

new AccountDeletionService(payload): AccountDeletionService

Parameters
payload

BasePayload

Returns

AccountDeletionService

Methods

canDeleteUser()

canDeleteUser(userId): Promise<CanDeleteResult>

Check if a user can be deleted.

Parameters
userId

number

Returns

Promise<CanDeleteResult>

getDeletionSummary()

getDeletionSummary(userId): Promise<DeletionSummary>

Get a summary of data that will be affected by deletion.

Parameters
userId

number

Returns

Promise<DeletionSummary>

scheduleDeletion()

scheduleDeletion(userId): Promise<ScheduleDeletionResult>

Schedule account deletion with grace period.

Parameters
userId

number

Returns

Promise<ScheduleDeletionResult>

cancelDeletion()

cancelDeletion(userId): Promise<void>

Cancel a scheduled deletion.

Parameters
userId

number

Returns

Promise<void>

executeDeletion()

executeDeletion(userId, options?): Promise<ExecuteDeletionResult>

Execute account deletion (called by background job after grace period).

Parameters
userId

number

options?
deletedBy?

number

deletionType?

"admin" | "self" | "scheduled"

ipAddress?

string

Returns

Promise<ExecuteDeletionResult>

findDueDeletions()

findDueDeletions(): Promise<User[]>

Find users with pending deletions that are due.

Returns

Promise<User[]>

Variables

DELETION_GRACE_PERIOD_DAYS

const DELETION_GRACE_PERIOD_DAYS: 30 = 30

Grace period in days before account is permanently deleted.

Functions

createAccountDeletionService()

createAccountDeletionService(payload): AccountDeletionService

Create an account deletion service instance.

Returns a fresh instance each call. The service is stateless (all data lives in the database), so there is no benefit to caching the instance.

Parameters

payload

BasePayload

Returns

AccountDeletionService

References

CanDeleteResult

Re-exports CanDeleteResult


DeletionSummary

Re-exports DeletionSummary


ExecuteDeletionResult

Re-exports ExecuteDeletionResult


ScheduleDeletionResult

Re-exports ScheduleDeletionResult

Last updated on