Skip to content
Snippets Groups Projects
Commit d129a403 authored by tmn21's avatar tmn21 :rocket:
Browse files

ISSUE #41: UPDATE top_users route

parent 396aff79
No related branches found
No related tags found
1 merge request!40ISSUE #41: UPDATE top_users route
Pipeline #34019 failed
...@@ -178,9 +178,12 @@ class V1::UsersController < ApplicationController ...@@ -178,9 +178,12 @@ class V1::UsersController < ApplicationController
render status: :ok, json: response render status: :ok, json: response
end end
# GET /v1/top_users
def show_top_users def show_top_users
# select id, level from users order by level desc limit 5; # select users who are not admin and order by level, limit to 5 users
users = paginate User.all.order("level DESC").limit(6) ids = User.joins(:roles_users).where(roles_users: {role_id: 3}).pluck(:user_id)
users = User.where.not(id: ids).order("level DESC").limit(5)
render json: users render json: users
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment