search console SEO ableitungen

This commit is contained in:
2026-03-23 19:01:52 -05:00
parent d47108d27c
commit e6b19e7a1c
150 changed files with 26257 additions and 25909 deletions

View File

@@ -1,146 +1,146 @@
-- CreateEnum
CREATE TYPE "QRType" AS ENUM ('STATIC', 'DYNAMIC');
-- CreateEnum
CREATE TYPE "ContentType" AS ENUM ('URL', 'WIFI', 'VCARD', 'PHONE', 'EMAIL', 'SMS', 'TEXT', 'WHATSAPP');
-- CreateEnum
CREATE TYPE "QRStatus" AS ENUM ('ACTIVE', 'PAUSED');
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,
"password" TEXT,
"image" TEXT,
"emailVerified" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"providerAccountId" TEXT NOT NULL,
"refresh_token" TEXT,
"access_token" TEXT,
"expires_at" INTEGER,
"token_type" TEXT,
"scope" TEXT,
"id_token" TEXT,
"session_state" TEXT,
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"sessionToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);
-- CreateTable
CREATE TABLE "QRCode" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"type" "QRType" NOT NULL DEFAULT 'DYNAMIC',
"contentType" "ContentType" NOT NULL DEFAULT 'URL',
"content" JSONB NOT NULL,
"tags" TEXT[],
"status" "QRStatus" NOT NULL DEFAULT 'ACTIVE',
"style" JSONB NOT NULL,
"slug" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "QRCode_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "QRScan" (
"id" TEXT NOT NULL,
"qrId" TEXT NOT NULL,
"ts" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"ipHash" TEXT NOT NULL,
"userAgent" TEXT,
"device" TEXT,
"os" TEXT,
"country" TEXT,
"referrer" TEXT,
"utmSource" TEXT,
"utmMedium" TEXT,
"utmCampaign" TEXT,
"isUnique" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "QRScan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Integration" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"status" TEXT NOT NULL DEFAULT 'inactive',
"config" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Integration_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- CreateIndex
CREATE UNIQUE INDEX "QRCode_slug_key" ON "QRCode"("slug");
-- CreateIndex
CREATE INDEX "QRCode_userId_createdAt_idx" ON "QRCode"("userId", "createdAt");
-- CreateIndex
CREATE INDEX "QRScan_qrId_ts_idx" ON "QRScan"("qrId", "ts");
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QRCode" ADD CONSTRAINT "QRCode_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QRScan" ADD CONSTRAINT "QRScan_qrId_fkey" FOREIGN KEY ("qrId") REFERENCES "QRCode"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Integration" ADD CONSTRAINT "Integration_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- CreateEnum
CREATE TYPE "QRType" AS ENUM ('STATIC', 'DYNAMIC');
-- CreateEnum
CREATE TYPE "ContentType" AS ENUM ('URL', 'WIFI', 'VCARD', 'PHONE', 'EMAIL', 'SMS', 'TEXT', 'WHATSAPP');
-- CreateEnum
CREATE TYPE "QRStatus" AS ENUM ('ACTIVE', 'PAUSED');
-- CreateTable
CREATE TABLE "User" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"name" TEXT,
"password" TEXT,
"image" TEXT,
"emailVerified" TIMESTAMP(3),
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Account" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"type" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"providerAccountId" TEXT NOT NULL,
"refresh_token" TEXT,
"access_token" TEXT,
"expires_at" INTEGER,
"token_type" TEXT,
"scope" TEXT,
"id_token" TEXT,
"session_state" TEXT,
CONSTRAINT "Account_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Session" (
"id" TEXT NOT NULL,
"sessionToken" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Session_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "VerificationToken" (
"identifier" TEXT NOT NULL,
"token" TEXT NOT NULL,
"expires" TIMESTAMP(3) NOT NULL
);
-- CreateTable
CREATE TABLE "QRCode" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"title" TEXT NOT NULL,
"type" "QRType" NOT NULL DEFAULT 'DYNAMIC',
"contentType" "ContentType" NOT NULL DEFAULT 'URL',
"content" JSONB NOT NULL,
"tags" TEXT[],
"status" "QRStatus" NOT NULL DEFAULT 'ACTIVE',
"style" JSONB NOT NULL,
"slug" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "QRCode_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "QRScan" (
"id" TEXT NOT NULL,
"qrId" TEXT NOT NULL,
"ts" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"ipHash" TEXT NOT NULL,
"userAgent" TEXT,
"device" TEXT,
"os" TEXT,
"country" TEXT,
"referrer" TEXT,
"utmSource" TEXT,
"utmMedium" TEXT,
"utmCampaign" TEXT,
"isUnique" BOOLEAN NOT NULL DEFAULT false,
CONSTRAINT "QRScan_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Integration" (
"id" TEXT NOT NULL,
"userId" TEXT NOT NULL,
"provider" TEXT NOT NULL,
"status" TEXT NOT NULL DEFAULT 'inactive',
"config" JSONB NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "Integration_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-- CreateIndex
CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
-- CreateIndex
CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-- CreateIndex
CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
-- CreateIndex
CREATE UNIQUE INDEX "QRCode_slug_key" ON "QRCode"("slug");
-- CreateIndex
CREATE INDEX "QRCode_userId_createdAt_idx" ON "QRCode"("userId", "createdAt");
-- CreateIndex
CREATE INDEX "QRScan_qrId_ts_idx" ON "QRScan"("qrId", "ts");
-- AddForeignKey
ALTER TABLE "Account" ADD CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Session" ADD CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QRCode" ADD CONSTRAINT "QRCode_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "QRScan" ADD CONSTRAINT "QRScan_qrId_fkey" FOREIGN KEY ("qrId") REFERENCES "QRCode"("id") ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "Integration" ADD CONSTRAINT "Integration_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User"("id") ON DELETE CASCADE ON UPDATE CASCADE;

View File

@@ -1,22 +1,22 @@
/*
Warnings:
- A unique constraint covering the columns `[stripeCustomerId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[stripeSubscriptionId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateEnum
CREATE TYPE "Plan" AS ENUM ('FREE', 'PRO', 'BUSINESS');
-- AlterTable
ALTER TABLE "User" ADD COLUMN "plan" "Plan" NOT NULL DEFAULT 'FREE',
ADD COLUMN "stripeCurrentPeriodEnd" TIMESTAMP(3),
ADD COLUMN "stripeCustomerId" TEXT,
ADD COLUMN "stripePriceId" TEXT,
ADD COLUMN "stripeSubscriptionId" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "User_stripeCustomerId_key" ON "User"("stripeCustomerId");
-- CreateIndex
CREATE UNIQUE INDEX "User_stripeSubscriptionId_key" ON "User"("stripeSubscriptionId");
/*
Warnings:
- A unique constraint covering the columns `[stripeCustomerId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[stripeSubscriptionId]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateEnum
CREATE TYPE "Plan" AS ENUM ('FREE', 'PRO', 'BUSINESS');
-- AlterTable
ALTER TABLE "User" ADD COLUMN "plan" "Plan" NOT NULL DEFAULT 'FREE',
ADD COLUMN "stripeCurrentPeriodEnd" TIMESTAMP(3),
ADD COLUMN "stripeCustomerId" TEXT,
ADD COLUMN "stripePriceId" TEXT,
ADD COLUMN "stripeSubscriptionId" TEXT;
-- CreateIndex
CREATE UNIQUE INDEX "User_stripeCustomerId_key" ON "User"("stripeCustomerId");
-- CreateIndex
CREATE UNIQUE INDEX "User_stripeSubscriptionId_key" ON "User"("stripeSubscriptionId");

View File

@@ -1,67 +1,67 @@
/*
Warnings:
- The values [WIFI,EMAIL] on the enum `ContentType` will be removed. If these variants are still used in the database, this will fail.
- A unique constraint covering the columns `[resetPasswordToken]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "ContentType_new" AS ENUM ('URL', 'VCARD', 'GEO', 'PHONE', 'SMS', 'TEXT', 'WHATSAPP');
ALTER TABLE "QRCode" ALTER COLUMN "contentType" DROP DEFAULT;
ALTER TABLE "QRCode" ALTER COLUMN "contentType" TYPE "ContentType_new" USING ("contentType"::text::"ContentType_new");
ALTER TYPE "ContentType" RENAME TO "ContentType_old";
ALTER TYPE "ContentType_new" RENAME TO "ContentType";
DROP TYPE "ContentType_old";
ALTER TABLE "QRCode" ALTER COLUMN "contentType" SET DEFAULT 'URL';
COMMIT;
-- AlterTable
ALTER TABLE "User" ADD COLUMN "resetPasswordExpires" TIMESTAMP(3),
ADD COLUMN "resetPasswordToken" TEXT;
-- CreateTable
CREATE TABLE "NewsletterSubscription" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"source" TEXT NOT NULL DEFAULT 'ai-coming-soon',
"status" TEXT NOT NULL DEFAULT 'subscribed',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "NewsletterSubscription_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Lead" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"source" TEXT NOT NULL DEFAULT 'reprint-calculator',
"reprintCost" DOUBLE PRECISION,
"updatesPerYear" INTEGER,
"annualSavings" DOUBLE PRECISION,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Lead_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "NewsletterSubscription_email_key" ON "NewsletterSubscription"("email");
-- CreateIndex
CREATE INDEX "NewsletterSubscription_email_idx" ON "NewsletterSubscription"("email");
-- CreateIndex
CREATE INDEX "NewsletterSubscription_createdAt_idx" ON "NewsletterSubscription"("createdAt");
-- CreateIndex
CREATE INDEX "Lead_email_idx" ON "Lead"("email");
-- CreateIndex
CREATE INDEX "Lead_createdAt_idx" ON "Lead"("createdAt");
-- CreateIndex
CREATE INDEX "Lead_source_idx" ON "Lead"("source");
-- CreateIndex
CREATE UNIQUE INDEX "User_resetPasswordToken_key" ON "User"("resetPasswordToken");
/*
Warnings:
- The values [WIFI,EMAIL] on the enum `ContentType` will be removed. If these variants are still used in the database, this will fail.
- A unique constraint covering the columns `[resetPasswordToken]` on the table `User` will be added. If there are existing duplicate values, this will fail.
*/
-- AlterEnum
BEGIN;
CREATE TYPE "ContentType_new" AS ENUM ('URL', 'VCARD', 'GEO', 'PHONE', 'SMS', 'TEXT', 'WHATSAPP');
ALTER TABLE "QRCode" ALTER COLUMN "contentType" DROP DEFAULT;
ALTER TABLE "QRCode" ALTER COLUMN "contentType" TYPE "ContentType_new" USING ("contentType"::text::"ContentType_new");
ALTER TYPE "ContentType" RENAME TO "ContentType_old";
ALTER TYPE "ContentType_new" RENAME TO "ContentType";
DROP TYPE "ContentType_old";
ALTER TABLE "QRCode" ALTER COLUMN "contentType" SET DEFAULT 'URL';
COMMIT;
-- AlterTable
ALTER TABLE "User" ADD COLUMN "resetPasswordExpires" TIMESTAMP(3),
ADD COLUMN "resetPasswordToken" TEXT;
-- CreateTable
CREATE TABLE "NewsletterSubscription" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"source" TEXT NOT NULL DEFAULT 'ai-coming-soon',
"status" TEXT NOT NULL DEFAULT 'subscribed',
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "NewsletterSubscription_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "Lead" (
"id" TEXT NOT NULL,
"email" TEXT NOT NULL,
"source" TEXT NOT NULL DEFAULT 'reprint-calculator',
"reprintCost" DOUBLE PRECISION,
"updatesPerYear" INTEGER,
"annualSavings" DOUBLE PRECISION,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "Lead_pkey" PRIMARY KEY ("id")
);
-- CreateIndex
CREATE UNIQUE INDEX "NewsletterSubscription_email_key" ON "NewsletterSubscription"("email");
-- CreateIndex
CREATE INDEX "NewsletterSubscription_email_idx" ON "NewsletterSubscription"("email");
-- CreateIndex
CREATE INDEX "NewsletterSubscription_createdAt_idx" ON "NewsletterSubscription"("createdAt");
-- CreateIndex
CREATE INDEX "Lead_email_idx" ON "Lead"("email");
-- CreateIndex
CREATE INDEX "Lead_createdAt_idx" ON "Lead"("createdAt");
-- CreateIndex
CREATE INDEX "Lead_source_idx" ON "Lead"("source");
-- CreateIndex
CREATE UNIQUE INDEX "User_resetPasswordToken_key" ON "User"("resetPasswordToken");

View File

@@ -1,31 +1,31 @@
/*
Warnings:
- Added the required column `updatedAt` to the `Lead` table without a default value. This is not possible if the table is not empty.
*/
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.
ALTER TYPE "ContentType" ADD VALUE 'PDF';
ALTER TYPE "ContentType" ADD VALUE 'APP';
ALTER TYPE "ContentType" ADD VALUE 'COUPON';
ALTER TYPE "ContentType" ADD VALUE 'FEEDBACK';
-- DropIndex
DROP INDEX "Lead_createdAt_idx";
-- DropIndex
DROP INDEX "Lead_email_idx";
-- DropIndex
DROP INDEX "Lead_source_idx";
-- AlterTable
ALTER TABLE "Lead" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ALTER COLUMN "updatesPerYear" SET DATA TYPE DOUBLE PRECISION;
/*
Warnings:
- Added the required column `updatedAt` to the `Lead` table without a default value. This is not possible if the table is not empty.
*/
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.
ALTER TYPE "ContentType" ADD VALUE 'PDF';
ALTER TYPE "ContentType" ADD VALUE 'APP';
ALTER TYPE "ContentType" ADD VALUE 'COUPON';
ALTER TYPE "ContentType" ADD VALUE 'FEEDBACK';
-- DropIndex
DROP INDEX "Lead_createdAt_idx";
-- DropIndex
DROP INDEX "Lead_email_idx";
-- DropIndex
DROP INDEX "Lead_source_idx";
-- AlterTable
ALTER TABLE "Lead" ADD COLUMN "updatedAt" TIMESTAMP(3) NOT NULL,
ALTER COLUMN "updatesPerYear" SET DATA TYPE DOUBLE PRECISION;

View File

@@ -1,3 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "postgresql"

View File

@@ -1,117 +1,117 @@
import { PrismaClient } from '@prisma/client';
import * as bcrypt from 'bcryptjs';
const prisma = new PrismaClient();
async function main() {
// Create admin user for newsletter management
const hashedPassword = await bcrypt.hash('Timo.16092005', 12);
const user = await prisma.user.upsert({
where: { email: 'demo@qrmaster.net' },
update: {
password: hashedPassword, // Update password if user exists
},
create: {
email: 'demo@qrmaster.net',
name: 'Admin User',
password: hashedPassword,
},
});
console.log('Created/Updated admin user:', user.email);
// Create demo QR codes
const qrCodes = [
{
title: 'Support Phone',
contentType: 'PHONE' as const,
content: { phone: '+1-555-0123' },
tags: ['support', 'contact'],
slug: 'support-phone-demo',
},
{
title: 'Event Details',
contentType: 'URL' as const,
content: { url: 'https://example.com/event-2025' },
tags: ['event', 'conference'],
slug: 'event-details-demo',
},
{
title: 'Product Demo',
contentType: 'URL' as const,
content: { url: 'https://example.com/product-demo' },
tags: ['product', 'demo'],
slug: 'product-demo-qr',
},
{
title: 'Company Website',
contentType: 'URL' as const,
content: { url: 'https://company.example.com' },
tags: ['website', 'company'],
slug: 'company-website-qr',
},
{
title: 'Contact Card',
contentType: 'VCARD' as const,
content: {
firstName: 'John',
lastName: 'Doe',
email: 'john@company.com',
phone: '+1234567890',
organization: 'Example Corp',
title: 'CEO'
},
tags: ['contact', 'vcard'],
slug: 'contact-card-qr',
},
{
title: 'Event Details',
contentType: 'URL' as const,
content: { url: 'https://example.com/event-duplicate' },
tags: ['event', 'duplicate'],
slug: 'event-details-dup',
},
];
const baseDate = new Date('2025-08-07T10:00:00Z');
for (let i = 0; i < qrCodes.length; i++) {
const qrData = qrCodes[i];
const createdAt = new Date(baseDate.getTime() + i * 60000); // 1 minute apart
await prisma.qRCode.upsert({
where: { slug: qrData.slug },
update: {},
create: {
userId: user.id,
title: qrData.title,
type: 'DYNAMIC',
contentType: qrData.contentType,
content: qrData.content,
tags: qrData.tags,
status: 'ACTIVE',
style: {
foregroundColor: '#000000',
backgroundColor: '#FFFFFF',
cornerStyle: 'square',
size: 200,
},
slug: qrData.slug,
createdAt,
updatedAt: createdAt,
},
});
}
console.log('Created 6 demo QR codes');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
import { PrismaClient } from '@prisma/client';
import * as bcrypt from 'bcryptjs';
const prisma = new PrismaClient();
async function main() {
// Create admin user for newsletter management
const hashedPassword = await bcrypt.hash('Timo.16092005', 12);
const user = await prisma.user.upsert({
where: { email: 'demo@qrmaster.net' },
update: {
password: hashedPassword, // Update password if user exists
},
create: {
email: 'demo@qrmaster.net',
name: 'Admin User',
password: hashedPassword,
},
});
console.log('Created/Updated admin user:', user.email);
// Create demo QR codes
const qrCodes = [
{
title: 'Support Phone',
contentType: 'PHONE' as const,
content: { phone: '+1-555-0123' },
tags: ['support', 'contact'],
slug: 'support-phone-demo',
},
{
title: 'Event Details',
contentType: 'URL' as const,
content: { url: 'https://example.com/event-2025' },
tags: ['event', 'conference'],
slug: 'event-details-demo',
},
{
title: 'Product Demo',
contentType: 'URL' as const,
content: { url: 'https://example.com/product-demo' },
tags: ['product', 'demo'],
slug: 'product-demo-qr',
},
{
title: 'Company Website',
contentType: 'URL' as const,
content: { url: 'https://company.example.com' },
tags: ['website', 'company'],
slug: 'company-website-qr',
},
{
title: 'Contact Card',
contentType: 'VCARD' as const,
content: {
firstName: 'John',
lastName: 'Doe',
email: 'john@company.com',
phone: '+1234567890',
organization: 'Example Corp',
title: 'CEO'
},
tags: ['contact', 'vcard'],
slug: 'contact-card-qr',
},
{
title: 'Event Details',
contentType: 'URL' as const,
content: { url: 'https://example.com/event-duplicate' },
tags: ['event', 'duplicate'],
slug: 'event-details-dup',
},
];
const baseDate = new Date('2025-08-07T10:00:00Z');
for (let i = 0; i < qrCodes.length; i++) {
const qrData = qrCodes[i];
const createdAt = new Date(baseDate.getTime() + i * 60000); // 1 minute apart
await prisma.qRCode.upsert({
where: { slug: qrData.slug },
update: {},
create: {
userId: user.id,
title: qrData.title,
type: 'DYNAMIC',
contentType: qrData.contentType,
content: qrData.content,
tags: qrData.tags,
status: 'ACTIVE',
style: {
foregroundColor: '#000000',
backgroundColor: '#FFFFFF',
cornerStyle: 'square',
size: 200,
},
slug: qrData.slug,
createdAt,
updatedAt: createdAt,
},
});
}
console.log('Created 6 demo QR codes');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});