Search.../

queryCreateRequests( )

Creates a query to retrieve a list of create requests.

Description


Notes:

  • This function is only relevant if admin approval is required for creating a group, or if the function's suppressAuth option is set to true.
  • For SECRET groups, only site admins can query requests to create a group. However, if the suppressAuth option is set to true, all permissions are overwritten, and all site members can query requests to create secret groups.

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

queryCreateRequests() runs with these CreateRequestsQueryBuilder defaults, which you can override:

The following CreateRequestsQueryBuilder functions are supported for queryCreateRequests(). For a full description of the CreateRequests object, see the object returned for the items property in CreateRequestsQueryResult.

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

Syntax

function queryCreateRequests(): CreateRequestsQueryBuilder

queryCreateRequests Parameters

This function does not take any parameters.

Returns

A CreateRequestsQueryBuilder object that contains the refined query.

Was this helpful?

Query requests to create a group

Copy Code
1import { createRequests } from 'wix-groups-backend';
2
3export function myQueryCreateRequestsFunction() {
4 return createRequests.queryCreateRequests()
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 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
29 * "status": "PENDING",
30 * "group": {
31 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
32 * "name": "My Group Request 1"
33 * "slug": "my-group-request-1"
34 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
35 * "privacyStatus": "PUBLIC"
36 * "coverImage": {
37 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/fossil.jpg#originWidth=800&originHeight=720",
38 * "position": {
39 * "x": 9,
40 * "y": 4
41 * }
42 * }
43 * "memberTitle": "Employees"
44 * "memberCount": 1
45 * "settings": {
46 * "groupUpdatePostEnabled": true
47 * "membersCanApprove": false
48 * "membersCanInvite": true
49 * "showMemberList": true
50 * "welcomeMemberPostEnabled": true
51 * }
52 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"
53 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"
54 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"
55 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
56 * }
57 * },
58 * {
59 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
60 * "status": "APPROVED",
61 * "group": {
62 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"
63 * "name": "My Group Request 2"
64 * "slug": "my-group-request-2"
65 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
66 * "privacyStatus": "PRIVATE"
67 * "coverImage": {
68 * "imageUrl": "wix:image://v1/ef9074e348009011fa9f2dzcvx22~mv2.jpg/house.jpg#originWidth=559&originHeight=399",
69 * "position": {
70 * "x": 30,
71 * "y": 225
72 * }
73 * }
74 * "memberTitle": "Friends"
75 * "memberCount": 65
76 * "settings": {
77 * "groupUpdatePostEnabled": true
78 * "membersCanApprove": true
79 * "membersCanInvite": true
80 * "showMemberList": false
81 * "welcomeMemberPostEnabled": true
82 * }
83 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"
84 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300"
85 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"
86 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"
87 * }
88 * }
89 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"
90 * "status": "REJECTED"
91 * "rejectionReason": "This group has inappropriate content.",
92 * "group": {
93 * "_id": "57vn211-b477-4e9tt-ba4j-df338c5adf337"
94 * "name": "My Group Request 3"
95 * "slug": "my-group-request-3"
96 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."
97 * "privacyStatus": "PRIVATE"
98 * "coverImage": {
99 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2dzcvx22~mv2.jpg/friends.jpg#originWidth=4494&originHeight=2248",
100 * "position": {
101 * "x": 36,
102 * "y": 87
103 * }
104 * }
105 * "memberTitle": "Students"
106 * "memberCount": 1
107 * "settings": {
108 * "groupUpdatePostEnabled": true
109 * "membersCanApprove": true
110 * "membersCanInvite": true
111 * "showMemberList": false
112 * "welcomeMemberPostEnabled": true
113 * }
114 * "lastActivityDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
115 * "_createdDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
116 * "_updatedDate": "Mon Feb 04 2019 01:19:53 GMT+0300"
117 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"
118 * }
119 * }
120 * ]
121 */