added zone demo logic for dev purposes

This commit is contained in:
2024-05-11 19:12:49 +02:00
parent b3a2d8bfaa
commit c49a2563f8
4 changed files with 58 additions and 9 deletions

View File

@ -1,13 +1,26 @@
import {LoadedZoneEntity} from "../entities/LoadedZoneEntity";
import {Zone} from "@prisma/client";
import ZoneRepository from "../repositories/zone.repository";
class ZoneService
{
public loaded: LoadedZoneEntity[] = [];
public boot() {
// Load all zones
// const zones = await new ZoneRepository().getAll();
// this.loadedZones = zones;
async createDemoZone(): Promise<boolean>
{
const zoneRepo = new ZoneRepository();
await zoneRepo.create("Demo Zone", 10, 10, [
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 1, 1, 1, 1, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
])
console.log("Demo zone created.");
return true;
}
}
}
export default ZoneService;