(req, res)
| 108 | }); |
| 109 | |
| 110 | if (state) { |
| 111 | allUserStatus = allUserStatus.filter((entry) => entry.currentStatus?.state === state); |
| 112 | } |
| 113 | |
| 114 | return res.json({ |
| 115 | message: "All User Status found successfully.", |
| 116 | totalUserStatus: allUserStatus.length, |
| 117 | allUserStatus, |
| 118 | links: { |
| 119 | next: nextId ? getPaginationLink(req.query, "next", nextId, "/users/status") : "", |
| 120 | prev: prevId ? getPaginationLink(req.query, "prev", prevId, "/users/status") : "", |
| 121 | }, |
| 122 | }); |
| 123 | } catch (err) { |
| 124 | logger.error(`Error while fetching all the User Status: ${err}`); |
| 125 | return res.boom.badImplementation(INTERNAL_SERVER_ERROR); |
| 126 | } |
| 127 | }; |
| 128 | |
| 129 | /** |
| 130 | * Update User Status |
| 131 | * |
| 132 | * @param req {Object} - Express request object |
| 133 | * @param res {Object} - Express response object |
| 134 | */ |
| 135 | const updateUserStatus = async (req, res) => { |
| 136 | try { |
| 137 | const userId = getUserIdBasedOnRoute(req); |
| 138 | const userDoc = await usersCollection.doc(userId).get(); |
| 139 | if (!userDoc.exists) { |
| 140 | return res.boom.notFound("The User doesn't exist."); |
| 141 | } |
| 142 |
no test coverage detected