diff --git a/account/src/lib/couch-db.ts b/account/src/lib/couch-db.ts index c44ea53..485bb26 100644 --- a/account/src/lib/couch-db.ts +++ b/account/src/lib/couch-db.ts @@ -2,7 +2,7 @@ import Nano from "nano"; import { DocumentInsertResponse } from "nano"; import { getTimestamp } from "./time-utils"; import env from "./env-vars"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; const nano = Nano(env.couchDbURL); const usersDb = nano.db.use("lingdocs-users"); diff --git a/account/src/lib/mail-utils.ts b/account/src/lib/mail-utils.ts index 82ca548..182b8d5 100644 --- a/account/src/lib/mail-utils.ts +++ b/account/src/lib/mail-utils.ts @@ -1,7 +1,7 @@ import nodemailer from "nodemailer"; import inProd from "./inProd"; import env from "./env-vars"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; type Address = string | { name: string, address: string }; diff --git a/account/src/lib/password-utils.ts b/account/src/lib/password-utils.ts index 4611265..7d618d2 100644 --- a/account/src/lib/password-utils.ts +++ b/account/src/lib/password-utils.ts @@ -1,7 +1,7 @@ import { hash, compare } from "bcryptjs"; import { randomBytes } from "crypto"; import base64url from "base64url"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; const tokenSize = 24; diff --git a/account/src/lib/time-utils.ts b/account/src/lib/time-utils.ts index c9647d3..5f957d7 100644 --- a/account/src/lib/time-utils.ts +++ b/account/src/lib/time-utils.ts @@ -1,4 +1,4 @@ -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; export function getTimestamp(): T.TimeStamp { return Date.now() as T.TimeStamp; diff --git a/account/src/lib/user-utils.ts b/account/src/lib/user-utils.ts index bd33585..83e11ac 100644 --- a/account/src/lib/user-utils.ts +++ b/account/src/lib/user-utils.ts @@ -14,7 +14,7 @@ import { sendAccountUpgradeMessage, } from "../lib/mail-utils"; import { outsideProviders } from "../middleware/setup-passport"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; function getUUID(): T.UUID { return uuidv4() as T.UUID; diff --git a/account/src/middleware/setup-passport.ts b/account/src/middleware/setup-passport.ts index 2a7a67a..79b0a68 100644 --- a/account/src/middleware/setup-passport.ts +++ b/account/src/middleware/setup-passport.ts @@ -7,7 +7,6 @@ import { Strategy as TwitterStrategy } from "passport-twitter"; import { getLingdocsUser, insertLingdocsUser, - updateLastActive, updateLastLogin, updateLingdocsUser, } from "../lib/couch-db"; @@ -16,7 +15,7 @@ import { getVerifiedEmail, } from "../lib/user-utils"; import env from "../lib/env-vars"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; import { getTimestamp } from "../lib/time-utils"; export const outsideProviders: ("github" | "google" | "twitter")[] = ["github", "google", "twitter"]; diff --git a/account/src/routers/api-router.ts b/account/src/routers/api-router.ts index 08fbb0c..c5da5ff 100644 --- a/account/src/routers/api-router.ts +++ b/account/src/routers/api-router.ts @@ -17,7 +17,7 @@ import { import { upgradeUser, } from "../lib/user-utils"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; import env from "../lib/env-vars"; // TODO: ADD PROPER ERROR HANDLING THAT WILL RETURN JSON ALWAYS diff --git a/account/src/routers/auth-router.ts b/account/src/routers/auth-router.ts index 6b52ebd..91583d4 100644 --- a/account/src/routers/auth-router.ts +++ b/account/src/routers/auth-router.ts @@ -27,7 +27,7 @@ import { } from "../lib/mail-utils"; import { outsideProviders } from "../middleware/setup-passport"; import inProd from "../lib/inProd"; -import * as T from "../../../website/src/lib/account-types"; +import * as T from "../../../website/src/types/account-types"; const authRouter = (passport: PassportStatic) => { const router = Router(); diff --git a/functions/src/index.ts b/functions/src/index.ts index e334580..3633731 100644 --- a/functions/src/index.ts +++ b/functions/src/index.ts @@ -1,5 +1,5 @@ import * as functions from "firebase-functions"; -import * as FT from "../../website/src/lib/functions-types"; +import * as FT from "../../website/src/types/functions-types"; import { receiveSubmissions } from "./submissions"; import lingdocsAuth from "./middleware/lingdocs-auth"; import publish from "./publish"; diff --git a/functions/src/middleware/lingdocs-auth.ts b/functions/src/middleware/lingdocs-auth.ts index 0164216..535965a 100644 --- a/functions/src/middleware/lingdocs-auth.ts +++ b/functions/src/middleware/lingdocs-auth.ts @@ -1,8 +1,8 @@ import cors from "cors"; import fetch from "node-fetch"; import type { https, Response } from "firebase-functions"; -import * as FT from "../../../website/src/lib/functions-types"; -import type { LingdocsUser } from "../../../website/src/lib/account-types"; +import * as FT from "../../../website/src/types/functions-types"; +import type { LingdocsUser } from "../../../website/src/types/account-types"; const useCors = cors({ credentials: true, origin: /\.lingdocs\.com$/ }); @@ -15,11 +15,8 @@ interface ReqWUser extends https.Request { * */ export default function makeHandler(toRun: (req: ReqWUser, res: Response) => any | Promise) { - console.log("returning handler"); return function(reqPlain: https.Request, resPlain: Response) { - console.log("first level"); useCors(reqPlain, resPlain, async () => { - console.log("got in here"); const { req, res } = await authorize(reqPlain, resPlain); if (!req) { res.status(401).send({ ok: false, error: "unauthorized" }); diff --git a/functions/src/publish.ts b/functions/src/publish.ts index e7d6278..c048d0d 100644 --- a/functions/src/publish.ts +++ b/functions/src/publish.ts @@ -16,7 +16,7 @@ import { // } from "./word-list-maker"; import { PublishDictionaryResponse, -} from "../../website/src/lib/functions-types"; +} from "../../website/src/types/functions-types"; import { Storage } from "@google-cloud/storage"; const storage = new Storage({ projectId: "lingdocs", diff --git a/functions/src/submissions.ts b/functions/src/submissions.ts index a2616f2..b2f2bfb 100644 --- a/functions/src/submissions.ts +++ b/functions/src/submissions.ts @@ -5,7 +5,7 @@ import { dictionaryEntryBooleanFields, dictionaryEntryNumberFields, } from "@lingdocs/pashto-inflector"; -import * as FT from "../../website/src/lib/functions-types"; +import * as FT from "../../website/src/types/functions-types"; import * as functions from "firebase-functions"; const fieldsForEdit = [ diff --git a/website/src/App.tsx b/website/src/App.tsx index 02e3ed6..9018ad6 100644 --- a/website/src/App.tsx +++ b/website/src/App.tsx @@ -63,7 +63,7 @@ import { import { textBadge, } from "./lib/badges"; -import * as AT from "./lib/account-types"; +import * as AT from "./types/account-types"; import ReactGA from "react-ga"; // tslint:disable-next-line import "@fortawesome/fontawesome-free/css/all.css"; diff --git a/website/src/lib/backend-calls.ts b/website/src/lib/backend-calls.ts index 67651f1..38df3a2 100644 --- a/website/src/lib/backend-calls.ts +++ b/website/src/lib/backend-calls.ts @@ -1,5 +1,5 @@ -import * as FT from "./functions-types"; -import * as AT from "./account-types"; +import * as FT from "../types/functions-types"; +import * as AT from "../types/account-types"; type Service = "account" | "functions"; diff --git a/website/src/lib/level-management.ts b/website/src/lib/level-management.ts index 990a602..2105b6f 100644 --- a/website/src/lib/level-management.ts +++ b/website/src/lib/level-management.ts @@ -1,4 +1,4 @@ -import type { LingdocsUser } from "./account-types"; +import type { LingdocsUser } from "../types/account-types"; export function wordlistEnabled(user: LingdocsUser | undefined): boolean { if (!user) return false; diff --git a/website/src/lib/local-storage.ts b/website/src/lib/local-storage.ts index d5df6d7..7461ef6 100644 --- a/website/src/lib/local-storage.ts +++ b/website/src/lib/local-storage.ts @@ -6,7 +6,7 @@ * */ -import * as AT from "./account-types"; +import * as AT from "../types/account-types"; export const optionsLocalStorageName = "options3"; export const userLocalStorageName = "user1"; diff --git a/website/src/lib/options-reducer.ts b/website/src/lib/options-reducer.ts index b7425f2..f25f0ee 100644 --- a/website/src/lib/options-reducer.ts +++ b/website/src/lib/options-reducer.ts @@ -1,5 +1,5 @@ import { Types as IT } from "@lingdocs/pashto-inflector"; -import * as AT from "./account-types"; +import * as AT from "../types/account-types"; export function optionsReducer(options: Options, action: OptionsAction): Options { if (action.type === "toggleLanguage") { diff --git a/website/src/lib/pouch-dbs.ts b/website/src/lib/pouch-dbs.ts index 5406aca..4f8ab3b 100644 --- a/website/src/lib/pouch-dbs.ts +++ b/website/src/lib/pouch-dbs.ts @@ -1,6 +1,6 @@ import PouchDB from "pouchdb"; -import * as AT from "./account-types"; -import * as FT from "./functions-types"; +import * as AT from "../types/account-types"; +import * as FT from "../types/functions-types"; type LocalDbType = "submissions" | "wordlist" | "reviewTasks"; diff --git a/website/src/lib/submissions.ts b/website/src/lib/submissions.ts index 65afdf4..fe259b3 100644 --- a/website/src/lib/submissions.ts +++ b/website/src/lib/submissions.ts @@ -1,5 +1,5 @@ -import * as FT from "./functions-types"; -import * as AT from "./account-types"; +import * as FT from "../types/functions-types"; +import * as AT from "../types/account-types"; import { postSubmissions, } from "./backend-calls"; diff --git a/website/src/screens/Account.tsx b/website/src/screens/Account.tsx index b03594f..4faa871 100644 --- a/website/src/screens/Account.tsx +++ b/website/src/screens/Account.tsx @@ -11,7 +11,7 @@ import { } from "../lib/backend-calls"; import LoadingElipses from "../components/LoadingElipses"; import { Helmet } from "react-helmet"; -import * as AT from "../lib/account-types"; +import * as AT from "../types/account-types"; const providers: ("google" | "twitter" | "github")[] = ["google", "twitter", "github"]; diff --git a/website/src/screens/EntryEditor.tsx b/website/src/screens/EntryEditor.tsx index 4814ae1..cb15b85 100644 --- a/website/src/screens/EntryEditor.tsx +++ b/website/src/screens/EntryEditor.tsx @@ -18,7 +18,7 @@ import { validateEntry, } from "@lingdocs/pashto-inflector"; import Entry from "../components/Entry"; -import * as FT from "../lib/functions-types"; +import * as FT from "../types/functions-types"; import { submissionBase, addSubmission, diff --git a/website/src/screens/Results.tsx b/website/src/screens/Results.tsx index 150a34d..ba566db 100644 --- a/website/src/screens/Results.tsx +++ b/website/src/screens/Results.tsx @@ -7,7 +7,7 @@ */ import { useEffect, useState } from "react"; -import * as FT from "../lib/functions-types"; +import * as FT from "../types/functions-types"; import { submissionBase, addSubmission, diff --git a/website/src/screens/ReviewTasks.tsx b/website/src/screens/ReviewTasks.tsx index 4de14f2..f669f17 100644 --- a/website/src/screens/ReviewTasks.tsx +++ b/website/src/screens/ReviewTasks.tsx @@ -1,6 +1,6 @@ import Entry from "../components/Entry"; import { Link } from "react-router-dom"; -import * as FT from "../lib/functions-types"; +import * as FT from "../types/functions-types"; import { deleteFromLocalDb, } from "../lib/pouch-dbs"; diff --git a/website/src/types.d.ts b/website/src/types.d.ts index 2b67f91..ee4b2f4 100644 --- a/website/src/types.d.ts +++ b/website/src/types.d.ts @@ -18,7 +18,7 @@ type SearchBarPosition = "top" | "bottom"; type WordlistMode = "browse" | "review"; type TextOptionsRecord = { - lastModified: import("./lib/account-types").TimeStamp, + lastModified: import("./types/account-types").TimeStamp, textOptions: import("@lingdocs/pashto-inflector").Types.TextOptions, }; @@ -43,9 +43,9 @@ type State = { isolatedEntry: import("@lingdocs/pashto-inflector").Types.DictionaryEntry | undefined, results: import("@lingdocs/pashto-inflector").Types.DictionaryEntry[], wordlist: WordlistWord[], - reviewTasks: import("./lib/functions-types").ReviewTask[], + reviewTasks: import("./types/functions-types").ReviewTask[], dictionaryInfo: import("@lingdocs/pashto-inflector").Types.DictionaryInfo | undefined, - user: undefined | import("./lib/account-types").LingdocsUser, + user: undefined | import("./types/account-types").LingdocsUser, } type OptionsAction = { diff --git a/website/src/lib/account-types.ts b/website/src/types/account-types.ts similarity index 100% rename from website/src/lib/account-types.ts rename to website/src/types/account-types.ts diff --git a/website/src/lib/functions-types.ts b/website/src/types/functions-types.ts similarity index 100% rename from website/src/lib/functions-types.ts rename to website/src/types/functions-types.ts