import { BaseService } from '#application/base/baseService' import { World } from '#entities/world' import WorldRepository from '#repositories/worldRepository' class WorldService extends BaseService { async update(worldData: Partial): Promise { try { let world = await WorldRepository.getFirst() if (!world) { world = new World() } world.setDate(worldData.date || new Date()) if (worldData.isRainEnabled) { world.setIsRainEnabled(worldData.isRainEnabled) } if (worldData.rainPercentage) { world.setRainPercentage(worldData.rainPercentage) } if (worldData.isFogEnabled) { world.setIsFogEnabled(worldData.isFogEnabled) } if (worldData.fogDensity) { world.setFogDensity(worldData.fogDensity) } await world.save() return true } catch (error: any) { this.logger.error(`Failed to update world: ${error instanceof Error ? error.message : String(error)}`) return false } } } export default new WorldService()