Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

rahmatrhd
Copy link

New APIs

  • list groups /api/v1/groups?page=1&per_page=10
  • list group vpns /api/v1/groups/:id/vpns
  • list group admins /api/v1/groups/:id/admins
  • list vpns /api/v1/vpns?page=1&per_page=10
  • list vpn groups /api/v1/vpns/:id/groups

@@ -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).

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])

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])

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants