Skip to content

Remove Db::DeletedUser::Create, move logic to DeletedUser#7407

Merged
zachmargolis merged 2 commits intomainfrom
margolis-remove-service-class-deleted-user
Nov 30, 2022
Merged

Remove Db::DeletedUser::Create, move logic to DeletedUser#7407
zachmargolis merged 2 commits intomainfrom
margolis-remove-service-class-deleted-user

Conversation

@zachmargolis
Copy link
Contributor

One fewer namespace (Db::DeletedUser) and one fewer single-method class

Comment on lines 23 to 26
ActiveRecord::Base.transaction do
Db::DeletedUser::Create.call(current_user.id)
DeletedUser.create_from_user(current_user)
current_user.destroy!
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the one argument I could see for keeping around a separate service object to manage creating deleted users, is having a single object that's OK to modify two separate tables

This pattern/transaction is repeated in two places, and ideally one object/method could handle both. However, it's only repeated once so I think it's OK to leave like this

Copy link
Contributor

@aduth aduth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Andrew Duthie <andrew.duthie@gsa.gov>
@zachmargolis zachmargolis merged commit 4952227 into main Nov 30, 2022
@zachmargolis zachmargolis deleted the margolis-remove-service-class-deleted-user branch November 30, 2022 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants