feat: add troop model and integrate troop handling in game logic

This commit is contained in:
2025-12-30 05:41:16 +00:00
parent 648d186428
commit 519a0a76cb
12 changed files with 188 additions and 14 deletions
@@ -121,6 +121,7 @@ export const seedScenarioToDatabase = async (
await prisma.event.deleteMany();
await prisma.diplomacy.deleteMany();
await prisma.general.deleteMany();
await prisma.troop.deleteMany();
await prisma.city.deleteMany();
await prisma.nation.deleteMany();
await prisma.worldState.deleteMany();
@@ -239,6 +240,16 @@ export const seedScenarioToDatabase = async (
});
}
if (seed.troops.length > 0) {
await prisma.troop.createMany({
data: seed.troops.map((troop) => ({
troopLeaderId: troop.id,
nationId: troop.nationId,
name: troop.name,
})),
});
}
if (seed.diplomacy.length > 0) {
await prisma.diplomacy.createMany({
data: seed.diplomacy.map((row) => ({