diff --git a/src/index.ts b/src/index.ts index f5599c2..3a624c2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,9 +56,9 @@ async function init() { app.secretValue = (await getSecretValue(genericConfig.ConfigSecretName)) || {}; } - // if (!app.sequelizeInstance) { - // app.sequelizeInstance = await getSequelizeInstance(app); - // } + if (!app.sequelizeInstance) { + app.sequelizeInstance = await getSequelizeInstance(app); + } req.startTime = now(); req.log.info({ url: req.raw.url }, "received request"); }); diff --git a/src/routes/linkry.ts b/src/routes/linkry.ts index 0aa0d7a..74e7fbf 100644 --- a/src/routes/linkry.ts +++ b/src/routes/linkry.ts @@ -264,6 +264,7 @@ const linkryRoutes: FastifyPluginAsync = async (fastify, _options) => { throw new UnauthorizedError({ message: "Could not get user roles." }); } try { + // TODO: optimize this to use a proper query in sequelize const isAdmin = request.userRoles.has(AppRoles.LINKS_ADMIN); let filteredLinks = await ShortLinkModel.findAll(); if (!isAdmin) {