docs: add remaining docs for classes in app/logical.

This commit is contained in:
evazion
2021-06-23 20:32:59 -05:00
parent c6855261fe
commit 00ca7526bb
47 changed files with 705 additions and 25 deletions

View File

@@ -1,3 +1,7 @@
# Delete a user's account. Deleting an account really just deactivates the
# account, it doesn't fully delete the user from the database. It wipes their
# username, password, account settings, favorites, and saved searches, and logs
# the deletion.
class UserDeletion
include ActiveModel::Validations
@@ -5,12 +9,19 @@ class UserDeletion
validate :validate_deletion
# Initialize a user deletion.
# @param user [User] the user to delete
# @param password [String] the user's password (for confirmation)
# @param request the HTTP request (for logging the deletion in the user event log)
def initialize(user, password, request)
@user = user
@password = password
@request = request
end
# Delete the account, if the deletion is allowed.
# @return [Boolean] if the deletion failed
# @return [User] if the deletion succeeded
def delete!
return false if invalid?