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

Function retrieveUserDeviceInfo

models/qrCodeAuth.js:51–76  ·  view source on GitHub ↗
({ deviceId, userId })

Source from the content-addressed store, hash-verified

49};
50
51const retrieveUserDeviceInfo = async ({ deviceId, userId }) => {
52 let queryDocument;
53 try {
54 if (deviceId) {
55 queryDocument = await QrCodeAuthModel.where("device_id", "==", deviceId).get();
56 } else if (userId) {
57 queryDocument = await QrCodeAuthModel.where("user_id", "==", userId)
58 .where("authorization_status", "==", "NOT_INIT")
59 .get();
60 }
61 const userData = queryDocument?.docs[0];
62
63 if (!userData) {
64 return {
65 userExists: false,
66 };
67 }
68 return {
69 userExists: true,
70 data: userData.data(),
71 };
72 } catch (err) {
73 logger.error("Error in retrieving user device info", err);
74 throw err;
75 }
76};
77
78module.exports = {
79 updateStatus,

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected