35 lines
935 B
Ruby
35 lines
935 B
Ruby
object @jam_track
|
|
|
|
attributes :id, :name, :description, :recording_type, :original_artist, :songwriter, :publisher, :sales_region, :price, :version, :duration, :year, :plan_code, :allow_free, :download_price, :upgrade_price
|
|
|
|
node :genres do |item|
|
|
item.genres.select(:description).map(&:description)
|
|
end
|
|
|
|
node :added_cart do |item|
|
|
any_user.shopping_carts.where(cart_id: item.id).count != 0
|
|
end
|
|
|
|
node :can_download do |item|
|
|
!!item.right_for_user(current_user, ShoppingCart::JAMTRACK_FULL)
|
|
end
|
|
|
|
node :purchased do |item|
|
|
!!item.right_for_user(current_user)
|
|
end
|
|
|
|
child(:jam_track_tracks => :tracks) {
|
|
attributes :id, :part, :instrument, :track_type, :position
|
|
|
|
node do |track|
|
|
{
|
|
preview_mp3_url: track.preview_public_url('mp3'),
|
|
preview_ogg_url: track.preview_public_url('ogg'),
|
|
preview_aac_url: track.preview_public_url('aac')
|
|
}
|
|
end
|
|
}
|
|
|
|
child(:licensor => :licensor) {
|
|
attributes :id, :name
|
|
} |