Skip to content

User Verification feature

Vladislav Trotsenko edited this page Sep 26, 2019 · 2 revisions

This is basic user verification feature. It consists of 1 endpoint.

GET /api/v1/users/verification

The point of this endpoint is provide accepting user verification link.

VerificationsController#show

module Api::V1::Users
  class VerificationsController < ApiController
    def show
      endpoint Api::V1::Users::Verifications::Operation::Show
    end
  end
end

Operation

module Api::V1::Users::Verifications::Operation
  class Show < ApplicationOperation
    step Subprocess(Api::V1::Users::Lib::Operation::DecryptEmailToken), fast_track: true # run nested operation
    step :user_account_not_verified? # is user account not verified checking
    fail Macro::AddContractError(base: 'errors.verification.user_account_already_verified'), fail_fast: true # add custom error to contract
    step :verify_user_account # add verified marker to model
    step :create_user # create nested user entity for current account entity
    step :send_notification # send email notification about successful user verification
  end
end

Used nested & macroses

Clone this wiki locally