Fix jwt-token

This commit is contained in:
2025-09-16 21:59:32 +02:00
parent c7484ead5f
commit 9857249668
2 changed files with 11 additions and 19 deletions

View File

@@ -18,12 +18,6 @@ router.get('/', authenticateToken, async (req, res) => {
try {
// Get tenant from authenticated user context
const tenantId = req.tenantId;
console.log('🔍 Detections - Tenant ID from request:', tenantId);
// Debug: Check what tenants exist
const allTenants = await Tenant.findAll({ attributes: ['id', 'slug'] });
console.log('🔍 Detections - All tenants in database:', allTenants.map(t => ({ id: t.id, slug: t.slug })));
if (!tenantId) {
return res.status(400).json({
success: false,
@@ -32,7 +26,6 @@ router.get('/', authenticateToken, async (req, res) => {
}
const tenant = await Tenant.findOne({ where: { slug: tenantId } });
console.log('🔍 Detections - Tenant lookup result:', tenant ? `Found: ${tenant.slug}` : 'Not found');
if (!tenant) {
return res.status(404).json({
success: false,
@@ -122,14 +115,17 @@ router.get('/', authenticateToken, async (req, res) => {
});
res.json({
detections: enhancedDetections,
pagination: {
currentPage: parseInt(page),
totalPages,
totalCount,
limit: parseInt(limit),
hasNextPage,
hasPrevPage
success: true,
data: {
detections: enhancedDetections,
pagination: {
currentPage: parseInt(page),
totalPages,
totalCount,
limit: parseInt(limit),
hasNextPage,
hasPrevPage
}
}
});