blob: ca5d93b244864c9e3da8568d551a898581d1829b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
module Api
# The UserAccounts controller.
class UserAccountsController < AuthenticatedController
skip_before_action :validate_jwt, only: [:create]
def show
render json: serialized_user_account.serializable_hash
end
def create
@user_account = UserAccount.new(permitted_params)
render json: generate_token, status: :ok and return if @user_account.save
render json: @user_account.errors.full_messages, status: :unprocessable_entity
end
private
def service_params
{ email: @user_account.email,
role: @user_account.role }
end
def permitted_params
params.require(:user_account).permit(:role, :email, :first_name, :last_name, :password)
end
end
end
|