Minor repo improvement
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
import { Server } from 'socket.io'
|
||||
import { TSocket } from '#application/types'
|
||||
import prisma from '#application/prisma'
|
||||
import characterRepository from '#repositories/characterRepository'
|
||||
import { gameMasterLogger } from '#application/logger'
|
||||
import characterRepository from '#repositories/characterRepository'
|
||||
import CharacterTypeRepository from '#repositories/characterTypeRepository'
|
||||
|
||||
interface IPayload {
|
||||
id: number
|
||||
@ -27,10 +27,10 @@ export default class CharacterTypeDeleteEvent {
|
||||
}
|
||||
|
||||
try {
|
||||
await prisma.characterType.delete({
|
||||
where: { id: data.id }
|
||||
})
|
||||
const characterType = await CharacterTypeRepository.getById(data.id)
|
||||
if (!characterType) return callback(false)
|
||||
|
||||
await characterType.delete()
|
||||
callback(true)
|
||||
} catch (error) {
|
||||
gameMasterLogger.error(`Error deleting character type ${data.id}: ${error instanceof Error ? error.message : String(error)}`)
|
||||
|
Reference in New Issue
Block a user