get Groups

@Query(value = "SELECT groups.* FROM " + GROUPS_KEY + " AS groups LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON groups." + IDENTIFIER_KEY + " = group_members." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + "=:" + AUTHOR_KEY + " AND " + "groups." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" + " AND (" + "COALESCE(:" + ROLES_FILTER_KEY + ") IS NULL" + " OR " + GROUP_MEMBERS_TABLE + "." + MEMBER_ROLE_KEY + " IN (:" + ROLES_FILTER_KEY + ")" + ") AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = " + "'JOINED'" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getGroups(@Param(value = "author") userId: String, @Param(value = "name") name: String, @Param(value = "roles") roles: List<String>, pageable: Pageable): List<Group>

Method to execute the query to select the list of a Group

Return

the list of groups as List of Group

Parameters

userId

The user identifier

pageable

The parameters to paginate the query

name

The name of the group to use as filter

roles

The role values to use as filter


@Query(value = "SELECT groups.* FROM " + GROUPS_KEY + " AS groups LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON groups." + IDENTIFIER_KEY + " = group_members." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." + IDENTIFIER_KEY + "=:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = " + "'JOINED'" + " ORDER BY " + CREATION_DATE_KEY + " DESC ", nativeQuery = true )
abstract fun getGroups(@Param(value = "author") userId: String): List<Group>

Method to execute the query to select the list of a Group

Return

the list of groups as List of Group

Parameters

userId

The user identifier