forked from noxious/server
Tile CRUD works again
This commit is contained in:
@ -1,24 +1,17 @@
|
||||
import { Tile } from '@prisma/client'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
import { TSocket } from '#application/types'
|
||||
import characterRepository from '#repositories/characterRepository'
|
||||
import TileRepository from '#repositories/tileRepository'
|
||||
import { BaseEvent } from '#application/base/baseEvent'
|
||||
import { Tile } from '#entities/tile'
|
||||
|
||||
interface IPayload {}
|
||||
|
||||
export default class TileListEvent {
|
||||
constructor(
|
||||
private readonly io: Server,
|
||||
private readonly socket: TSocket
|
||||
) {}
|
||||
|
||||
export default class TileListEven extends BaseEvent {
|
||||
public listen(): void {
|
||||
this.socket.on('gm:tile:list', this.handleEvent.bind(this))
|
||||
}
|
||||
|
||||
private async handleEvent(data: any, callback: (response: Tile[]) => void): Promise<void> {
|
||||
const character = await characterRepository.getById(this.socket.characterId as number)
|
||||
private async handleEvent(data: IPayload, callback: (response: Tile[]) => void): Promise<void> {
|
||||
const character = await characterRepository.getById(this.socket.characterId!)
|
||||
if (!character) return
|
||||
|
||||
if (character.role !== 'gm') {
|
||||
|
Reference in New Issue
Block a user