managarten/apps-archived/uload/scripts/test-pocketbase.js
Till-JS 61d181fbc2 chore: archive inactive projects to apps-archived/
Move inactive projects out of active workspace:
- bauntown (community website)
- maerchenzauber (AI story generation)
- memoro (voice memo app)
- news (news aggregation)
- nutriphi (nutrition tracking)
- reader (reading app)
- uload (URL shortener)
- wisekeep (AI wisdom extraction)

Update CLAUDE.md documentation:
- Add presi to active projects
- Document archived projects section
- Update workspace configuration

Archived apps can be re-activated by moving back to apps/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-29 07:03:59 +01:00

71 lines
2.1 KiB
JavaScript

import PocketBase from 'pocketbase';
const POCKETBASE_URL = process.env.PUBLIC_POCKETBASE_URL || 'http://localhost:8090';
console.log('Testing PocketBase connection...');
console.log('URL:', POCKETBASE_URL);
const pb = new PocketBase(POCKETBASE_URL);
async function testConnection() {
try {
// Test 1: Check health endpoint
const health = await pb.health.check();
console.log('✓ Health check passed:', health);
// Test 2: List collections
const collections = await pb.collections.getList();
console.log(
'✓ Collections found:',
collections.items.map((c) => c.name)
);
// Test 3: Check users collection
const usersCollection = await pb.collections.getOne('users');
console.log('✓ Users collection schema:', {
name: usersCollection.name,
fields: usersCollection.schema.map((f) => ({
name: f.name,
type: f.type,
required: f.required,
})),
});
// Test 4: Try to list users (might fail due to permissions)
try {
const users = await pb.collection('users').getList(1, 1);
console.log('✓ Can list users:', users.totalItems, 'total users');
} catch (e) {
console.log('⚠ Cannot list users (probably permission issue):', e.message);
}
// Test 5: Test registration endpoint
console.log('\nTesting registration capability...');
const testEmail = `test${Date.now()}@example.com`;
try {
const result = await pb.collection('users').create({
email: testEmail,
password: 'Test123456!',
passwordConfirm: 'Test123456!',
username: `testuser${Date.now()}`,
});
console.log('✓ Registration test successful, user created:', result.id);
// Clean up test user
await pb.collection('users').delete(result.id);
console.log('✓ Test user cleaned up');
} catch (e) {
console.error('✗ Registration failed:', e.response || e.message);
if (e.response?.data) {
console.error('Error details:', JSON.stringify(e.response.data, null, 2));
}
}
} catch (error) {
console.error('✗ Connection failed:', error.message);
if (error.response) {
console.error('Response:', error.response);
}
process.exit(1);
}
}
testConnection();