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