18 lines
424 B
TypeScript
18 lines
424 B
TypeScript
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;
|
|
};
|