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

Function getUserStatus

models/userStatus.js:154–169  ·  view source on GitHub ↗
(userId)

Source from the content-addressed store, hash-verified

152 * @params userId {string} : id of the user
153 * @returns {Promise<userStatusModel|Object>} : returns the userStatus of a single user
154 */
155const getUserStatus = async (userId) => {
156 try {
157 const userStatusDocs = await userStatusModel.where("userId", "==", userId).limit(1).get();
158 const [userStatusDoc] = userStatusDocs.docs;
159 if (userStatusDoc) {
160 const id = userStatusDoc.id;
161 const data = userStatusDoc.data();
162 return { id, data, userStatusExists: true };
163 } else {
164 return { id: null, data: null, userStatusExists: false };
165 }
166 } catch (error) {
167 logger.error(`Error in fetching the User Status Document. Reason - ${error}`);
168 throw error;
169 }
170};
171
172/**

Calls 1

getMethod · 0.80

Tested by

no test coverage detected