Skip to content

User profile feature

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

This is basic user profile feature. It consists of 1 endpoints:

GET /api/v1/users/account/profile?include=account

The point of this endpoint is show user profile details. Accepts account inclusion.

ProfilesController#show

module Api::V1::Users::Account
  class ProfilesController < AuthorizedApiController
    def show
      endpoint Api::V1::Users::Account::Profiles::Operation::Show
    end
  end
end

Operation

module Api::V1::Users::Account::Profiles::Operation
  class Show < ApplicationOperation
    step Macro::Assign(to: :model, path: %i[current_account user]) # ctx[:model] = ctx[:current_account].user
    step Macro::Assign(to: :available_inclusion_options, value: %w[account]) # ctx[:available_inclusion_options] = ['account']
    step Subprocess(Api::V1::Lib::Operation::Inclusion), fast_track: true
    step Macro::Renderer(serializer: Api::V1::Users::Account::Profiles::Serializer::Show)
  end
end

Used nested & macroses

Clone this wiki locally