forked from noxious/server
Moved service logic from repo to service, minor improvements, working hair customisation proof of concept
This commit is contained in:
@ -2,6 +2,7 @@ import { Server } from 'socket.io'
|
||||
import { TSocket } from '../../utilities/types'
|
||||
import { Character, Zone } from '@prisma/client'
|
||||
import CharacterRepository from '../../repositories/characterRepository'
|
||||
import { CharacterService } from '../../services/characterService'
|
||||
|
||||
type TypePayload = {
|
||||
characterId: number
|
||||
@ -24,7 +25,8 @@ export default class CharacterDeleteEvent {
|
||||
|
||||
private async handleCharacterDelete(data: TypePayload, callback: (response: TypeResponse) => void): Promise<any> {
|
||||
try {
|
||||
await CharacterRepository.deleteByUserIdAndId(this.socket.userId!, data.characterId!)
|
||||
const characterService = new CharacterService()
|
||||
await characterService.deleteByUserIdAndId(this.socket.userId!, data.characterId!)
|
||||
|
||||
const characters: Character[] = (await CharacterRepository.getByUserId(this.socket.userId!)) as Character[]
|
||||
|
||||
|
Reference in New Issue
Block a user