diff --git a/app/package.json b/app/package.json
index aac9c9b..accb71c 100644
--- a/app/package.json
+++ b/app/package.json
@@ -5,13 +5,10 @@
"license": "UNLICENSED",
"scripts": {
"dev": "cross-env NODE_OPTIONS='--inspect' next dev",
- "db": "yarn prisma generate && yarn prisma db push",
- "build": "yarn prisma generate && next build",
+ "build": "next build",
"start": "next start"
},
"dependencies": {
- "@prisma/client": "^4.2.1",
- "better-react-mathjax": "^2.0.2",
"cookie": "^0.5.0",
"mongoose": "^6.0.12",
"next": "^12.0.3",
@@ -33,7 +30,6 @@
"eslint-config-next": "11.1.2",
"js-cookie": "^3.0.1",
"postcss": "^8.4.14",
- "prisma": "^4.2.1",
"tailwindcss": "^3.0.24",
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
diff --git a/app/src/components/MathText.tsx b/app/src/components/MathText.tsx
deleted file mode 100644
index 2087dfb..0000000
--- a/app/src/components/MathText.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { MathJax, MathJaxContext } from "better-react-mathjax";
-
-const config = {
- loader: { load: ["[tex]/html"] },
- tex: {
- packages: { "[+]": ["html"] },
- inlineMath: [
- ["$", "$"],
- ["\\(", "\\)"]
- ],
- displayMath: [
- ["$$", "$$"],
- ["\\[", "\\]"]
- ]
- }
-};
-
-export const MathText = ({children, inline=false, dynamic=false, className=''}) => {
- return (
-
- {children}
-
- );
-}
\ No newline at end of file
diff --git a/app/src/lib/api/authorize.ts b/app/src/lib/api/authorize.ts
deleted file mode 100644
index 3df9a67..0000000
--- a/app/src/lib/api/authorize.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { PrismaClient } from '@prisma/client';
-import { NextApiRequest, NextApiResponse } from 'next';
-import {db} from '@/lib/db/db'
-
-export const authorize = async (req: NextApiRequest, res: NextApiResponse, admin=false) => {
- let authorization = null
- if(!authorization) authorization = req.headers.authorization
- if(!authorization && req.cookies.auth) {
- const auth = JSON.parse(req.cookies.auth)
- if(auth) authorization = `Bearer ${auth.access_token}`
- }
- req.headers.authorization = authorization
-
- const profileRes = await fetch('https://ion.tjhsst.edu/api/profile', {headers: {
- 'Authorization': authorization
- }})
- let profileBody = await profileRes.json()
- let authorized = Boolean(profileBody.id)
-
- let user = await db.user.findFirst({
- where: {
- ionId: String(profileBody.id)
- }
- })
-
- if(admin && authorized && !user.admin) authorized = false;
-
- return {
- authorized,
- user,
- profileBody
- }
-}
\ No newline at end of file
diff --git a/app/src/lib/db/db.ts b/app/src/lib/db/db.ts
deleted file mode 100644
index ada6854..0000000
--- a/app/src/lib/db/db.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { PrismaClient } from "@prisma/client";
-
-declare global {
- var __globalDb: PrismaClient | undefined
-}
-
-const db = global.__globalDb || new PrismaClient()
-if(process.env.NODE_ENV !== 'production') global.__globalDb = db
-
-export {db};
\ No newline at end of file
diff --git a/app/src/pages/api/auth/authorize.ts b/app/src/pages/api/auth/authorize.ts
deleted file mode 100644
index 94fdd1e..0000000
--- a/app/src/pages/api/auth/authorize.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { authorize } from '@/lib/api/authorize';
-import { setCookie } from '@/lib/api/setCookie';
-import { db } from '@/lib/db/db';
-import { NextApiRequest, NextApiResponse } from 'next';
-
-const handler = async (req: NextApiRequest, res: NextApiResponse) => {
- const {authorized, user} = await authorize(req, res)
- res.status(200).json({user})
-}
-
-export default handler;
\ No newline at end of file
diff --git a/app/src/pages/api/debug/index.ts b/app/src/pages/api/debug/index.ts
deleted file mode 100644
index 36b06a3..0000000
--- a/app/src/pages/api/debug/index.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-import { authorize } from '@/lib/api/authorize';
-import { db } from '@/lib/db/db';
-import { NextApiRequest, NextApiResponse } from 'next';
-
-const handler = async (req: NextApiRequest, res: NextApiResponse) => {
- try {
- const { authorized, user } = await authorize(req, res, false)
- if (!authorized) return res.status(401).send(null)
- const hm = await db.application.findMany({ where: {
- selection: {
- name: "HMMT"
- }
- },
- select: {
- author: {
- select: {
- ionUsername: true
- }
- },
- index: true
- }})
-
- const hmp = await db.application.findMany({ where: {
- selection: {
- name: "HMMT Proof"
- }
- },
- select: {
- author: {
- select: {
- ionUsername: true
- }
- },
- index: true,
-
- }})
-
- let o = {}
- for(let s of hm) {
- let k = s.author.ionUsername
- if(o[k] == undefined || o[k] == null) o[k] = {name: k, hm: 0, hmp: 0}
- o[k]["hm"] = s.index
- }
- for(let s of hmp) {
- let k = s.author.ionUsername
- if(o[k] == undefined || o[k] == null) o[k] = {name: k, hm: 0, hmp: 0}
- o[k]["hmp"] = s.index
- }
-
- // let r = l.map(m => [m.author.ionUsername, m.index])
- o = Object.entries(o).map(m => m[1])
- let s1 = o.map(m => m.name).join('\n')
- let s2 = o.map(m => m.hm).join('\n')
- let s3 = o.map(m => m.hmp).join('\n')
-
- if (req.method == 'GET') {
- return res.status(200).send([s1, s2, s3].join('\n\n\n'))
- }
- } catch (e) {
- return res.status(400).json({
- message: e.message
- })
- }
-
- return res.status(400).send(null)
-}
-
-export default handler;
diff --git a/app/src/pages/api/debug/index.txt b/app/src/pages/api/debug/index.txt
deleted file mode 100644
index 36b06a3..0000000
--- a/app/src/pages/api/debug/index.txt
+++ /dev/null
@@ -1,68 +0,0 @@
-import { authorize } from '@/lib/api/authorize';
-import { db } from '@/lib/db/db';
-import { NextApiRequest, NextApiResponse } from 'next';
-
-const handler = async (req: NextApiRequest, res: NextApiResponse) => {
- try {
- const { authorized, user } = await authorize(req, res, false)
- if (!authorized) return res.status(401).send(null)
- const hm = await db.application.findMany({ where: {
- selection: {
- name: "HMMT"
- }
- },
- select: {
- author: {
- select: {
- ionUsername: true
- }
- },
- index: true
- }})
-
- const hmp = await db.application.findMany({ where: {
- selection: {
- name: "HMMT Proof"
- }
- },
- select: {
- author: {
- select: {
- ionUsername: true
- }
- },
- index: true,
-
- }})
-
- let o = {}
- for(let s of hm) {
- let k = s.author.ionUsername
- if(o[k] == undefined || o[k] == null) o[k] = {name: k, hm: 0, hmp: 0}
- o[k]["hm"] = s.index
- }
- for(let s of hmp) {
- let k = s.author.ionUsername
- if(o[k] == undefined || o[k] == null) o[k] = {name: k, hm: 0, hmp: 0}
- o[k]["hmp"] = s.index
- }
-
- // let r = l.map(m => [m.author.ionUsername, m.index])
- o = Object.entries(o).map(m => m[1])
- let s1 = o.map(m => m.name).join('\n')
- let s2 = o.map(m => m.hm).join('\n')
- let s3 = o.map(m => m.hmp).join('\n')
-
- if (req.method == 'GET') {
- return res.status(200).send([s1, s2, s3].join('\n\n\n'))
- }
- } catch (e) {
- return res.status(400).json({
- message: e.message
- })
- }
-
- return res.status(400).send(null)
-}
-
-export default handler;
diff --git a/app/src/pages/index.tsx b/app/src/pages/index.tsx
index 4b04cc0..03f38d4 100644
--- a/app/src/pages/index.tsx
+++ b/app/src/pages/index.tsx
@@ -23,7 +23,7 @@ const Home: NextPage = ({ officers }) => {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- 'Authorization': `Bearer ${session.token.sub}`
+ 'Authorization': `Bearer ${session['token'].sub}`
},
body: JSON.stringify({
phone: input.phone
diff --git a/app/yarn.lock b/app/yarn.lock
index a5c0ca8..a42a6d2 100644
--- a/app/yarn.lock
+++ b/app/yarn.lock
@@ -176,23 +176,6 @@
resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.0.4.tgz#4e02bb248402ff6c5c024e23a68438e2b0e69d67"
integrity sha512-003xWiCuvePbLaPHT+CRuaV4GlyCAVm6XYSbBZDHoWZGn1mNkVKFaDbGJjjxmEFvizUwlCoM6O18FCBMMky2zQ==
-"@prisma/client@^4.2.1":
- version "4.2.1"
- resolved "https://registry.npmjs.org/@prisma/client/-/client-4.2.1.tgz"
- integrity sha512-PZBkY60+k5oix+e6IUfl3ub8TbRLNsPLdfWrdy2eh80WcHTaT+/UfvXf/B7gXedH7FRtbPFHZXk1hZenJiJZFQ==
- dependencies:
- "@prisma/engines-version" "4.2.0-33.2920a97877e12e055c1333079b8d19cee7f33826"
-
-"@prisma/engines-version@4.2.0-33.2920a97877e12e055c1333079b8d19cee7f33826":
- version "4.2.0-33.2920a97877e12e055c1333079b8d19cee7f33826"
- resolved "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-4.2.0-33.2920a97877e12e055c1333079b8d19cee7f33826.tgz"
- integrity sha512-tktkqdiwqE4QhmE088boPt+FwPj1Jub/zk+5F6sEfcRHzO5yz9jyMD5HFVtiwxZPLx/8Xg9ElnuTi8E5lWVQFQ==
-
-"@prisma/engines@4.2.1":
- version "4.2.1"
- resolved "https://registry.npmjs.org/@prisma/engines/-/engines-4.2.1.tgz"
- integrity sha512-0KqBwREUOjBiHwITsQzw2DWfLHjntvbqzGRawj4sBMnIiL5CXwyDUKeHOwXzKMtNr1rEjxEsypM14g0CzLRK3g==
-
"@rushstack/eslint-patch@^1.0.6":
version "1.0.8"
resolved "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.0.8.tgz"
@@ -486,13 +469,6 @@ base64-js@^1.3.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
-better-react-mathjax@^2.0.2:
- version "2.0.2"
- resolved "https://registry.npmjs.org/better-react-mathjax/-/better-react-mathjax-2.0.2.tgz"
- integrity sha512-GSU/c+LhnMVClkduWpO7fr9Ac2KMOxWs/ePwdFgpffidK3Zg9Vyd3scO6XZbd2QgMUcKnpjEG6hE1sM/EFekSQ==
- dependencies:
- mathjax-full "^3.2.2"
-
binary-extensions@^2.0.0:
version "2.2.0"
resolved "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz"
@@ -597,11 +573,6 @@ color-name@^1.1.4, color-name@~1.1.4:
resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
-commander@9.2.0:
- version "9.2.0"
- resolved "https://registry.npmjs.org/commander/-/commander-9.2.0.tgz"
- integrity sha512-e2i4wANQiSXgnrBlIatyHtP1odfUp0BbV5Y5nEGbxtIrStkEOAAzCUirvLBNXHLr7kwLvJl6V+4V3XV9x7Wd9w==
-
concat-map@0.0.1:
version "0.0.1"
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
@@ -981,11 +952,6 @@ eslint@8.1.0:
text-table "^0.2.0"
v8-compile-cache "^2.0.3"
-esm@^3.2.25:
- version "3.2.25"
- resolved "https://registry.npmjs.org/esm/-/esm-3.2.25.tgz"
- integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA==
-
espree@^9.0.0:
version "9.0.0"
resolved "https://registry.npmjs.org/espree/-/espree-9.0.0.tgz"
@@ -1483,16 +1449,6 @@ make-error@^1.1.1:
resolved "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
-mathjax-full@^3.2.2:
- version "3.2.2"
- resolved "https://registry.npmjs.org/mathjax-full/-/mathjax-full-3.2.2.tgz"
- integrity sha512-+LfG9Fik+OuI8SLwsiR02IVdjcnRCy5MufYLi0C3TdMT56L/pjB0alMVGgoWJF8pN9Rc7FESycZB9BMNWIid5w==
- dependencies:
- esm "^3.2.25"
- mhchemparser "^4.1.0"
- mj-context-menu "^0.6.1"
- speech-rule-engine "^4.0.6"
-
memory-pager@^1.0.2:
version "1.5.0"
resolved "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz"
@@ -1503,11 +1459,6 @@ merge2@^1.3.0:
resolved "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
-mhchemparser@^4.1.0:
- version "4.1.1"
- resolved "https://registry.npmjs.org/mhchemparser/-/mhchemparser-4.1.1.tgz"
- integrity sha512-R75CUN6O6e1t8bgailrF1qPq+HhVeFTM3XQ0uzI+mXTybmphy3b6h4NbLOYhemViQ3lUs+6CKRkC3Ws1TlYREA==
-
micromatch@^4.0.4:
version "4.0.4"
resolved "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz"
@@ -1528,11 +1479,6 @@ minimist@^1.1.1, minimist@^1.2.0:
resolved "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
-mj-context-menu@^0.6.1:
- version "0.6.1"
- resolved "https://registry.npmjs.org/mj-context-menu/-/mj-context-menu-0.6.1.tgz"
- integrity sha512-7NO5s6n10TIV96d4g2uDpG7ZDpIhMh0QNfGdJw/W47JswFcosz457wqz/b5sAKvl12sxINGFCn80NZHKwxQEXA==
-
mongodb-connection-string-url@^2.0.0:
version "2.1.0"
resolved "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-2.1.0.tgz"
@@ -1906,13 +1852,6 @@ pretty-format@^3.8.0:
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-3.8.0.tgz#bfbed56d5e9a776645f4b1ff7aa1a3ac4fa3c385"
integrity sha512-WuxUnVtlWL1OfZFQFuqvnvs6MiAGk9UNsBostyBOB0Is9wb5uRESevA6rnl/rkksXaGX3GzZhPup5d6Vp1nFew==
-prisma@^4.2.1:
- version "4.2.1"
- resolved "https://registry.npmjs.org/prisma/-/prisma-4.2.1.tgz"
- integrity sha512-HuYqnTDgH8atjPGtYmY0Ql9XrrJnfW7daG1PtAJRW0E6gJxc50lY3vrIDn0yjMR3TvRlypjTcspQX8DT+xD4Sg==
- dependencies:
- "@prisma/engines" "4.2.1"
-
progress@^2.0.0:
version "2.0.3"
resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz"
@@ -2131,15 +2070,6 @@ sparse-bitfield@^3.0.3:
dependencies:
memory-pager "^1.0.2"
-speech-rule-engine@^4.0.6:
- version "4.0.7"
- resolved "https://registry.npmjs.org/speech-rule-engine/-/speech-rule-engine-4.0.7.tgz"
- integrity sha512-sJrL3/wHzNwJRLBdf6CjJWIlxC04iYKkyXvYSVsWVOiC2DSkHmxsqOhEeMsBA9XK+CHuNcsdkbFDnoUfAsmp9g==
- dependencies:
- commander "9.2.0"
- wicked-good-xpath "1.3.0"
- xmldom-sre "0.1.31"
-
sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz"
@@ -2398,11 +2328,6 @@ which@^2.0.1:
dependencies:
isexe "^2.0.0"
-wicked-good-xpath@1.3.0:
- version "1.3.0"
- resolved "https://registry.npmjs.org/wicked-good-xpath/-/wicked-good-xpath-1.3.0.tgz"
- integrity sha512-Gd9+TUn5nXdwj/hFsPVx5cuHHiF5Bwuc30jZ4+ronF1qHK5O7HD0sgmXWSEgwKquT3ClLoKPVbO6qGwVwLzvAw==
-
word-wrap@^1.2.3:
version "1.2.3"
resolved "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz"
@@ -2413,11 +2338,6 @@ wrappy@1:
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
integrity "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
-xmldom-sre@0.1.31:
- version "0.1.31"
- resolved "https://registry.npmjs.org/xmldom-sre/-/xmldom-sre-0.1.31.tgz"
- integrity sha512-f9s+fUkX04BxQf+7mMWAp5zk61pciie+fFLC9hX9UVvCeJQfNHRHXpeo5MPcR0EUf57PYLdt+ZO4f3Ipk2oZUw==
-
xtend@^4.0.2:
version "4.0.2"
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz"