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()

Authorization

Request

This endpoint does not take any parameters

Response Object

A CreateRequestsQueryBuilder object that contains the refined query.

Returns an empty object.

Status/Error Codes

Was this helpful?

Query requests to create a group

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