Search.../

queryGroupRequests( )

Developer Preview

Creates a query to retrieve a list of create requests.

Description

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

queryGorupRequests() runs with these GroupRequestsQueryBuilder defaults, which you can override:

The following GroupRequestsQueryBuilder functions are supported for queryGroupRequests(). For a full description of the GroupRequests object, see the object returned for the items property in GroupRequestsQueryResult.

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 queryGroupRequests(): GroupRequestsQueryBuilder

queryGroupRequests Parameters

This function does not take any parameters.

Returns

Was this helpful?

Query requests to create a group (dashboard page code)

Copy Code
1import { createRequests } from 'wix-groups.v2';
2
3export function myQueryGroupRequestsFunction() {
4 return createRequests.queryGroupRequests()
5 .find()
6 .then((queryResults) => {
7 const items = queryResults.items;
8 const firstItem = queryResults.items[0];
9 const pageSize = queryResults.pageSize;
10 const totalPages = queryResults.totalPages;
11 const totalCount = queryResults.totalCount;
12 const currentPage = queryResults.currentPage();
13 const next = queryResults.next();
14 const previous = queryResults.prev();
15 const hasNext = queryResults.hasNext();
16 const hasPrev = queryResults.hasPrev();
17 const length = queryResults.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 * "groupDetailsChangedPostEnabled": 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 * "groupDetailsChangedPostEnabled": 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 * "groupDetailsChangedPostEnabled": 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 */
Query requests to create a group (export from backend code)

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { createRequests } from 'wix-groups.v2';
3
4export const myQueryGroupRequestsFunction = webMethod(Permissions.Anyone, () => {
5 return createRequests.queryGroupRequests()
6 .find()
7 .then((queryResults) => {
8 const items = queryResults.items;
9 const firstItem = queryResults.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 * "_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 * "groupDetailsChangedPostEnabled": 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 * "groupDetailsChangedPostEnabled": 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 * "groupDetailsChangedPostEnabled": 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 */
123