mirror of
https://github.com/bitbaum/evig.git
synced 2026-12-04 05:37:00 +01:00
* chore: add a formatter, matching the style this repo already writes singleQuote=true was chosen by counting this repo's own imports, not by fleet decree. The fleet is genuinely split and the two repos that already had a .prettierrc disagreed with each other, so there was no standard to restore. Quote style does not cross repo boundaries; having a gate does. Markdown is ignored for now — prettier rewraps prose, which would bury the real diff. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * style: format with prettier, and close a comment that was never closed The formatter refused this repo outright, which turned out to be a real defect rather than a tooling complaint. kivitendo-intake.css opens a header comment, and line 17 contains an inner /* ⚠ PRÜFEN */ — CSS comments do not nest, so that inner terminator CLOSES the header. Everything after it is parsed as CSS until the stray */ on line 20. A browser mis-parses it the same way. The file exists in two places (public/presentations/ and deliverables/), both carrying the same defect; fixing one still failed the gate, which is how the duplicate surfaced at all. Mechanical otherwise. This SHA is listed in .git-blame-ignore-revs. * chore: teach git blame to skip the reformat * fix: undo a 3-way merge duplication in AdminSidebar.tsx Merging main with -X theirs duplicated a 30-line block: main's currency-sweep commit and this branch's prettier reformat both touched overlapping lines in the single-destination-group render path, and the -X theirs strategy inserted rather than replaced, leaving two near-identical copies and a dangling closing brace — SyntaxError: ',' expected at line 298. The branch has no legitimate change to this file's logic, only formatting, so main's content is correct outright. Took it wholesale rather than hand-editing the merge result. * fix(lint): reattach 5 directives the reformat detached Four eslint-disable-next-line sites for react-hooks/set-state-in-effect and one @ts-expect-error, all the same defect: the directive sat above useEffect( (or above a JSX element), while the statement that actually errors is 1-2 lines further down inside the block. eslint/tsc report at the real statement; the directive, still bound to its original line number, protects nothing there. TimecardReviewDrawer.tsx (x2), DataEntryTabs.tsx, AppointmentBookingForm.tsx, CreatePoolModal.tsx. Same root cause documented for hirnli, fleetcrown and ivy-portal earlier today — a positional directive is a hidden dependency on formatting, and this is the fourth distinct shape it's taken. * fix(i18n): restore a same-line audit-exemption marker Fifth shape of today's positional-directive defect, this time the repo's own i18n-hardcoded-audit convention rather than eslint or tsc: a // i18n-ok comment exempts a hardcoded string only when it trails the SAME line. prettier wrapped this one if-statement's long condition onto its own line, leaving the marker on the return statement below — the exact sibling one line down ('fortgeschrittene bis experten') stayed on one line because it was short enough not to wrap, and it alone kept passing. Restored the one-line form and added // prettier-ignore so a future reformat cannot re-split it. Verified against the real audit script locally: 0 new violations. --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
171 lines
5.4 KiB
TypeScript
171 lines
5.4 KiB
TypeScript
/**
|
|
* Add Sample Products Script
|
|
* Adds a few sample products to the store for testing
|
|
*/
|
|
|
|
import { createClient } from 'pg';
|
|
|
|
const client = new createClient({
|
|
host: process.env.DB_HOST || 'localhost',
|
|
port: parseInt(process.env.DB_PORT || '5433'),
|
|
database: process.env.DB_NAME || 'revampit_cms',
|
|
user: process.env.DB_USER || 'postgres',
|
|
password: process.env.DB_PASSWORD || 'postgres',
|
|
});
|
|
|
|
async function addSampleProducts() {
|
|
try {
|
|
await client.connect();
|
|
|
|
// Sample products data
|
|
const products = [
|
|
{
|
|
title: 'Refurbished MacBook Pro 16" M3',
|
|
handle: 'refurbished-macbook-pro-16-m3',
|
|
description: `Dieser refurbished MacBook Pro 16" M3 wurde sorgfältig geprüft und ist in ausgezeichnetem Zustand. Das Gerät bietet die neueste M3-Technologie von Apple mit hervorragender Performance für alle Aufgaben.
|
|
|
|
Technische Daten:
|
|
- Apple M3 Pro Chip mit 11-Core CPU
|
|
- 16" Liquid Retina XDR Display
|
|
- 18GB unified Memory
|
|
- 512GB SSD Speicher
|
|
- 3x Thunderbolt 4 Ports
|
|
- MagSafe 3 Ladegerät
|
|
- Bis zu 22 Stunden Akkulaufzeit
|
|
|
|
Das Gerät wurde vollständig getestet, alle Funktionen arbeiten einwandfrei. Es ist bereit für den sofortigen Einsatz und wird mit dem originalen Netzteil geliefert.
|
|
|
|
Bei RevampIT legen wir grossen Wert auf Nachhaltigkeit - durch den Kauf eines refurbished Geräts schonen Sie die Umwelt und sparen dabei auch noch Geld!`,
|
|
status: 'published',
|
|
thumbnail: 'https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=400',
|
|
images: JSON.stringify([
|
|
{ url: 'https://images.unsplash.com/photo-1517336714731-489689fd1ca8?w=800' },
|
|
{ url: 'https://images.unsplash.com/photo-1541807084-5c52b6b3adef?w=800' },
|
|
]),
|
|
tags: JSON.stringify([
|
|
{ value: 'laptop' },
|
|
{ value: 'apple' },
|
|
{ value: 'macbook' },
|
|
{ value: 'refurbished' },
|
|
]),
|
|
variants: JSON.stringify([
|
|
{
|
|
title: 'Standard',
|
|
sku: 'mbp16-m3-001',
|
|
inventory_quantity: 5,
|
|
prices: [{ amount: 280000, currency_code: 'chf' }], // 2800 CHF in cents
|
|
},
|
|
]),
|
|
},
|
|
{
|
|
title: 'Dell XPS 13 Laptop - Refurbished',
|
|
handle: 'dell-xps-13-refurbished',
|
|
description: `Professionell refurbished Dell XPS 13 Ultrabook in exzellentem Zustand.
|
|
|
|
Spezifikationen:
|
|
- Intel Core i7-1165G7 Prozessor
|
|
- 16GB DDR4 RAM
|
|
- 512GB NVMe SSD
|
|
- 13.3" Full HD InfinityEdge Display
|
|
- Windows 11 Pro vorinstalliert
|
|
- 1 Jahr Garantie
|
|
|
|
Perfekt für Business, Studium oder den täglichen Gebrauch. Voll funktionsfähig und bereit für den Einsatz.`,
|
|
status: 'published',
|
|
thumbnail: 'https://images.unsplash.com/photo-1588872657578-7efd1f1555ed?w=400',
|
|
images: JSON.stringify([
|
|
{ url: 'https://images.unsplash.com/photo-1588872657578-7efd1f1555ed?w=800' },
|
|
]),
|
|
tags: JSON.stringify([
|
|
{ value: 'laptop' },
|
|
{ value: 'dell' },
|
|
{ value: 'business' },
|
|
{ value: 'ultrabook' },
|
|
]),
|
|
variants: JSON.stringify([
|
|
{
|
|
title: 'Standard',
|
|
sku: 'dell-xps13-001',
|
|
inventory_quantity: 3,
|
|
prices: [{ amount: 89900, currency_code: 'chf' }], // 899 CHF in cents
|
|
},
|
|
]),
|
|
},
|
|
{
|
|
title: '27" 4K Monitor LG - Wie neu',
|
|
handle: '4k-monitor-lg-27',
|
|
description: `Hochwertiger 27" 4K UHD Monitor von LG in neuwertigem Zustand.
|
|
|
|
Eigenschaften:
|
|
- 27" IPS Panel
|
|
- 4K UHD Auflösung (3840x2160)
|
|
- HDR10 Unterstützung
|
|
- USB-C mit 65W Power Delivery
|
|
- Integrierte Lautsprecher
|
|
- VESA Mount kompatibel
|
|
|
|
Ideal für Content Creation, Gaming oder professionelle Anwendungen. Mit originaler Verpackung und Zubehör.`,
|
|
status: 'published',
|
|
thumbnail: 'https://images.unsplash.com/photo-1527443224154-c4a3942d3acf?w=400',
|
|
images: JSON.stringify([
|
|
{ url: 'https://images.unsplash.com/photo-1527443224154-c4a3942d3acf?w=800' },
|
|
]),
|
|
tags: JSON.stringify([
|
|
{ value: 'monitor' },
|
|
{ value: '4k' },
|
|
{ value: 'lg' },
|
|
{ value: 'display' },
|
|
]),
|
|
variants: JSON.stringify([
|
|
{
|
|
title: 'Standard',
|
|
sku: 'lg-27uk650-001',
|
|
inventory_quantity: 2,
|
|
prices: [{ amount: 34900, currency_code: 'chf' }], // 349 CHF in cents
|
|
},
|
|
]),
|
|
},
|
|
];
|
|
|
|
console.log('Adding sample products to store...');
|
|
|
|
for (const product of products) {
|
|
// Insert product
|
|
const productResult = await client.query(
|
|
`
|
|
INSERT INTO product (
|
|
id, title, handle, description, status, thumbnail, images, tags, variants,
|
|
created_at, updated_at
|
|
) VALUES (
|
|
gen_random_uuid(),
|
|
$1, $2, $3, $4, $5, $6, $7, $8,
|
|
NOW(), NOW()
|
|
)
|
|
RETURNING id
|
|
`,
|
|
[
|
|
product.title,
|
|
product.handle,
|
|
product.description,
|
|
product.status,
|
|
product.thumbnail,
|
|
product.images,
|
|
product.tags,
|
|
product.variants,
|
|
],
|
|
);
|
|
|
|
console.log(`✅ Added product: ${product.title}`);
|
|
}
|
|
|
|
console.log('🎉 Sample products added successfully!');
|
|
} catch (error) {
|
|
console.error('Error adding sample products:', error);
|
|
} finally {
|
|
await client.end();
|
|
}
|
|
}
|
|
|
|
// Run the script
|
|
addSampleProducts().catch(console.error);
|