diff --git a/portal/Dockerfile b/portal/Dockerfile index 5be87f7..3f2c266 100644 --- a/portal/Dockerfile +++ b/portal/Dockerfile @@ -12,8 +12,8 @@ FROM node:22-alpine AS production WORKDIR /app COPY package.json ./ RUN npm install --omit=dev -COPY server.selfhosted.js ./server.js -COPY src/services ./src/services +COPY server.selfhosted.js ./server.js +COPY services ./services COPY --from=builder /app/dist ./dist EXPOSE 3001 CMD ["node", "server.js"] diff --git a/portal/server.selfhosted.js b/portal/server.selfhosted.js index 3d8fffd..7cb7f37 100644 --- a/portal/server.selfhosted.js +++ b/portal/server.selfhosted.js @@ -17,7 +17,7 @@ import pg from 'pg'; import path from 'path'; import { fileURLToPath } from 'url'; import multer from 'multer'; -import { uploadAtestado, s3Client } from './server/services/storage.js'; +import { uploadAtestado, s3Client } from './services/storage.js'; import { GetObjectCommand } from '@aws-sdk/client-s3'; const upload = multer({ storage: multer.memoryStorage() }); @@ -51,7 +51,7 @@ app.get(/^\/storage\/([^\/]+)\/(.+)$/, async (req, res) => { const key = req.params[1]; const command = new GetObjectCommand({ Bucket: bucket, Key: key }); const data = await s3Client.send(command); - + res.set('Content-Type', data.ContentType || 'image/jpeg'); res.set('Cache-Control', 'public, max-age=86400'); data.Body.pipe(res); @@ -291,7 +291,7 @@ app.post('/api/portal/frequencia/justificar', authMiddleware, upload.single('arq const fullDateStr = date; const justificationPayload = JSON.stringify({ motivo: motivo.trim(), arquivo: publicUrl }); - + let recordIndex = attendance.findIndex(a => a.studentId === req.user.studentId && a.date === fullDateStr); if (recordIndex !== -1) {