- Implemented ContactForm component for creating and editing contacts. - Added ProjectContactSelector component to manage project-specific contacts. - Updated ProjectForm to include ProjectContactSelector for associating contacts with projects. - Enhanced Card component with a new CardTitle subcomponent for better structure. - Updated Navigation to include a link to the contacts page. - Added translations for contact-related terms in the i18n module. - Initialized contacts database schema and created necessary tables for contact management. - Developed queries for CRUD operations on contacts, including linking and unlinking contacts to projects. - Created a test script to validate contact queries against the database.
23 lines
873 B
JavaScript
23 lines
873 B
JavaScript
import db from './src/lib/db.js';
|
|
|
|
console.log('Checking contacts in database...\n');
|
|
|
|
const contacts = db.prepare('SELECT contact_id, name, phone, email, is_active, contact_type FROM contacts LIMIT 10').all();
|
|
|
|
console.log(`Total contacts found: ${contacts.length}\n`);
|
|
|
|
if (contacts.length > 0) {
|
|
console.log('Sample contacts:');
|
|
contacts.forEach(c => {
|
|
console.log(` ID: ${c.contact_id}, Name: ${c.name}, Phone: ${c.phone || 'N/A'}, Email: ${c.email || 'N/A'}, Active: ${c.is_active}, Type: ${c.contact_type}`);
|
|
});
|
|
} else {
|
|
console.log('No contacts found in database!');
|
|
}
|
|
|
|
const activeCount = db.prepare('SELECT COUNT(*) as count FROM contacts WHERE is_active = 1').get();
|
|
console.log(`\nActive contacts: ${activeCount.count}`);
|
|
|
|
const totalCount = db.prepare('SELECT COUNT(*) as count FROM contacts').get();
|
|
console.log(`Total contacts: ${totalCount.count}`);
|