SpaceNinjaServer/src/services/worldStateService.ts

17 lines
421 B
TypeScript
Raw Normal View History

2024-06-17 03:31:49 +02:00
import { WorldState } from "@/src/models/worldStateModel";
import buildConfig from "@/static/data/buildConfig.json";
export const createWorldState = async () => {
const worldState = new WorldState()
await worldState.save();
return worldState;
}
export const getWorldState = async () => {
let ws = await WorldState.findOne();
if (!ws) {
ws = await createWorldState();
}
return ws;
};