Fixed type errors in nextJS apps, added Docker files
Co-authored-by: Nicolas <nocnico@users.noreply.github.com>
This commit is contained in:
6
apps/hub-server/.dockerignore
Normal file
6
apps/hub-server/.dockerignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
nodemon.json
|
||||
.env
|
||||
.env.example
|
||||
31
apps/hub-server/Dockerfile
Normal file
31
apps/hub-server/Dockerfile
Normal file
@@ -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"]
|
||||
8
apps/hub-server/helper/events.ts
Normal file
8
apps/hub-server/helper/events.ts
Normal file
@@ -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;
|
||||
};
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user