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 (dashboard page code)

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

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { joinGroupRequests } from 'wix-groups-v2';
3
4export const myQueryJoinGroupRequestsFunction = webMethod(Permissions.Anyone, () => {
5 return joinGroupRequests.queryJoinGroupRequests()
6 .find()
7 .then((queryResults) => {
8 const items = queryResults.items;
9 const firstItem = items[0];
10 const pageSize = queryResults.pageSize;
11 const totalPages = queryResults.totalPages;
12 const totalCount = queryResults.totalCount;
13 const currentPage = queryResults.currentPage;
14 const next = queryResults.next();
15 const previous = queryResults.prev();
16 const hasNext = queryResults.hasNext();
17 const hasPrev = queryResults.hasPrev();
18 const length = queryResults.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 */
47