- Vintage Modell hinzugefuegt - Equipment Multi-Select (Neue Buchung + Bearbeitung) - Kundenadresse in Formularen - Bearbeiten-Seite fuer Buchungen - Abbau-Zeiten in Formularen und Uebersicht - Vertrag PDF nur bei Privatkunden - LexOffice Kontakt-Erstellung Fix (BUSINESS) - Zurueck-Pfeil auf Touren-Seite
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { config } from 'dotenv';
|
|
config();
|
|
|
|
async function listLexOfficeArticles() {
|
|
console.log('🔍 Lade LexOffice Artikel...\n');
|
|
|
|
try {
|
|
const response = await fetch('https://api.lexoffice.io/v1/articles?page=0&size=100', {
|
|
method: 'GET',
|
|
headers: {
|
|
'Authorization': `Bearer ${process.env.LEXOFFICE_API_KEY}`,
|
|
'Accept': 'application/json',
|
|
},
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`LexOffice API Error: ${response.status}`);
|
|
}
|
|
|
|
const data = await response.json();
|
|
|
|
if (!data.content || data.content.length === 0) {
|
|
console.log('⚠️ Keine Artikel gefunden.');
|
|
return;
|
|
}
|
|
|
|
console.log(`✅ Gefunden: ${data.content.length} Artikel\n`);
|
|
console.log('─'.repeat(80));
|
|
|
|
data.content.forEach((article: any, index: number) => {
|
|
console.log(`\n${index + 1}. ${article.title || article.articleNumber || 'Unbekannt'}`);
|
|
console.log(` ID: ${article.id}`);
|
|
console.log(` Artikelnummer: ${article.articleNumber || 'N/A'}`);
|
|
console.log(` Typ: ${article.type || 'N/A'}`);
|
|
|
|
if (article.price) {
|
|
console.log(` Preis: ${article.price.netAmount || 0}€ netto`);
|
|
}
|
|
|
|
if (article.description) {
|
|
console.log(` Beschreibung: ${article.description.substring(0, 60)}...`);
|
|
}
|
|
});
|
|
|
|
console.log('\n' + '─'.repeat(80));
|
|
console.log('\n💡 Kopieren Sie die IDs für Ihr Produkt-Mapping!');
|
|
|
|
} catch (error: any) {
|
|
console.error('❌ Fehler:', error.message);
|
|
}
|
|
}
|
|
|
|
listLexOfficeArticles();
|