This commit is contained in:
commit
59bb5a38a3
132 files changed
+19435
No files matched your search
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Testdaten NUR fuer Entwicklung und Staging, damit eine Stripe-Testbuchung
|
||||
* sofort moeglich ist:
|
||||
* - Preisphase "Early Bird" simuliert (wirkt nur mit Stripe-Testschluessel)
|
||||
* - ein TEST-Anreisetag, ausdruecklich NICHT bestaetigt (erscheint deshalb
|
||||
* nicht oeffentlich, erlaubt aber Ratenplaene im Testmodus)
|
||||
* - ein Test-Gutschein TEST-STAMMMODEL (nicht der Beispielcode aus dem Briefing)
|
||||
*
|
||||
* Verweigert den Lauf mit APP_ENV=production.
|
||||
*/
|
||||
import { getDb, CAMP_ID } from "@/lib/db";
|
||||
import { isoToDbDate } from "@/lib/time";
|
||||
|
||||
try {
|
||||
process.loadEnvFile();
|
||||
} catch {
|
||||
// Umgebung kommt aus dem Container.
|
||||
}
|
||||
|
||||
if ((process.env.APP_ENV ?? "development") === "production") {
|
||||
console.error("seed-dev laeuft nicht mit APP_ENV=production.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const db = getDb();
|
||||
try {
|
||||
await db.camp.upsert({
|
||||
where: { id: CAMP_ID },
|
||||
create: { id: CAMP_ID, testPhaseOverride: "EARLY_BIRD", campStartDate: isoToDbDate("2027-06-05"), dateConfirmed: false },
|
||||
update: { testPhaseOverride: "EARLY_BIRD", campStartDate: isoToDbDate("2027-06-05"), dateConfirmed: false },
|
||||
});
|
||||
await db.voucher.upsert({
|
||||
where: { code: "TEST-STAMMMODEL" },
|
||||
create: { code: "TEST-STAMMMODEL", maxRedemptions: 3, internalNote: "Entwicklung: Testgutschein" },
|
||||
update: {},
|
||||
});
|
||||
console.log("Entwicklungsdaten gesetzt: Early Bird simuliert, Test-Anreisetag 05.06.2027 (unbestätigt), Gutschein TEST-STAMMMODEL.");
|
||||
} finally {
|
||||
await db.$disconnect();
|
||||
}
|
||||
Reference in new issue
Block a user