Skip to content

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


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

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