Merge branch 'main' into Training-Report-Visuals
This commit is contained in:
19
api/package-lock.json
generated
19
api/package-lock.json
generated
@@ -11,7 +11,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sentry/node": "^10.27.0",
|
"@sentry/node": "^10.27.0",
|
||||||
"@types/express-session": "^1.18.2",
|
"@types/express-session": "^1.18.2",
|
||||||
"chalk": "^5.6.2",
|
|
||||||
"connect-sqlite3": "^0.9.16",
|
"connect-sqlite3": "^0.9.16",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^17.2.1",
|
"dotenv": "^17.2.1",
|
||||||
@@ -1315,18 +1314,6 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/chalk": {
|
|
||||||
"version": "5.6.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
|
|
||||||
"integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
|
|
||||||
"license": "MIT",
|
|
||||||
"engines": {
|
|
||||||
"node": "^12.17.0 || ^14.13 || >=16.0.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/chokidar": {
|
"node_modules/chokidar": {
|
||||||
"version": "3.6.0",
|
"version": "3.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
|
||||||
@@ -3235,9 +3222,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/qs": {
|
"node_modules/qs": {
|
||||||
"version": "6.14.0",
|
"version": "6.14.1",
|
||||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
|
||||||
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
|
"integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"side-channel": "^1.1.0"
|
"side-channel": "^1.1.0"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@sentry/node": "^10.27.0",
|
"@sentry/node": "^10.27.0",
|
||||||
"@types/express-session": "^1.18.2",
|
"@types/express-session": "^1.18.2",
|
||||||
"chalk": "^5.6.2",
|
|
||||||
"connect-sqlite3": "^0.9.16",
|
"connect-sqlite3": "^0.9.16",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"dotenv": "^17.2.1",
|
"dotenv": "^17.2.1",
|
||||||
|
|||||||
@@ -5,24 +5,24 @@ import express = require('express');
|
|||||||
import cors = require('cors');
|
import cors = require('cors');
|
||||||
import morgan = require('morgan');
|
import morgan = require('morgan');
|
||||||
const app = express()
|
const app = express()
|
||||||
import chalk from 'chalk';
|
|
||||||
app.use(morgan((tokens: morgan.TokenIndexer, req: express.Request, res: express.Response) => {
|
app.use(morgan((tokens: morgan.TokenIndexer, req: express.Request, res: express.Response) => {
|
||||||
const status = Number(tokens.status(req, res));
|
return JSON.stringify({
|
||||||
|
type: 'http',
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
|
||||||
// Colorize status code
|
method: tokens.method(req, res),
|
||||||
const statusColor = status >= 500 ? chalk.red
|
path: tokens.url(req, res),
|
||||||
: status >= 400 ? chalk.yellow
|
status: Number(tokens.status(req, res)),
|
||||||
: status >= 300 ? chalk.cyan
|
response_time_ms: Number(tokens['response-time'](req, res)),
|
||||||
: chalk.green;
|
|
||||||
|
|
||||||
return [
|
ip: req.ip,
|
||||||
chalk.gray(`[${new Date().toISOString()}]`),
|
user_agent: req.headers['user-agent'],
|
||||||
chalk.blue.bold(tokens.method(req, res)),
|
|
||||||
tokens.url(req, res),
|
user: req.user
|
||||||
statusColor(status),
|
? { id: req.user.id, name: req.user.name }
|
||||||
chalk.magenta(tokens['response-time'](req, res) + ' ms'),
|
: null,
|
||||||
chalk.yellow(`- User: ${req.user?.name ? `${req.user.name} (${req.user.id})` : 'Unauthenticated'}`),
|
});
|
||||||
].join(' ');
|
|
||||||
}, {
|
}, {
|
||||||
skip: (req: express.Request) => {
|
skip: (req: express.Request) => {
|
||||||
return req.originalUrl === '/members/me';
|
return req.originalUrl === '/members/me';
|
||||||
|
|||||||
@@ -80,8 +80,10 @@ router.get('/me', [requireLogin], async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
let application = await getMemberApplication(userID);
|
let application = await getMemberApplication(userID);
|
||||||
|
|
||||||
if (application === undefined)
|
if (application === undefined) {
|
||||||
res.sendStatus(204);
|
res.sendStatus(204);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const comments: CommentRow[] = await getApplicationComments(application.id);
|
const comments: CommentRow[] = await getApplicationComments(application.id);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const decisionDate = ref<Date | null>(null);
|
|||||||
const submitDate = ref<Date | null>(null);
|
const submitDate = ref<Date | null>(null);
|
||||||
const loading = ref<boolean>(true);
|
const loading = ref<boolean>(true);
|
||||||
const member_name = ref<string>();
|
const member_name = ref<string>();
|
||||||
|
const notFound = ref<boolean>(false);
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mode?: "create" | "view-self" | "view-recruiter" | "view-self-id"
|
mode?: "create" | "view-self" | "view-recruiter" | "view-self-id"
|
||||||
@@ -29,6 +30,11 @@ const finalMode = ref<"create" | "view-self" | "view-recruiter" | "view-self-id"
|
|||||||
|
|
||||||
function loadData(raw: ApplicationFull) {
|
function loadData(raw: ApplicationFull) {
|
||||||
|
|
||||||
|
if (!raw) {
|
||||||
|
notFound.value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const data = raw.application;
|
const data = raw.application;
|
||||||
|
|
||||||
appID.value = data.id;
|
appID.value = data.id;
|
||||||
@@ -129,6 +135,10 @@ async function handleDeny(id) {
|
|||||||
<div v-if="unauthorized" class="flex justify-center w-full my-10">
|
<div v-if="unauthorized" class="flex justify-center w-full my-10">
|
||||||
You do not have permission to view this application.
|
You do not have permission to view this application.
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else-if="notFound" class="flex justify-center w-full my-10 text-muted-foreground">
|
||||||
|
Looks like you dont have an application, reach out to the administration team if you believe this is an
|
||||||
|
error.
|
||||||
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if="!newApp" class="flex flex-row justify-between items-center py-2 mb-8">
|
<div v-if="!newApp" class="flex flex-row justify-between items-center py-2 mb-8">
|
||||||
<!-- Application header -->
|
<!-- Application header -->
|
||||||
@@ -181,8 +191,7 @@ async function handleDeny(id) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- TODO: Implement some kinda loading screen -->
|
|
||||||
<div v-else class="flex items-center justify-center h-full">
|
<div v-else class="flex items-center justify-center h-full">
|
||||||
<Spinner class="size-8"/>
|
<Spinner class="size-8" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
Reference in New Issue
Block a user