MCPcopy Create free account
hub / github.com/RealDevSquad/website-backend / updateUserStatus

Function updateUserStatus

controllers/userStatus.js:110–139  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

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 */
135const 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

Callers 2

updateUserStatusesFunction · 0.70

Calls 2

getUserIdBasedOnRouteFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected