StaticinitializeInitialize the ConsentVersioning model and sync the table. Call once at application startup.
The Prorm instance
Override the default table name 'consent_versions'
StaticrecordRecord a new consent event with version tracking. Creates a new version record for each consent change.
Unique identifier of the data subject
Type of consent (e.g. 'marketing_emails')
Whether consent is granted (true) or revoked (false)
Privacy notice version at time of recording
Additional options
The created consent version record
StaticgetGet the full consent history for a user and consent type. Returns all version records in chronological order.
Unique identifier of the data subject
Type of consent to query
History options (order, limit, date filters)
Array of consent version records
StaticgetGet the current consent state for a user and consent type. Returns the most recent consent record (granted or revoked).
Unique identifier of the data subject
Type of consent to query
The current consent version record or null if none exists
StaticrevokeRevoke consent for a user and consent type. Creates a new version record with granted = false.
Unique identifier of the data subject
Type of consent to revoke
Additional options (metadata, ipAddress, etc.)
The created revocation record
StaticvalidateValidate whether consent is currently valid (granted and not expired).
Unique identifier of the data subject
Type of consent to validate
true if consent is currently valid, false otherwise
StaticgetGet all active (granted and not expired) consents for a user.
Unique identifier of the data subject
Array of active consent version records
StaticgetGet all users who have granted consent for a specific consent type. Useful for compliance audits and marketing campaigns.
Type of consent to query
Array of user IDs with active consent
StaticgetGet consent by specific version.
Unique identifier of the data subject
Type of consent to query
Specific version to retrieve
The consent version record or null if not found
StaticreRe-grant consent (creates new version after revocation).
Unique identifier of the data subject
Type of consent to re-grant
Current privacy notice version
Additional options
The created consent record
ConsentVersioning class for tracking consent history with version control. Provides methods for recording, retrieving, and validating consent records.