ADD: changed to rect router

This commit is contained in:
hwinkel
2026-03-10 21:49:01 +01:00
parent 44e79e657f
commit 4bc57b2c4e
102 changed files with 5067 additions and 4824 deletions
@@ -0,0 +1,110 @@
-- CreateTable
CREATE TABLE `users` (
`id` VARCHAR(191) NOT NULL,
`email` VARCHAR(191) NOT NULL,
`passwordHash` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
UNIQUE INDEX `users_email_key`(`email`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `companies` (
`id` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`legalForm` VARCHAR(191) NULL,
`taxId` VARCHAR(191) NULL,
`vatId` VARCHAR(191) NULL,
`address` VARCHAR(191) NOT NULL,
`zip` VARCHAR(191) NOT NULL,
`city` VARCHAR(191) NOT NULL,
`country` VARCHAR(191) NOT NULL DEFAULT 'DE',
`email` VARCHAR(191) NULL,
`phone` VARCHAR(191) NULL,
`website` VARCHAR(191) NULL,
`bankIban` VARCHAR(191) NULL,
`bankBic` VARCHAR(191) NULL,
`bankName` VARCHAR(191) NULL,
`invoicePrefix` VARCHAR(191) NOT NULL DEFAULT 'RE',
`invoiceSequence` INTEGER NOT NULL DEFAULT 0,
`userId` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `customers` (
`id` VARCHAR(191) NOT NULL,
`companyId` VARCHAR(191) NOT NULL,
`name` VARCHAR(191) NOT NULL,
`vatId` VARCHAR(191) NULL,
`taxId` VARCHAR(191) NULL,
`address` VARCHAR(191) NOT NULL,
`zip` VARCHAR(191) NOT NULL,
`city` VARCHAR(191) NOT NULL,
`country` VARCHAR(191) NOT NULL DEFAULT 'DE',
`email` VARCHAR(191) NULL,
`phone` VARCHAR(191) NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `invoices` (
`id` VARCHAR(191) NOT NULL,
`number` VARCHAR(191) NOT NULL,
`companyId` VARCHAR(191) NOT NULL,
`customerId` VARCHAR(191) NOT NULL,
`issueDate` DATETIME(3) NOT NULL,
`deliveryDate` DATETIME(3) NULL,
`dueDate` DATETIME(3) NOT NULL,
`status` ENUM('DRAFT', 'SENT', 'PAID', 'CANCELLED') NOT NULL DEFAULT 'DRAFT',
`notes` TEXT NULL,
`netTotal` DECIMAL(10, 2) NOT NULL,
`taxTotal` DECIMAL(10, 2) NOT NULL,
`grossTotal` DECIMAL(10, 2) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
UNIQUE INDEX `invoices_companyId_number_key`(`companyId`, `number`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `invoice_items` (
`id` VARCHAR(191) NOT NULL,
`invoiceId` VARCHAR(191) NOT NULL,
`position` INTEGER NOT NULL,
`description` TEXT NOT NULL,
`quantity` DECIMAL(10, 3) NOT NULL,
`unit` VARCHAR(191) NULL,
`unitPrice` DECIMAL(10, 2) NOT NULL,
`taxRate` DECIMAL(5, 2) NOT NULL,
`netAmount` DECIMAL(10, 2) NOT NULL,
`taxAmount` DECIMAL(10, 2) NOT NULL,
`grossAmount` DECIMAL(10, 2) NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `companies` ADD CONSTRAINT `companies_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `customers` ADD CONSTRAINT `customers_companyId_fkey` FOREIGN KEY (`companyId`) REFERENCES `companies`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `invoices` ADD CONSTRAINT `invoices_companyId_fkey` FOREIGN KEY (`companyId`) REFERENCES `companies`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `invoices` ADD CONSTRAINT `invoices_customerId_fkey` FOREIGN KEY (`customerId`) REFERENCES `customers`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE `invoice_items` ADD CONSTRAINT `invoice_items_invoiceId_fkey` FOREIGN KEY (`invoiceId`) REFERENCES `invoices`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
+3
View File
@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "mysql"
+1 -1
View File
@@ -7,7 +7,7 @@ async function main() {
console.log("Seeding database...");
// Create demo user
const passwordHash = await bcrypt.hash("demo123", 12);
const passwordHash = await bcrypt.hash("annas_password", 12);
const user = await prisma.user.upsert({
where: { email: "anna@example.de" },
update: {},