managarten/uload/scripts/test-pocketbase.js
Till-JS c712a2504a feat: integrate uload and picture, unify package naming
- Add uload project with apps/web structure
  - Reorganize from flat to monorepo structure
  - Remove PocketBase binary and local data
  - Update to pnpm and @uload/web namespace

- Add picture project to monorepo
  - Remove embedded git repository

- Unify all package names to @{project}/{app} schema:
  - @maerchenzauber/* (was @storyteller/*)
  - @manacore/* (was manacore-*, manacore)
  - @manadeck/* (was web, backend, manadeck)
  - @memoro/* (was memoro-web, landing, memoro)
  - @picture/* (already unified)
  - @uload/web

- Add convenient dev scripts for all apps:
  - pnpm dev:{project}:web
  - pnpm dev:{project}:landing
  - pnpm dev:{project}:mobile
  - pnpm dev:{project}:backend

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 04:00:36 +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();