mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Add sso_audit_logs association and clear logs in demo data cleaner (#638)
- Added `has_many :sso_audit_logs` association to `User` model with `dependent: :nullify`. - Updated `Demo::DataCleaner` to clear SSO audit logs before destroying related data. Co-authored-by: Josh Waldrep <joshua.waldrep5+github@gmail.com>
This commit is contained in:
@@ -8,6 +8,9 @@ class Demo::DataCleaner
|
||||
|
||||
# Main entry point for destroying all demo data
|
||||
def destroy_everything!
|
||||
# Clear SSO audit logs first (they reference users)
|
||||
SsoAuditLog.destroy_all
|
||||
|
||||
Family.destroy_all
|
||||
Setting.destroy_all
|
||||
InviteCode.destroy_all
|
||||
|
||||
@@ -13,6 +13,7 @@ class User < ApplicationRecord
|
||||
has_many :impersonator_support_sessions, class_name: "ImpersonationSession", foreign_key: :impersonator_id, dependent: :destroy
|
||||
has_many :impersonated_support_sessions, class_name: "ImpersonationSession", foreign_key: :impersonated_id, dependent: :destroy
|
||||
has_many :oidc_identities, dependent: :destroy
|
||||
has_many :sso_audit_logs, dependent: :nullify
|
||||
accepts_nested_attributes_for :family, update_only: true
|
||||
|
||||
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
||||
|
||||
Reference in New Issue
Block a user