Merge branch 'main' into Training-Report-Visuals

This commit is contained in:
2025-12-30 20:53:22 -06:00
5 changed files with 33 additions and 36 deletions

19
api/package-lock.json generated
View File

@@ -11,7 +11,6 @@
"dependencies": {
"@sentry/node": "^10.27.0",
"@types/express-session": "^1.18.2",
"chalk": "^5.6.2",
"connect-sqlite3": "^0.9.16",
"cors": "^2.8.5",
"dotenv": "^17.2.1",
@@ -1315,18 +1314,6 @@
"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": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@@ -3235,9 +3222,9 @@
}
},
"node_modules/qs": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
"integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
"version": "6.14.1",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz",
"integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==",
"license": "BSD-3-Clause",
"dependencies": {
"side-channel": "^1.1.0"

View File

@@ -14,7 +14,6 @@
"dependencies": {
"@sentry/node": "^10.27.0",
"@types/express-session": "^1.18.2",
"chalk": "^5.6.2",
"connect-sqlite3": "^0.9.16",
"cors": "^2.8.5",
"dotenv": "^17.2.1",

View File

@@ -5,24 +5,24 @@ import express = require('express');
import cors = require('cors');
import morgan = require('morgan');
const app = express()
import chalk from 'chalk';
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
const statusColor = status >= 500 ? chalk.red
: status >= 400 ? chalk.yellow
: status >= 300 ? chalk.cyan
: chalk.green;
method: tokens.method(req, res),
path: tokens.url(req, res),
status: Number(tokens.status(req, res)),
response_time_ms: Number(tokens['response-time'](req, res)),
return [
chalk.gray(`[${new Date().toISOString()}]`),
chalk.blue.bold(tokens.method(req, res)),
tokens.url(req, res),
statusColor(status),
chalk.magenta(tokens['response-time'](req, res) + ' ms'),
chalk.yellow(`- User: ${req.user?.name ? `${req.user.name} (${req.user.id})` : 'Unauthenticated'}`),
].join(' ');
ip: req.ip,
user_agent: req.headers['user-agent'],
user: req.user
? { id: req.user.id, name: req.user.name }
: null,
});
}, {
skip: (req: express.Request) => {
return req.originalUrl === '/members/me';

View File

@@ -79,9 +79,11 @@ router.get('/me', [requireLogin], async (req, res) => {
try {
let application = await getMemberApplication(userID);
if (application === undefined)
if (application === undefined) {
res.sendStatus(204);
return;
}
const comments: CommentRow[] = await getApplicationComments(application.id);

View File

@@ -20,6 +20,7 @@ const decisionDate = ref<Date | null>(null);
const submitDate = ref<Date | null>(null);
const loading = ref<boolean>(true);
const member_name = ref<string>();
const notFound = ref<boolean>(false);
const props = defineProps<{
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) {
if (!raw) {
notFound.value = true;
return;
}
const data = raw.application;
appID.value = data.id;
@@ -129,6 +135,10 @@ async function handleDeny(id) {
<div v-if="unauthorized" class="flex justify-center w-full my-10">
You do not have permission to view this application.
</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-if="!newApp" class="flex flex-row justify-between items-center py-2 mb-8">
<!-- Application header -->
@@ -181,8 +191,7 @@ async function handleDeny(id) {
</div>
</div>
<!-- TODO: Implement some kinda loading screen -->
<div v-else class="flex items-center justify-center h-full">
<Spinner class="size-8"/>
<Spinner class="size-8" />
</div>
</template>