feat: add mobile API routes (download-all ZIP, upload-file multipart, auth/me, settings)

This commit is contained in:
VPS 4 Deploy Agent
2026-06-03 17:02:07 +02:00
parent e0de5af1f4
commit 68dc2965da
7 changed files with 807 additions and 1 deletions
+21
View File
@@ -163,6 +163,27 @@ router.get('/verify', async (req, res) => {
}
});
// ================================================================
// GET /api/auth/me - Retorna dados do perfil do usuário logado
// Usado pela tela "Minha Conta" do mobile
// ================================================================
router.get('/me', authenticateToken, async (req, res) => {
try {
const user = await db.get(
'SELECT id, username, email, clinic_name, pc_name, is_admin, created_at FROM users WHERE id = $1',
[req.user.id]
);
if (!user) {
return res.status(404).json({ error: 'Usuário não encontrado' });
}
res.json({ success: true, user });
} catch (error) {
console.error('Erro ao buscar perfil:', error);
res.status(500).json({ error: 'Erro interno do servidor' });
}
});
// ================================================================
// POST /api/auth/logout - Logout
// ================================================================