- 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
69 lines
1.9 KiB
TypeScript
69 lines
1.9 KiB
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
console.log('🔄 Stelle LexOffice-Artikel-IDs wieder her...\n');
|
|
|
|
// 1. Fotobox-Artikel-IDs für ALLE PriceConfigs setzen
|
|
const photoboxUpdate = await prisma.priceConfig.updateMany({
|
|
data: {
|
|
lexofficeArticleId: '5d9d3716-f81e-4e46-b5cf-13988f489cc2', // ohne Druckflatrate
|
|
lexofficeArticleIdWithFlat: '3f26c02c-d705-41a6-9b49-2e2e96e77036', // mit Druckflatrate
|
|
},
|
|
});
|
|
console.log(`✅ ${photoboxUpdate.count} PriceConfigs mit Fotobox-Artikel-IDs aktualisiert`);
|
|
|
|
// 2. Kilometerpauschale für Lübeck
|
|
const luebeckLocation = await prisma.location.findFirst({
|
|
where: { city: 'Lübeck' },
|
|
});
|
|
|
|
if (luebeckLocation) {
|
|
const kmUpdate = await prisma.priceConfig.updateMany({
|
|
where: { locationId: luebeckLocation.id },
|
|
data: {
|
|
lexofficeKmFlatArticleId: 'd3e2b21b-e899-412d-b53e-c82a0a94fcfa',
|
|
},
|
|
});
|
|
console.log(`✅ ${kmUpdate.count} PriceConfigs für Lübeck mit Kilometerpauschale-ID aktualisiert`);
|
|
}
|
|
|
|
// 3. Equipment-IDs prüfen
|
|
const equipment = await prisma.equipment.findMany({
|
|
select: {
|
|
id: true,
|
|
name: true,
|
|
lexofficeArticleId: true,
|
|
},
|
|
});
|
|
|
|
console.log('\n📦 Vorhandene Equipment-Artikel:');
|
|
console.table(equipment);
|
|
|
|
// 4. Finale Übersicht
|
|
console.log('\n📊 Finale PriceConfig-Übersicht:');
|
|
const configs = await prisma.priceConfig.findMany({
|
|
include: {
|
|
location: true,
|
|
},
|
|
});
|
|
|
|
console.table(configs.map(c => ({
|
|
model: c.model,
|
|
city: c.location?.city,
|
|
articleId: c.lexofficeArticleId?.slice(0, 8) + '...',
|
|
articleIdWithFlat: c.lexofficeArticleIdWithFlat?.slice(0, 8) + '...',
|
|
kmFlatArticleId: c.lexofficeKmFlatArticleId?.slice(0, 8) + '...' || 'null',
|
|
})));
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|