chore: Typescript database models (#2886)

closes #2798
This commit is contained in:
Tom Moor
2022-01-06 18:24:28 -08:00
committed by GitHub
parent d3cbf250e6
commit b20a341f0c
207 changed files with 5624 additions and 5315 deletions

View File

@@ -6,7 +6,6 @@ import Router from "koa-router";
import { AuthenticationError } from "@server/errors";
import auth from "@server/middlewares/authentication";
import { Collection, Team, View } from "@server/models";
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'providers' implicitly has type 'any[]' i... Remove this comment to see the full error message
import providers from "./providers";
const app = new Koa();
@@ -14,7 +13,6 @@ const router = new Router();
router.use(passport.initialize());
// dynamically load available authentication provider routes
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'providers' implicitly has an 'any[]' typ... Remove this comment to see the full error message
providers.forEach((provider) => {
if (provider.enabled) {
router.use("/", provider.router.routes());
@@ -22,7 +20,7 @@ providers.forEach((provider) => {
});
router.get("/redirect", auth(), async (ctx) => {
const user = ctx.state.user;
const { user } = ctx.state;
const jwtToken = user.getJwtToken();
if (jwtToken === ctx.params.token) {
@@ -45,10 +43,11 @@ router.get("/redirect", auth(), async (ctx) => {
}),
]);
const hasViewedDocuments = !!view;
ctx.redirect(
!hasViewedDocuments && collection
? `${team.url}${collection.url}`
: `${team.url}/home`
? `${team!.url}${collection.url}`
: `${team!.url}/home`
);
});