Skip to content

Latest commit

 

History

History
105 lines (80 loc) · 2.98 KB

File metadata and controls

105 lines (80 loc) · 2.98 KB

Diff

Listed from latest to earliest versions.

solid-process-2.95..solid-process-2.99--4

     skip_before_action :authenticate_user!, only: [:create]

     def create
-      case ::User::Registration.call(user_params)
+      case ::User.register(user_params)
       in Solid::Success(user_token:)
         render_json_with_success(status: :created, data: {user_token:})
       in Solid::Failure(input:)
@@ -12,7 +12,7 @@
     end

     def destroy
-      result = ::User::AccountDeletion.call(user: current_user)
+      result = ::User.delete_account(user: current_user)

       result.account_deleted? and return render_json_with_success(status: :ok)
     end

⬆ back to top

solid-process-2.00--2.80..solid-process-2.95

     def create
       case ::User::Registration.call(user_params)
-      in Solid::Success(user:)
-        render_json_with_success(status: :created, data: {user_token: user.token.value})
+      in Solid::Success(user_token:)
+        render_json_with_success(status: :created, data: {user_token:})
       in Solid::Failure(input:)
         render_json_with_model_errors(input)
       end

⬆ back to top

solid-process-1..solid-process-2.00--2.80

     end

     def destroy
-      current_user.destroy!
+      result = ::User::AccountDeletion.call(user: current_user)

-      render_json_with_success(status: :ok)
+      result.account_deleted? and return render_json_with_success(status: :ok)
     end

     private

⬆ back to top

solid-process-0..solid-process-1

       case ::User::Registration.call(user_params)
       in Solid::Success(user:)
         render_json_with_success(status: :created, data: {user_token: user.token.value})
-      in Solid::Failure(user:)
-        render_json_with_model_errors(user)
+      in Solid::Failure(input:)
+        render_json_with_model_errors(input)
       end
     end

⬆ back to top

vanilla-rails..solid-process-0

     skip_before_action :authenticate_user!, only: [:create]

     def create
-      user = ::User.new(user_params)
-
-      if user.save
+      case ::User::Registration.call(user_params)
+      in Solid::Success(user:)
         render_json_with_success(status: :created, data: {user_token: user.token.value})
-      else
+      in Solid::Failure(user:)
         render_json_with_model_errors(user)
       end
     end

⬆ back to top