| 182 | */ |
| 183 | |
| 184 | const updateProfileDiff = async (profileDiffData, profileId) => { |
| 185 | try { |
| 186 | const profileDiff = await profileDiffsModel.doc(profileId).get(); |
| 187 | const data = profileDiff.data(); |
| 188 | if (!data) return { notFound: true }; |
| 189 | |
| 190 | await profileDiffsModel.doc(profileId).set({ |
| 191 | ...data, |
| 192 | ...profileDiffData, |
| 193 | }); |
| 194 | |
| 195 | return { id: profileDiff.id, userId: data.userId }; |
| 196 | } catch (err) { |
| 197 | logger.error("Error in updating profile diff", err); |
| 198 | throw err; |
| 199 | } |
| 200 | }; |
| 201 | |
| 202 | module.exports = { |
| 203 | fetchProfileDiffs, |