import { Controller, All, Req, Res, Get, Post, Patch, Param, Delete, Head, Options, NotFoundException, HttpException, HttpStatus, Body, } from '@nestjs/common'; import { Request, Response } from 'express'; import { TusService } from './tus.service'; import { ResourceService } from '@server/models/resource/resource.service'; interface ResourceMeta { filename: string; filetype: string; filesize: string; } @Controller('upload') export class UploadController { constructor( private readonly tusService: TusService, private readonly resourceService: ResourceService, ) {} // @Post() // async handlePost(@Req() req: Request, @Res() res: Response) { // return this.tusService.handleTus(req, res); // } @Options() async handleOptions(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } @Head() async handleHead(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } @Post() async handlePost(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } @Get('/*') async handleGet(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } @Patch('/*') async handlePatch(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } // Keeping the catch-all method as a fallback @All() async handleUpload(@Req() req: Request, @Res() res: Response) { return this.tusService.handleTus(req, res); } }