-
Notifications
You must be signed in to change notification settings - Fork 9
User Registration feature
Vladislav Trotsenko edited this page Apr 10, 2020
·
6 revisions
This is basic user registration feature. It consists of 1 endpoint.
The point of this endpoint is create user account.
module Api::V1::Users
class RegistrationsController < ApiController
def create
endpoint Api::V1::Users::Registrations::Operation::Create
end
end
end
module Api::V1::Users::Registrations::Operation
class Create < ApplicationOperation
step Macro::Inject(
jwt: 'services.email_token',
worker: Api::V1::Users::Registrations::Worker::EmailConfirmation
)
step Model(Account, :new)
step Contract::Build(constant: Api::V1::Users::Registrations::Contract::Create)
step Contract::Validate()
step Contract::Persist()
step Macro::Semantic(success: :created) # semantic marker for http status
step :set_email_token # jwt token for verification by email
step :send_confirmation_link # send confirmation uri with email token
step Macro::Renderer(serializer: Api::V1::Lib::Serializer::Account) # sets renderer options
end
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!