More typescript improvements

This commit is contained in:
2025-02-07 20:54:55 +01:00
parent f5e7d10fb4
commit 52b8a9b7ad
12 changed files with 35 additions and 14 deletions

View File

@ -27,7 +27,7 @@ export class AvatarController extends BaseController {
* @param res
*/
public async getByName(req: Request, res: Response) {
const character = await this.characterRepository.getByName(req.params.characterName)
const character = await this.characterRepository.getByName(req.params.characterName!)
if (!character?.characterType) {
return this.sendError(res, 'Character or character type not found', 404)
}

View File

@ -12,6 +12,10 @@ export class TexturesController extends BaseController {
public async download(req: Request, res: Response) {
const { type, spriteId, file } = req.params
if (!type || !file) {
return this.sendError(res, 'Invalid request', 400)
}
const texture = type === 'sprites' && spriteId ? Storage.getPublicPath(type, spriteId, file) : Storage.getPublicPath(type, file)
this.sendFile(res, texture)