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

Function fetchUserForKeyValue

models/users.js:926–943  ·  view source on GitHub ↗
(documentKey, value)

Source from the content-addressed store, hash-verified

924
925 // Commit all batches concurrently
926 await Promise.all(batches.map((batch) => batch.commit()));
927 } catch (err) {
928 logger.error(`Error while deleting tokens field: ${err}`);
929 throw err;
930 }
931};
932
933const getUsersByRole = async (role) => {
934 try {
935 const usersRef = await userModel.where(`roles.${role}`, "==", true).get();
936 const users = [];
937 usersRef.docs.forEach((user) => {
938 const userData = user.data();
939 users.push({
940 ...userData,
941 id: user.id,
942 });
943 });
944 return users;
945 } catch (err) {
946 logger.error(`Fetching users with role: ${role} exitted with an error: ${err}`);

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected