Added routes for trending_hashtags, expenses

• Added:
- routes for trending_hashtags, expenses
This commit is contained in:
mgabdev 2021-01-15 14:28:52 -05:00
parent 0269c7e107
commit c33013cccf
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class Api::V1::ExpensesController < EmptyController
def show
amount = Redis.current.get("monthly_funding_amount") || 0
amount = [amount.to_f, 100].min
render json: { "expenses": amount }
end
end

View File

@ -0,0 +1,11 @@
# frozen_string_literal: true
class Api::V1::TrendingHashtagsController < EmptyController
def show
tags = Redis.current.get("admin_trending_hashtags") || ""
tags = tags.strip.split(", ")
render json: { trending_hashtags: tags }
end
end

View File

@ -285,6 +285,8 @@ Rails.application.routes.draw do
resources :shortcuts, only: [:index, :create, :show, :destroy]
resources :albums, only: [:create, :update, :show, :destroy]
resources :album_lists, only: [:show]
resource :trending_hashtags, only: [:show]
resource :expenses, only: [:show]
resources :bookmark_collections, only: [:index, :create, :show, :update, :destroy] do
resources :bookmarks, only: [:index], controller: 'bookmark_collections/bookmarks'