|
|
@ -17,8 +17,8 @@ module Mobile
|
|
|
|
expose :bidding_users_count, if: { type: :index }
|
|
|
|
expose :bidding_users_count, if: { type: :index }
|
|
|
|
expose :min_price
|
|
|
|
expose :min_price
|
|
|
|
expose :max_price
|
|
|
|
expose :max_price
|
|
|
|
expose :contact_name, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? }
|
|
|
|
expose :contact_name, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) }
|
|
|
|
expose :contact_phone, if: ->(package, opts){ opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business? }
|
|
|
|
expose :contact_phone, if: ->(package, opts){ opts[:user].present? && (opts[:user].id == package.creator_id || opts[:user].admin? || opts[:user].business?) }
|
|
|
|
|
|
|
|
|
|
|
|
expose :updated_at do |package, _|
|
|
|
|
expose :updated_at do |package, _|
|
|
|
|
package.updated_at.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
|
package.updated_at.strftime('%Y-%m-%d %H:%M:%S')
|
|
|
@ -65,6 +65,7 @@ module Mobile
|
|
|
|
|
|
|
|
|
|
|
|
expose :operation, if: { type: :show } do |package, opts|
|
|
|
|
expose :operation, if: { type: :show } do |package, opts|
|
|
|
|
user = opts[:user]
|
|
|
|
user = opts[:user]
|
|
|
|
|
|
|
|
return {} if user.blank?
|
|
|
|
is_creator = user.id == package.creator_id
|
|
|
|
is_creator = user.id == package.creator_id
|
|
|
|
is_admin = user.admin? || user.business?
|
|
|
|
is_admin = user.admin? || user.business?
|
|
|
|
|
|
|
|
|
|
|
|