diff --git a/apps/dispatch-server/.dockerignore b/apps/dispatch-server/.dockerignore new file mode 100644 index 00000000..7a533e48 --- /dev/null +++ b/apps/dispatch-server/.dockerignore @@ -0,0 +1,6 @@ +node_modules +Dockerfile +.dockerignore +nodemon.json +.env +.env.example \ No newline at end of file diff --git a/apps/dispatch-server/Dockerfile b/apps/dispatch-server/Dockerfile new file mode 100644 index 00000000..ae216d30 --- /dev/null +++ b/apps/dispatch-server/Dockerfile @@ -0,0 +1,29 @@ +FROM node:22-alpine + +# Set the working directory +WORKDIR /usr/app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Change ownership to the non-root user +RUN chown -R node:node /usr/app + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Expose the application port +EXPOSE 3002 + +# Run container as non-root (unprivileged) user +# The "node" user is provided in the Node.js Alpine base image +USER node + +# Command to run the application +CMD ["node", "index.js"] \ No newline at end of file diff --git a/apps/dispatch/.dockerignore b/apps/dispatch/.dockerignore new file mode 100644 index 00000000..3147d3ff --- /dev/null +++ b/apps/dispatch/.dockerignore @@ -0,0 +1,7 @@ +node_modules +Dockerfile +.dockerignore +.eslint.config.msj +.README.md +.env +.env.example \ No newline at end of file diff --git a/apps/dispatch/Dockerfile b/apps/dispatch/Dockerfile new file mode 100644 index 00000000..210f3e7e --- /dev/null +++ b/apps/dispatch/Dockerfile @@ -0,0 +1,29 @@ +FROM node:22-alpine + +# Set the working directory +WORKDIR /usr/app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Change ownership to the non-root user +RUN chown -R node:node /usr/app + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Expose the application port +EXPOSE 3001 + +# Run container as non-root (unprivileged) user +# The "node" user is provided in the Node.js Alpine base image +USER node + +# Command to run the application +CMD ["npm", "start"] \ No newline at end of file diff --git a/apps/dispatch/app/pilot/_components/navbar/_components/Connection.tsx b/apps/dispatch/app/pilot/_components/navbar/_components/Connection.tsx index e97dff55..99bb8001 100644 --- a/apps/dispatch/app/pilot/_components/navbar/_components/Connection.tsx +++ b/apps/dispatch/app/pilot/_components/navbar/_components/Connection.tsx @@ -1,6 +1,6 @@ "use client"; import { useSession } from "next-auth/react"; -import { usePilotConnectionStore } from "../../../_store/pilot/connectionStore"; +import { usePilotConnectionStore } from "_store/pilot/connectionStore"; import { useEffect, useRef, useState } from "react"; import { useQuery } from "@tanstack/react-query"; import { getStationsAPI } from "querys/stations"; diff --git a/apps/hub-server/.dockerignore b/apps/hub-server/.dockerignore new file mode 100644 index 00000000..7a533e48 --- /dev/null +++ b/apps/hub-server/.dockerignore @@ -0,0 +1,6 @@ +node_modules +Dockerfile +.dockerignore +nodemon.json +.env +.env.example \ No newline at end of file diff --git a/apps/hub-server/Dockerfile b/apps/hub-server/Dockerfile new file mode 100644 index 00000000..cfce4bee --- /dev/null +++ b/apps/hub-server/Dockerfile @@ -0,0 +1,31 @@ +FROM node:22-alpine + +ENV NODE_ENV=production + +# Set the working directory +WORKDIR /usr/app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Change ownership to the non-root user +RUN chown -R node:node /usr/app + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Expose the application port +EXPOSE 3003 + +# Run container as non-root (unprivileged) user +# The "node" user is provided in the Node.js Alpine base image +USER node + +# Command to run the application +CMD ["node", "index.js"] \ No newline at end of file diff --git a/apps/hub-server/helper/events.ts b/apps/hub-server/helper/events.ts new file mode 100644 index 00000000..ba456620 --- /dev/null +++ b/apps/hub-server/helper/events.ts @@ -0,0 +1,8 @@ +import { Event, Participant } from "@repo/db"; + +export const eventCompleted = (event: Event, participant?: Participant) => { + if (!participant) return false; + if (event.finisherMoodleCourseId && !participant.finisherMoodleCurseCompleted) return false; + if (event.hasPresenceEvents && !participant.attended) return false; + return true; +}; diff --git a/apps/hub-server/modules/chron.ts b/apps/hub-server/modules/chron.ts index ce06df5e..6bce78f8 100644 --- a/apps/hub-server/modules/chron.ts +++ b/apps/hub-server/modules/chron.ts @@ -1,9 +1,9 @@ import { getMoodleCourseCompletionStatus, getMoodleUserById } from "./moodle"; import { CronJob } from "cron"; import { prisma } from "@repo/db"; -import { eventCompleted } from "@repo/ui/helper"; import { sendCourseCompletedEmail } from "modules/mail"; import { handleParticipantFinished } from "modules/event"; +import { eventCompleted } from "helper/events"; const syncMoodleIds = async () => { try { diff --git a/apps/hub/.dockerignore b/apps/hub/.dockerignore new file mode 100644 index 00000000..716c6297 --- /dev/null +++ b/apps/hub/.dockerignore @@ -0,0 +1,8 @@ +node_modules +Dockerfile +.dockerignore +.gitignore +.eslint.config.msj +.README.md +.env +.env.example \ No newline at end of file diff --git a/apps/hub/Dockerfile b/apps/hub/Dockerfile new file mode 100644 index 00000000..3ad34206 --- /dev/null +++ b/apps/hub/Dockerfile @@ -0,0 +1,29 @@ +FROM node:22-alpine + +# Set the working directory +WORKDIR /usr/app + +# Copy package.json and package-lock.json +COPY package*.json ./ + +# Install dependencies +RUN npm install + +# Change ownership to the non-root user +RUN chown -R node:node /usr/app + +# Copy the rest of the application code +COPY . . + +# Build the application +RUN npm run build + +# Expose the application port +EXPOSE 3000 + +# Run container as non-root (unprivileged) user +# The "node" user is provided in the Node.js Alpine base image +USER node + +# Command to run the application +CMD ["npm", "start"] \ No newline at end of file diff --git a/apps/hub/app/(app)/admin/event/[id]/page.tsx b/apps/hub/app/(app)/admin/event/[id]/page.tsx index 9d115efe..75184324 100644 --- a/apps/hub/app/(app)/admin/event/[id]/page.tsx +++ b/apps/hub/app/(app)/admin/event/[id]/page.tsx @@ -1,7 +1,7 @@ import { prisma } from "@repo/db"; import { Form } from "../_components/Form"; -export default async ({ params }: { params: Promise<{ id: string }> }) => { +export default async function Page({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; const event = await prisma.event.findUnique({ where: { @@ -10,4 +10,4 @@ export default async ({ params }: { params: Promise<{ id: string }> }) => { }); if (!event) return