first commit

This commit is contained in:
2026-07-16 17:37:25 +02:00
commit 61054537c5
40 changed files with 8211 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum Specialty {
ZOMBIE
SHADOW
}
enum Zone {
WORLD
DUNGEON
}
enum ItemSlot {
WEAPON
ARMOR
ACCESSORY
CONSUMABLE
}
enum ArmyUnitType {
ZOMBIE
SHADOW
}
model User {
id String @id @default(cuid())
email String @unique
passwordHash String
createdAt DateTime @default(now())
character Character?
}
model Character {
id String @id @default(cuid())
userId String @unique
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
name String
specialty Specialty
level Int @default(1)
xp Int @default(0)
unspentStatPoints Int @default(0)
hp Int @default(100)
maxHp Int @default(100)
energy Int @default(50)
maxEnergy Int @default(50)
str Int @default(5)
dex Int @default(5)
int Int @default(5)
mapX Int @default(5)
mapY Int @default(5)
currentZone Zone @default(WORLD)
dungeonFloor Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
inventory InventoryItem[]
army ArmyUnit[]
}
model Item {
id String @id @default(cuid())
key String @unique
name String
description String
slot ItemSlot
strBonus Int @default(0)
dexBonus Int @default(0)
intBonus Int @default(0)
hpBonus Int @default(0)
rarity String @default("common")
inventory InventoryItem[]
}
model InventoryItem {
id String @id @default(cuid())
characterId String
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
itemId String
item Item @relation(fields: [itemId], references: [id])
equipped Boolean @default(false)
quantity Int @default(1)
@@index([characterId])
}
model ArmyUnit {
id String @id @default(cuid())
characterId String
character Character @relation(fields: [characterId], references: [id], onDelete: Cascade)
type ArmyUnitType
tier Int @default(1)
count Int @default(1)
@@unique([characterId, type, tier])
@@index([characterId])
}
+92
View File
@@ -0,0 +1,92 @@
import { PrismaClient, ItemSlot } from "@prisma/client";
const prisma = new PrismaClient();
const items = [
{
key: "bone_dagger",
name: "Bone Dagger",
description: "A crude blade carved from a fallen warrior.",
slot: ItemSlot.WEAPON,
strBonus: 2,
dexBonus: 1,
intBonus: 0,
hpBonus: 0,
rarity: "common",
},
{
key: "shadow_veil",
name: "Shadow Veil",
description: "Cloth woven from twilight itself.",
slot: ItemSlot.ARMOR,
strBonus: 0,
dexBonus: 2,
intBonus: 1,
hpBonus: 10,
rarity: "common",
},
{
key: "grimoire_fragment",
name: "Grimoire Fragment",
description: "Pages torn from a forbidden tome.",
slot: ItemSlot.ACCESSORY,
strBonus: 0,
dexBonus: 0,
intBonus: 3,
hpBonus: 0,
rarity: "uncommon",
},
{
key: "necrotic_blade",
name: "Necrotic Blade",
description: "Steel that drinks life force.",
slot: ItemSlot.WEAPON,
strBonus: 4,
dexBonus: 0,
intBonus: 2,
hpBonus: 0,
rarity: "rare",
},
{
key: "ossuary_plate",
name: "Ossuary Plate",
description: "Armor fashioned from countless bones.",
slot: ItemSlot.ARMOR,
strBonus: 2,
dexBonus: 0,
intBonus: 0,
hpBonus: 25,
rarity: "rare",
},
{
key: "soul_phial",
name: "Soul Phial",
description: "A vial of restless essence. Restores energy.",
slot: ItemSlot.CONSUMABLE,
strBonus: 0,
dexBonus: 0,
intBonus: 0,
hpBonus: 0,
rarity: "common",
},
];
async function main() {
for (const item of items) {
await prisma.item.upsert({
where: { key: item.key },
update: item,
create: item,
});
}
console.log(`Seeded ${items.length} items.`);
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});