forked from noxious/server
Minor repo improvement
This commit is contained in:
parent
f4746722af
commit
1b87f1dd91
@ -8,8 +8,6 @@ class WorldService {
|
|||||||
let world = await WorldRepository.getFirst()
|
let world = await WorldRepository.getFirst()
|
||||||
if (!world) {
|
if (!world) {
|
||||||
world = new World()
|
world = new World()
|
||||||
|
|
||||||
await world.save()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
world.date = worldData.date || new Date()
|
world.date = worldData.date || new Date()
|
||||||
@ -27,9 +25,7 @@ class WorldService {
|
|||||||
world.fogDensity = worldData.fogDensity
|
world.fogDensity = worldData.fogDensity
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(world.date)
|
await world.save()
|
||||||
|
|
||||||
await world.update()
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Server } from 'socket.io'
|
import { Server } from 'socket.io'
|
||||||
import { TSocket } from '#application/types'
|
import { TSocket } from '#application/types'
|
||||||
import prisma from '#application/prisma'
|
|
||||||
import characterRepository from '#repositories/characterRepository'
|
|
||||||
import { gameMasterLogger } from '#application/logger'
|
import { gameMasterLogger } from '#application/logger'
|
||||||
|
import characterRepository from '#repositories/characterRepository'
|
||||||
|
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||||
|
|
||||||
interface IPayload {
|
interface IPayload {
|
||||||
id: number
|
id: number
|
||||||
@ -27,10 +27,10 @@ export default class CharacterTypeDeleteEvent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await prisma.characterType.delete({
|
const characterType = await CharacterTypeRepository.getById(data.id)
|
||||||
where: { id: data.id }
|
if (!characterType) return callback(false)
|
||||||
})
|
|
||||||
|
|
||||||
|
await characterType.delete()
|
||||||
callback(true)
|
callback(true)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
gameMasterLogger.error(`Error deleting character type ${data.id}: ${error instanceof Error ? error.message : String(error)}`)
|
gameMasterLogger.error(`Error deleting character type ${data.id}: ${error instanceof Error ? error.message : String(error)}`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user