Add initial methods for file uploading
Implemented placeholders for saving a file in the files service and added a new POST endpoint in the files controller. These changes lay the groundwork for future development of file uploading functionality.
This commit is contained in:
parent
3eca2472c6
commit
addcd4a798
@ -1,16 +1,19 @@
|
||||
import { Controller, Get, Param, StreamableFile } from '@nestjs/common';
|
||||
import { Controller, Get, Param, Post, StreamableFile } from '@nestjs/common';
|
||||
import { FilesService } from "./files.service";
|
||||
|
||||
@Controller("files")
|
||||
export class FilesController {
|
||||
constructor(private readonly filesService: FilesService) {}
|
||||
|
||||
//TODO the file name, replace spaces to underscore and deliver it via the response
|
||||
//TODO POST FILE
|
||||
@Post('new')
|
||||
async saveFile() {
|
||||
|
||||
}
|
||||
|
||||
@Get(':fileId')
|
||||
async getFile(@Param('fileId') fileId: string) {
|
||||
return this.filesService.get(fileId);
|
||||
}
|
||||
|
||||
//TODO POST FILE
|
||||
|
||||
}
|
||||
|
@ -54,4 +54,11 @@ export class FilesService {
|
||||
disposition: `attachment; filename="${fileNameWithoutSpaces}.${fileInformation.fileType.ext.toLowerCase()}"`
|
||||
});
|
||||
}
|
||||
|
||||
//TODO list the files
|
||||
|
||||
//TODO save a file
|
||||
public async set() {
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user