Skip to content

Commit 4d72feb

Browse files
authored
Merge branch 'staging' into feature/client-groups-endpoint
2 parents 5cedd5b + 8de680d commit 4d72feb

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

.github/workflows/azure-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ jobs:
4444
npm run build --if-present
4545
npm run test --if-present
4646
47-
- name: Clean build artifacts and dependencies
48-
run: rm -rf dist node_modules
47+
- name: Clean node_modules before packaging
48+
run: rm -rf node_modules
4949

5050
- name: Zip artifact for deployment
5151
run: zip -r release.zip .

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"scripts": {
99
"build": "tsc && npm run sentry:sourcemaps",
10-
"start": "node dist/index.js",
10+
"start": "node dist/src/index.js",
1111
"dev": "tsx watch src/index.ts",
1212
"lint": "eslint src/**/*.{ts,tsx}",
1313
"lint:fix": "eslint src/**/*.{ts,tsx} --fix",

src/controllers/userController.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,20 @@ import Organisation from '../models/organisationModel.js';
1313
// @route GET /api/users
1414
// @access Private
1515
const getUsers = asyncHandler(async (req: Request, res: Response) => {
16-
const {
16+
const {
1717
search,
1818
role,
1919
location,
2020
locations, // New: comma-separated list of locations for CityAdmin filtering
21-
page = 1,
21+
page = 1,
2222
limit = 9,
2323
sortBy = 'DocumentModifiedDate',
2424
sortOrder = 'desc'
2525
} = req.query;
2626

27+
// DEBUG: Log incoming search parameters
28+
console.log('[DEBUG getUsers] Request params:', { search, role, location, locations, page, limit });
29+
2730
const query: any = {};
2831
const conditions: any[] = [];
2932

@@ -94,20 +97,26 @@ const getUsers = asyncHandler(async (req: Request, res: Response) => {
9497
if (conditions.length > 0) {
9598
query.$and = conditions;
9699
}
97-
100+
101+
// DEBUG: Log the constructed MongoDB query
102+
console.log('[DEBUG getUsers] MongoDB query:', JSON.stringify(query, null, 2));
103+
98104
// Pagination
99105
const skip = (Number(page) - 1) * Number(limit);
100-
106+
101107
// Sort options
102108
const sortOptions: any = {};
103109
sortOptions[sortBy as string] = sortOrder === 'desc' ? -1 : 1;
104-
110+
105111
const dbUsers = await User.find(query)
106112
.sort(sortOptions)
107113
.skip(skip)
108114
.limit(Number(limit))
109115
.lean();
110116

117+
// DEBUG: Log results count
118+
console.log('[DEBUG getUsers] Results count:', dbUsers.length);
119+
111120
// Decrypt emails for all users
112121
const users = dbUsers.map(user => ({
113122
...user,

0 commit comments

Comments
 (0)