Corrige caminhos do storage no server e Dockerfile do portal

This commit is contained in:
Sidney 2026-04-22 20:12:31 -03:00
parent 5ee1524d8a
commit a3f5b12a07
2 changed files with 5 additions and 5 deletions

View File

@ -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"]

View File

@ -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) {