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

Function fetchProfileDiff

models/profileDiffs.js:111–134  ·  view source on GitHub ↗
(profileDiffId)

Source from the content-addressed store, hash-verified

109 * @returns profileDiff Data
110 */
111const fetchProfileDiff = async (profileDiffId) => {
112 try {
113 const profileDiff = await profileDiffsModel.doc(profileDiffId).get();
114
115 if (!profileDiff.exists) {
116 return { profileDiffExists: false };
117 }
118
119 const profileDiffData = profileDiff.data();
120 const emailRedacted = profileDiffData.email ? obfuscate.obfuscateMail(profileDiffData.email) : "";
121 const phoneRedacted = profileDiffData.phone ? obfuscate.obfuscatePhone(profileDiffData.phone) : "";
122
123 return {
124 id: profileDiff.id,
125 profileDiffExists: true,
126 ...profileDiffData,
127 email: emailRedacted,
128 phone: phoneRedacted,
129 };
130 } catch (err) {
131 logger.error("Error retrieving profile Diff", err);
132 throw err;
133 }
134};
135
136/**
137 * Fetches the unobfuscated profileDiff data of the provided profileDiff Id

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected