1
0
forked from noxious/server

Added populate attributes to functions

This commit is contained in:
2025-01-03 18:23:48 +01:00
parent 0c155347c4
commit 0cadbc33b9
4 changed files with 82 additions and 41 deletions

View File

@ -22,7 +22,7 @@ export default class CharacterConnectEvent extends BaseEvent {
return
}
const character = await CharacterRepository.getByUserAndId(this.socket.userId!, data.characterId)
const character = await CharacterRepository.getByUserAndId(this.socket.userId!, data.characterId, ['characterHair', 'characterHair'])
if (!character) {
this.emitError('Character not found or does not belong to this user')

View File

@ -9,7 +9,11 @@ export default class CharacterListEvent extends BaseEvent {
private async handleEvent(data: any): Promise<void> {
try {
let characters: Character[] = await CharacterRepository.getByUserId(this.socket.userId!, ['characterType', 'characterHair'])
let characters: Character[] = await CharacterRepository.getByUserId(this.socket.userId!, [
'characterType',
'characterHair'
])
this.socket.emit('character:list', characters)
} catch (error: any) {
this.logger.error('character:list error', error.message)