-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: expose groups and vpns related list APIs #216
base: master
Are you sure you want to change the base?
Conversation
@@ -40,6 +45,19 @@ def add_user | |||
head :no_content | |||
end | |||
|
|||
def list_admins | |||
group = Group.find(params[:id]) | |||
users = group.group_admins.joins(:user). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we also check if users in group_admins
are not inactive. and if inactive users are there can we filter them out?
@@ -1,4 +1,9 @@ | |||
class ::Api::V1::GroupsController < ::Api::V1::BaseController | |||
def index | |||
groups = Group.order(:id).page(params[:page]).per(params[:per_page]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add the default page
and per_page
if it's not provided by user
@@ -1,6 +1,17 @@ | |||
class ::Api::V1::VpnsController < ::Api::V1::BaseController | |||
before_action :set_vpn, only: [:assign_group] | |||
|
|||
def index | |||
vpns = Vpn.order(:id).page(params[:page]).per(params[:per_page]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, default page
and per_page
in case not present in request
New APIs
/api/v1/groups?page=1&per_page=10
/api/v1/groups/:id/vpns
/api/v1/groups/:id/admins
/api/v1/vpns?page=1&per_page=10
/api/v1/vpns/:id/groups