dev #2960
Updated by Zahid Hassan 8 months ago
### Summary This enhances the **user listing** endpoint with robust * Update get user info api to handle new filtering and query improvements. It introduces role-based and verification-based filters, supports combining multiple filters, aligns the count query with the same filtering logic, and completes the selected-fields projection. It also replaces raw SQL predicates with Drizzle’s helpers for safer, clearer queries. ### Changes - **Filtering** - Added filtering by `role` and `isVerified`. - Implemented **multi-filtering** support so filters can be combined (e.g., role + verification + search). - **Query Shape** - Ensured that when custom `fields` are requested, all necessary joined fields are included to avoid partial/undefined results. - **Count Query** - Updated count logic to mirror the same filters as the data query for accurate pagination totals. - **Implementation** - Replaced raw SQL fragments with Drizzle utilities (`and`, `eq`, `ilike`, `desc`) for better parameter binding and readability. ### Example Usage **Query Parameters** ```javascript { "search": "development", "fields": "id,userName,profileImage,isVerified,createdAt,roleId" "role": "admin", // admin/user/owner "isVerified": "true", // true/false "sort": "desc" // desc/asc } ``` **Expected Response** ```javascript { "success": true, "data": [ { "id": 1, "userName": "development", "profileImage": "https://cdn.onlinegradecalculator.io/aiaxio-images/development-team.png", "isVerified": true, "createdAt": "2025-08-07T07:15:53.454Z", "roleId": 1 } ], "pagination": { "offset": 0, "limit": 10, "total": 1, "currentCount": 1 }, "_links": { "self": { "href": "http://localhost:8000/api/user-management/users?offset=0&limit=10&search=development" }, "next": null, "previous": null, "collection": { "href": "http://localhost:8000/api/user-management/users" } } } ```