Migracao Logto + Supabase - backend e frontend atualizados para nova autenticação
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
import app from './app.js';
|
||||
import dotenv from 'dotenv';
|
||||
import { migrateFilesToGridFS } from './services/dataSheetService.js';
|
||||
import { connectDB } from './config/database.js';
|
||||
import mongoose from 'mongoose';
|
||||
import { notificationService } from './services/notificationService.js';
|
||||
|
||||
dotenv.config();
|
||||
@@ -14,21 +12,7 @@ const startServer = async () => {
|
||||
const PORT = process.env.PORT || 3000;
|
||||
app.listen(PORT, async () => {
|
||||
console.log(`🚀 Server running on port ${PORT}`);
|
||||
if (mongoose.connection.readyState === 1) {
|
||||
await migrateFilesToGridFS().catch(err => console.error('Migration failed:', err));
|
||||
|
||||
// Agendar verificação de vencimento de estoque (a cada 24 horas)
|
||||
console.log('📅 Scheduling stock expiration check...');
|
||||
setInterval(() => {
|
||||
notificationService.checkStockExpirations();
|
||||
}, 24 * 60 * 60 * 1000);
|
||||
|
||||
// Executar uma vez no início para garantir (opcional, bom para dev)
|
||||
notificationService.checkStockExpirations();
|
||||
|
||||
} else {
|
||||
console.warn('⚠️ MongoDB is not connected. Skipping migrations.');
|
||||
}
|
||||
console.log('✅ Conectado ao Supabase (GPI schema)');
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Failed to start server:', error);
|
||||
@@ -37,5 +21,4 @@ const startServer = async () => {
|
||||
|
||||
startServer();
|
||||
|
||||
// Force keep-alive to debug why it exits
|
||||
setInterval(() => { }, 1000);
|
||||
|
||||
Reference in New Issue
Block a user