(req, res)
| 1082 | logger.error(`Error while updating the archived role: ${error}`); |
| 1083 | throw Error(INTERNAL_SERVER_ERROR); |
| 1084 | } |
| 1085 | }; |
| 1086 | |
| 1087 | async function usersPatchHandler(req, res) { |
| 1088 | try { |
| 1089 | const { action } = req.body; |
| 1090 | let response; |
| 1091 | |
| 1092 | if (action === USERS_PATCH_HANDLER_ACTIONS.NON_VERFIED_DISCORD_USERS) { |
| 1093 | const data = await nonVerifiedDiscordUsers(); |
| 1094 | response = data; |
| 1095 | } |
| 1096 | |
| 1097 | if (action === USERS_PATCH_HANDLER_ACTIONS.ARCHIVE_USERS) { |
| 1098 | const debugQuery = req.query.debug?.toLowerCase(); |
| 1099 | const data = await archiveUserIfNotInDiscord(); |
| 1100 | |
| 1101 | if (debugQuery === "true") { |
| 1102 | data.summary.updatedUserDetails = data.summary.updatedUserDetails.slice(-3); |
| 1103 | response = data; |
| 1104 | } else { |
| 1105 | delete data.summary.updatedUserDetails; |
| 1106 | delete data.summary.failedUserDetails; |
| 1107 | response = data; |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | return res.status(200).json(response); |
| 1112 | } catch (error) { |
| 1113 | logger.error("Error while handling the users common patch route:", error); |
| 1114 | return res.boom.badImplementation(INTERNAL_SERVER_ERROR); |
| 1115 | } |
| 1116 | } |
nothing calls this directly
no test coverage detected