Skip to content

Commit 3ab10ef

Browse files
author
Dushyant Bhalgami
committed
fixed the issue of returning all the groups
1 parent 40ea791 commit 3ab10ef

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/services/GroupService.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,10 @@ async function searchGroups(criteria, isAdmin = false) {
2929
const session = helper.createDBSession()
3030
try {
3131
let matchClause
32+
3233
if (criteria.memberId) {
3334
matchClause = `MATCH (g:Group)-[r:GroupContains {type: "${criteria.membershipType}"}]->(o {id: "${criteria.memberId}"})`
34-
} else {
35-
matchClause = `MATCH (g:Group)`
36-
}
37-
38-
if (criteria.universalUID) {
35+
} else if (criteria.universalUID) {
3936
matchClause = `MATCH (g:Group)-[r:GroupContains {type: "${criteria.membershipType}"}]->(o {universalUID: "${criteria.universalUID}"})`
4037
} else {
4138
matchClause = `MATCH (g:Group)`
@@ -104,6 +101,9 @@ async function searchGroups(criteria, isAdmin = false) {
104101
const totalRes = await session.run(`${matchClause}${whereClause} RETURN COUNT(g)`)
105102
const total = totalRes.records[0].get(0).low || 0
106103

104+
console.log(`${matchClause}${whereClause} RETURN g ORDER BY g.oldId SKIP ${(criteria.page - 1) * criteria.perPage}
105+
LIMIT ${criteria.perPage}`)
106+
107107
// query page of records
108108
let result = []
109109
if (criteria.page <= Math.ceil(total / criteria.perPage)) {

0 commit comments

Comments
 (0)