2016-07-04 16:19:05 +08:00
|
|
|
module Mobile
|
|
|
|
module Entities
|
|
|
|
class Syllabus < Grape::Entity
|
|
|
|
expose :title
|
|
|
|
expose :id
|
2016-07-14 16:54:43 +08:00
|
|
|
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
|
|
|
current_user = options[:user]
|
|
|
|
can_setting = instance.user_id == current_user.id ? true : false
|
|
|
|
can_setting = false if instance.id.nil?
|
|
|
|
can_setting
|
|
|
|
end
|
2016-07-04 16:19:05 +08:00
|
|
|
expose :courses, using: Mobile::Entities::Course
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|