Skip to content
Snippets Groups Projects
Commit 5285fd45 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Merge branch 'issue/401' into 'master'

Issue/401

See merge request portalmec/portalmec!535
parents ebd26f74 985a2132
No related branches found
No related tags found
No related merge requests found
......@@ -236,7 +236,8 @@ class V1::UsersController < ApplicationController
:avatar,
:cover,
:teacher_id,
:birthday
:birthday,
:ask_teacher_question
]
end
......
......@@ -30,6 +30,6 @@ class UserDeviseSerializer < ActiveModel::Serializer
attributes :id, :email, :teacher_id, :birthday, :provider, :avatar_file_name, :avatar_content_type, :uid, :name, :submitter_request, :avatar_file_size, :avatar_updated_at,
:bookmarks_count, :user_category_id, :score, :follows_count, :deleted_at, :description, :likes_count,
:learning_objects_count, :collections_count, :cover_file_name, :cover_content_type, :cover_file_size, :cover_updated_at
:learning_objects_count, :collections_count, :cover_file_name, :cover_content_type, :cover_file_size, :cover_updated_at, :ask_teacher_question
has_many :roles
end
......@@ -102,6 +102,9 @@ class UserSerializer < ActiveModel::Serializer
attribute \
:reactivated_at, if: :is_current_user?
attribute \
:ask_teacher_question, if: :is_current_user?
belongs_to :school
has_many :subjects
has_many :roles
......
class AddAskTeacherQuestionToUser < ActiveRecord::Migration[5.0]
def change
add_column :users, :ask_teacher_question, :boolean, default:true
end
end
......@@ -117,6 +117,7 @@ resource 'Users' do
parameter :avatar, 'The user avatar'
parameter :role_ids, 'The user roles', scope: :user
parameter :subjects, 'Array with subjects ids', scope: :user
parameter :ask_teacher_question, 'Boolean to decide to show or not to show the teacher question', scope: :user
let(:id) {@user.id}
let(:name) { Faker::Name.name }
......@@ -131,6 +132,7 @@ resource 'Users' do
# when it's a admin send [role.first.id]
let(:role_ids) { [] }
let(:subjects) { [subject.first.id] }
let(:ask_teacher_question) { false }
let(:raw_post) {params.to_json}
example 'Updating a user' do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment