feat: add troop model and integrate troop handling in game logic
This commit is contained in:
@@ -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) => ({
|
||||
|
||||
Reference in New Issue
Block a user