Fix jwt-token
This commit is contained in:
@@ -28,6 +28,11 @@ router.get('/', authenticateToken, async (req, res) => {
|
|||||||
|
|
||||||
const tenant = await Tenant.findOne({ where: { slug: tenantId } });
|
const tenant = await Tenant.findOne({ where: { slug: tenantId } });
|
||||||
console.log('🔍 Tenant lookup result:', tenant ? `Found tenant ${tenant.slug}` : 'Tenant not found');
|
console.log('🔍 Tenant lookup result:', tenant ? `Found tenant ${tenant.slug}` : 'Tenant not found');
|
||||||
|
|
||||||
|
// Debug: Let's see what tenants exist
|
||||||
|
const allTenants = await Tenant.findAll();
|
||||||
|
console.log('🔍 All tenants in database:', allTenants.map(t => ({ id: t.id, slug: t.slug })));
|
||||||
|
|
||||||
if (!tenant) {
|
if (!tenant) {
|
||||||
return res.status(404).json({
|
return res.status(404).json({
|
||||||
success: false,
|
success: false,
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ describe('Detections Routes', () => {
|
|||||||
describe('GET /detections', () => {
|
describe('GET /detections', () => {
|
||||||
it('should return detections for user tenant', async () => {
|
it('should return detections for user tenant', async () => {
|
||||||
const tenant = await createTestTenant({ slug: 'test-tenant' });
|
const tenant = await createTestTenant({ slug: 'test-tenant' });
|
||||||
|
console.log('🔍 Created tenant:', { id: tenant.id, slug: tenant.slug });
|
||||||
const user = await createTestUser({ tenant_id: tenant.id });
|
const user = await createTestUser({ tenant_id: tenant.id });
|
||||||
const device = await createTestDevice({ tenant_id: tenant.id });
|
const device = await createTestDevice({ tenant_id: tenant.id });
|
||||||
const detection = await createTestDetection({ device_id: device.id });
|
const detection = await createTestDetection({ device_id: device.id });
|
||||||
|
|||||||
Reference in New Issue
Block a user