Merge branch 'api' of http://repository.trustie.net/xianbo/trustie2 into api
Conflicts: Gemfile.lockapi
commit
dbb46b07a6
@ -0,0 +1,38 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class Course < Grape::Entity
|
||||||
|
def self.course_expose(field)
|
||||||
|
expose field do |f,opt|
|
||||||
|
f[:course][field] || f[:course].__send__(field)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
expose :img_url
|
||||||
|
course_expose :attachmenttype
|
||||||
|
course_expose :class_period
|
||||||
|
course_expose :code
|
||||||
|
course_expose :created_at
|
||||||
|
course_expose :description
|
||||||
|
course_expose :endup_time
|
||||||
|
course_expose :extra
|
||||||
|
course_expose :id
|
||||||
|
course_expose :inherit_members
|
||||||
|
course_expose :is_public
|
||||||
|
course_expose :lft
|
||||||
|
course_expose :location
|
||||||
|
course_expose :name
|
||||||
|
course_expose :open_student
|
||||||
|
# course_expose :password
|
||||||
|
course_expose :rgt
|
||||||
|
course_expose :school_id
|
||||||
|
course_expose :setup_time
|
||||||
|
course_expose :state
|
||||||
|
course_expose :status
|
||||||
|
course_expose :string
|
||||||
|
course_expose :tea_id
|
||||||
|
course_expose :term
|
||||||
|
course_expose :time
|
||||||
|
course_expose :updated_at
|
||||||
|
course_expose :teacher
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,20 @@
|
|||||||
|
module Mobile
|
||||||
|
module Entities
|
||||||
|
class User < Grape::Entity
|
||||||
|
#头像
|
||||||
|
#昵称
|
||||||
|
expose :login
|
||||||
|
#性别
|
||||||
|
expose :gender do |user, opt|
|
||||||
|
user.user_extentions.gender
|
||||||
|
end
|
||||||
|
#我的二维码
|
||||||
|
#工作单位
|
||||||
|
#邮箱地址
|
||||||
|
expose :mail
|
||||||
|
#地区
|
||||||
|
#签名
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,26 @@
|
|||||||
|
if Rails.env.development?
|
||||||
|
lib_ruby_files = Dir.glob(File.join("app/api/**", "*.rb"))
|
||||||
|
lib_reloader ||= ActiveSupport::FileUpdateChecker.new(lib_ruby_files) do
|
||||||
|
# lib_ruby_files.each do |lib_file|
|
||||||
|
# puts "start require #{lib_file}"
|
||||||
|
# require_dependency(lib_file)
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
|
||||||
|
# binding.pry
|
||||||
|
# if Object.const_defined?(:Mobile)
|
||||||
|
# Object.send(:remove_const, :Mobile)
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# $".delete_if {|s| s.include?('api/mobile') }
|
||||||
|
# require File.join(Rails.root,"app/api/mobile/api.rb")
|
||||||
|
Rails.application.reload_routes!
|
||||||
|
end
|
||||||
|
|
||||||
|
ActionDispatch::Callbacks.to_prepare do
|
||||||
|
lib_reloader.execute_if_updated
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in new issue