Skip to content

Commit

Permalink
refactor: remove comment
Browse files Browse the repository at this point in the history
  • Loading branch information
chimpdev committed Nov 16, 2024
1 parent 227ca55 commit b4d0add
Showing 1 changed file with 1 addition and 98 deletions.
99 changes: 1 addition & 98 deletions src/lib/express/routes/api/v1/users/[user_id]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,101 +103,4 @@ export const get = [

return response.json(createdUserData);
}
];

// module.exports = {
// get: [
// param('user_id')
// .exists().withMessage('user_id is required.')
// .isNumeric().withMessage('user_id must be a number.')
// .isLength({ min: 17, max: 19 }).withMessage('user_id must be 17-19 characters long.'),
// query('svg')
// .optional()
// .isNumeric().withMessage('svg must be a number.')
// .isIn([0, 1]).withMessage('svg must be either 0 or 1.'),
// query('theme')
// .optional()
// .isString().withMessage('Theme must be a string.')
// .isIn(['light', 'dark']).withMessage('Theme must be either "light" or "dark".'),
// query('borderRadius')
// .optional()
// .isNumeric().withMessage('borderRadius must be a number.'),
// query('hideGlobalName')
// .optional()
// .isNumeric().withMessage('hideGlobalName must be a number.')
// .isIn([0, 1]).withMessage('hideGlobalName must be either 0 or 1.'),
// query('hideStatus')
// .optional()
// .isNumeric().withMessage('hideStatus must be a number.')
// .isIn([0, 1]).withMessage('hideStatus must be either 0 or 1.'),
// query('hideBadges')
// .optional()
// .isNumeric().withMessage('hideBadges must be a number.')
// .isIn([0, 1]).withMessage('hideBadges must be either 0 or 1.'),
// query('hideActivity')
// .optional()
// .isNumeric().withMessage('hideActivity must be a number.')
// .isIn([0, 1]).withMessage('hideActivity must be either 0 or 1.'),
// query('noActivityTitle')
// .optional()
// .isString().withMessage('noActivityTitle must be a string.')
// .isLength({ min: 1, max: 64 }).withMessage('noActivityTitle must be 1-64 characters long.'),
// query('noActivityMessage')
// .optional()
// .isString().withMessage('noActivityMessage must be a string.')
// .isLength({ min: 1, max: 256 }).withMessage('noActivityMessage must be 1-256 characters long.'),
// validateRequest,
// async (request, response) => {
// const { user_id } = request.params;
// const { svg } = request.query;

// const guild = client.guilds.cache.get(config.base_guild_id);
// const member = guild.members.cache.get(user_id);

// if (!member) return response.status(404).json({ error: `User ${user_id} is not being monitored by Lantern.` });

// const user = await User.findOne({ id: user_id }).lean();
// if (!user) return response.status(404).json({ error: `User ${user_id} is not being monitored by Lantern.` });

// const user_storage = await Storage.findOne({ userId: user_id });

// const createdUserData = createUserData(user_id, user_storage?.kv || {});

// if (svg == 1) {
// response.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
// response.setHeader('Content-Type', 'image/svg+xml');
// response.setHeader('content-security-policy', 'default-src \'none\'; img-src * data:; style-src \'unsafe-inline\'');

// const defaultOptions = {
// theme: 'dark',
// borderRadius: 2,
// hideGlobalName: false,
// hideStatus: false,
// hideBadges: false,
// hideActivity: false,
// noActivityTitle: 'No Activity',
// noActivityMessage: 'User is not currently doing anything.'
// };

// const svg = await createSvg(
// createdUserData,
// {
// ...defaultOptions,
// ...Object.keys(request.query).reduce((acc, key) => {
// if (key !== 'svg') return {
// ...acc,
// // If the value is 0 or 1, convert it to a number
// // Otherwise, keep it as a string (for theme or borderRadius for example)
// [key]: [0, 1].includes(parseInt(request.query[key])) ? parseInt(request.query[key]) : request.query[key]
// };
// }, {})
// }
// );

// return response.send(svg);
// }

// return response.json(createdUserData);
// }
// ]
// };
];

0 comments on commit b4d0add

Please sign in to comment.