Search.../

queryJoinRequests( )

Creates a query to retrieve a list of join requests.

Description


Notes:

  • This function is only relevant for private groups.
  • For SECRET groups, only site admins and group admins can query requests to join their group. However, if the suppressAuth option is set to true, all permissions are overwritten, and all site members (including non-group members) can query requests to join a group.

The queryJoinRequests() function builds a query to retrieve a list of all requests to join a group, and returns a JoinRequestsQueryBuilder object.

The returned object contains the query definition which is typically used to run the query using the find() function.

You can refine the query by chaining JoinRequestsQueryBuilder functions onto the query. JoinRequestsQueryBuilder functions enable you to sort, filter, and control the results that queryJoinRequests() returns.

The results of the queryJoinRequests() function are sorted by _createdDate in descending order.

queryJoinRequests() runs with this JoinRequestsQueryBuilder default, which you can override:

The following JoinRequestsQueryBuilder functions are supported for queryJoinRequests(). For a full description of the JoinRequests object, see the object returned for the items property in JoinRequestsQueryResult.

PropertySupported Filters & Sorting
statuseq(), ne(), hasSome(), or()

Syntax

function queryJoinRequests(): JoinRequestsQueryBuilder

queryJoinRequests Parameters

This function does not take any parameters.

Returns

A JoinRequestsQueryBuilder object that contains the refined query.

Was this helpful?

Query requests to join a group

Copy Code
1import { joinRequests } from 'wix-groups-backend';
2
3export function myQueryJoinRequestsFunction() {
4 return joinRequests.queryJoinRequests()
5 .find()
6 .then((queryResults) => {
7 const items = results.items;
8 const firstItem = items[0];
9 const pageSize = results.pageSize;
10 const totalPages = results.totalPages;
11 const totalCount = results.totalCount;
12 const currentPage = results.currentPage();
13 const next = results.next();
14 const previous = results.prev();
15 const hasNext = results.hasNext();
16 const hasPrev = results.hasPrev();
17 const length = results.length;
18
19 return items;
20 })
21 .catch((error) => {
22 console.error(error);
23 });
24}
25
26/* Returns items:
27 * [
28 * {
29 * "memberId": "937cd3db-e9be-4980-93c1-a6d767a11050"
30 * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
31 * "status": "REJECTED"
32 * "rejectionReason": "Wrong group."
33 * },
34 * {
35 * "memberId": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
36 * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
37 * "status": "PENDING"
38 * }
39 * ]
40 */