Fix jwt-token
This commit is contained in:
@@ -8,7 +8,7 @@ async function debugTenant() {
|
||||
const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: ':memory:',
|
||||
logging: console.log
|
||||
logging: false // Disable logging for cleaner output
|
||||
});
|
||||
|
||||
// Load models
|
||||
@@ -18,15 +18,51 @@ async function debugTenant() {
|
||||
// Sync database
|
||||
await sequelize.sync({ force: true });
|
||||
|
||||
console.log('Attempting to create tenant...');
|
||||
const tenant = await Tenant.create({
|
||||
name: 'Debug Tenant',
|
||||
slug: 'debug-tenant-' + Date.now(),
|
||||
domain: 'debug.example.com',
|
||||
console.log('Attempting to create tenant1...');
|
||||
const tenant1 = await Tenant.create({
|
||||
name: 'Test Tenant 1',
|
||||
slug: 'tenant1',
|
||||
domain: 'test1.example.com',
|
||||
is_active: true
|
||||
});
|
||||
console.log('✅ Tenant1 created successfully:', tenant1.id);
|
||||
|
||||
console.log('✅ Tenant created successfully:', tenant.id);
|
||||
console.log('Attempting to create tenant2...');
|
||||
const tenant2 = await Tenant.create({
|
||||
name: 'Test Tenant 2',
|
||||
slug: 'tenant2',
|
||||
domain: 'test2.example.com',
|
||||
is_active: true
|
||||
});
|
||||
console.log('✅ Tenant2 created successfully:', tenant2.id);
|
||||
|
||||
// Try to create a tenant with same slug (should fail)
|
||||
console.log('Attempting to create duplicate slug (should fail)...');
|
||||
try {
|
||||
await Tenant.create({
|
||||
name: 'Duplicate Tenant',
|
||||
slug: 'tenant1', // This should fail
|
||||
domain: 'test3.example.com',
|
||||
is_active: true
|
||||
});
|
||||
console.log('❌ ERROR: Duplicate slug should have failed!');
|
||||
} catch (error) {
|
||||
console.log('✅ Correctly caught duplicate slug error:', error.message);
|
||||
}
|
||||
|
||||
// Try to create a tenant with same domain (should fail)
|
||||
console.log('Attempting to create duplicate domain (should fail)...');
|
||||
try {
|
||||
await Tenant.create({
|
||||
name: 'Duplicate Domain Tenant',
|
||||
slug: 'tenant3',
|
||||
domain: 'test1.example.com', // This should fail
|
||||
is_active: true
|
||||
});
|
||||
console.log('❌ ERROR: Duplicate domain should have failed!');
|
||||
} catch (error) {
|
||||
console.log('✅ Correctly caught duplicate domain error:', error.message);
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log('❌ Error creating tenant:');
|
||||
|
||||
Reference in New Issue
Block a user