Search.../

queryJoinGroupRequests( )

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.

The queryjoinGroupRequests() function builds a query to retrieve a list of all requests to join a group, and returns a joinGroupRequestsQueryBuilder 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 joinGroupRequestsQueryBuilder functions onto the query. joinGroupRequestsQueryBuilder functions enable you to sort, filter, and control the results that queryjoinGroupRequests() returns.

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

queryjoinGroupRequests() runs with this joinGroupRequestsQueryBuilder default, which you can override:

The following joinGroupRequestsQueryBuilder functions are supported for queryjoinGroupRequests(). For a full description of the joinGroupRequests object, see the object returned for the items property in joinGroupRequestsQueryResult.

PropertySupported Filters & Sorting
statuseq(), ne(), hasSome(), or()
PROPERTYSUPPORTED FILTERS & SORTING
statuseq(),ne(),exists(),in(),hasSome()
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function queryJoinGroupRequests(groupId: string): JoinGroupRequestsQueryBuilder

queryJoinGroupRequests Parameters

NAME
TYPE
DESCRIPTION
groupId
string

Group ID.

Was this helpful?

Query requests to join a group

Copy Code
1
2import { joinGroupRequests } from 'wix-groups-v2';
3
4export function myQueryJoinGroupRequestsFunction() {
5 return joinRequests.queryJoinGroupRequests()
6 .find()
7 .then((queryResults) => {
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": "7fe8e9e1-d050-4c86-9684-e7f231600a34"
31 * "_createdDate": "Fri Oct 24 2021 22:45:50 GMT+0300"
32 * "status": "PENDING"
33 * },
34 * {
35 * "memberId": "937cd3db-e9be-4980-93c1-a6d767a11050"
36 * "_createdDate": "Wed May 14 2021 10:05:20 GMT+0300"
37 * "status": "REJECTED"
38 * "rejectionReason": "Wrong group"
39 * },
40 * {
41 * "memberId": "2CD58761-d050-4c86-9684-e7f2316229b3"
42 * "_createdDate": "Sun July 11 2020 03:25:30 GMT+0300"
43 * "status": "APPROVED"
44 * }
45 * ]
46 */