Skip to content

Commit

Permalink
Merge pull request #278 from HackBeanpot/LD-upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade Core Application Portal Dependencies
  • Loading branch information
Lucas-Dunker authored Sep 20, 2024
2 parents 528da95 + 248ada5 commit 9ec808a
Show file tree
Hide file tree
Showing 9 changed files with 3,382 additions and 3,061 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.12.0
11 changes: 5 additions & 6 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
12 changes: 7 additions & 5 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode: true,
serverActions: {
bodySizeLimit: '3mb'
}
}
};

module.exports = nextConfig;
23 changes: 15 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "application-portal",
"version": "0.1.0",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -19,34 +19,38 @@
"-": "^0.0.1",
"@google-cloud/storage": "^6.5.2",
"@next-auth/mongodb-adapter": "0.0.2-next.281",
"@rollbar/react": "^0.8.0",
"@rollbar/react": "^0.12.0-beta",
"antd": "^4.18.2",
"axios": "^0.21.1",
"check-files": "^0.0.2",
"file-saver": "^2.0.5",
"joi": "^17.4.2",
"mongodb": "^4.1.2",
"next": "^11.0.1",
"next-auth": "4.0.0-beta.4",
"next": "13",
"next-auth": "4",
"nodemailer": "^6.7.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"rollbar": "^2.24.0",
"prop-types": "^15.7.2",
"react": "18.2.0",
"react-dom": "18.2.0",
"rollbar": "^2.26.4",
"sass": "^1.42.1",
"swr": "^1.1.2-beta.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "12.1.2",
"@types/file-saver": "^2.0.4",
"@types/jest": "^27.0.1",
"@types/node": "*",
"@types/nodemailer": "^6.4.4",
"@types/react": "17.0.13",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.0.0",
"babel-jest": "^29.1.2",
"cypress": "^9.2.0",
"eslint": "^7.30.0",
"eslint-config-next": "^11.0.1",
"eslint-config-next": "13",
"eslint-config-prettier": "^8.3.0",
"husky": ">=6",
"identity-obj-proxy": "^3.0.0",
Expand Down Expand Up @@ -80,5 +84,8 @@
}
}
}
},
"engines": {
"node": "^18.12.0"
}
}
5 changes: 1 addition & 4 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ type AppProps = NextAppProps & {
session?: Session | null;
};

const App: React.FC<AppProps> = ({
Component,
pageProps: { session, ...pageProps },
}) => {
const App: React.FC<AppProps> = ({ Component, pageProps: { session, ...pageProps } }) => {
// Provider instantiates Rollbar client instance handling any uncaught errors or unhandled promises in the browser
// ErrorBoundary catches all React errors in the tree below and logs them to Rollbar
return (
Expand Down
4 changes: 2 additions & 2 deletions pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const authHandler = async (req: NextApiRequest, res: NextApiResponse) => {
callbacks: {
async signIn({ user, email }) {
// can implement banned users if needed
if (email.verificationRequest) {
if (email?.verificationRequest) {
// don't create user on validation request, only on sign-in
return true;
}
Expand Down Expand Up @@ -105,7 +105,7 @@ async function sendVerificationRequest({
await transport.sendMail({
to: email,
from,
subject: `Log into HBP Application Portal @ ${host}`, // TODO: What do we actually want here
subject: `Log into HBP Application Portal @ ${host}`,
text: text({ url, host }),
html: html({ url, host, email }),
});
Expand Down
26 changes: 11 additions & 15 deletions pages/api/v1/applicants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ const getHandler: NextApiHandler = async (req, res) => {
const params = req.query;

// assume page is 1 indexed
const page = Number(params?.page ?? 1);
const pageSize = Number(params?.pageSize ?? 10);
const filters = parseFilters(params?.filters);
const sort = parseSort(params?.sorter);
const page = Number(params.page ?? 1);
const pageSize = Number(params.pageSize ?? 10);
const filters = parseFilters(params.filters ?? '');
const sort = parseSort(params.sorter ?? '');

const { userDataCollection } = await connectToDatabase();
const data = userDataCollection
Expand All @@ -36,15 +36,11 @@ const getHandler: NextApiHandler = async (req, res) => {
.limit(pageSize);
const totalCount = await userDataCollection.countDocuments(filters);

return res
.status(200)
.json({ data: await data.toArray(), totalCount, page, pageSize });
return res.status(200).json({ data: await data.toArray(), totalCount, page, pageSize });
};

function parseFilters(queryString: string | string[]): Record<string, any> {
const filterString = Array.isArray(queryString)
? queryString[0]
: queryString;
const filterString = Array.isArray(queryString) ? queryString[0] : queryString;
const filters: Record<string, any> = JSON.parse(filterString);
for (const key in filters) {
const value = filters[key];
Expand All @@ -69,10 +65,10 @@ function parseSort(queryString: string | string[]): any {
}
export const config = {
api: {
bodyParser: {
sizeLimit: '3mb'
}
}
}
bodyParser: {
sizeLimit: '3mb',
},
},
};

export default protect(handler);
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
"jsx": "preserve",
"incremental": true
},
"include": [
"next-env.d.ts",
Expand Down
Loading

0 comments on commit 9ec808a

Please sign in to comment.