Implement getAllFilesTypes in files controller

Added return statement to getTypes endpoint in files controller, utilizing the newly updated getAllFilesTypes method from the files service. Also fixed minor formatting issues.
This commit is contained in:
Mathis H (Avnyr) 2024-10-15 13:51:53 +02:00
parent 6bb9510356
commit 877e13043d
Signed by: Mathis
GPG Key ID: DD9E0666A747D126
2 changed files with 6 additions and 5 deletions

View File

@ -136,14 +136,14 @@ export class FilesController {
@HttpCode(HttpStatus.FOUND)
@Get("types")
async getTypes() {
//TODO
return await this.filesService.getAllFilesTypes();
}
@HttpCode(HttpStatus.CREATED)
@UseGuards(AdminGuard)
@Post("types/new")
async newType(@Body() body: CreateFileTypeDto) {
return await this.filesService.createFileType(body.name, body.mime)
return await this.filesService.createFileType(body.name, body.mime);
}
@HttpCode(HttpStatus.ACCEPTED)

View File

@ -285,12 +285,13 @@ export class FilesService {
*
* @return {Promise<Array>} Promise that resolves to an array of file types.
*/
public async getAllFilesTypes() {
return await this.database.use()
public async getAllFilesTypes(): Promise<Array<object>> {
return await this.database
.use()
.select()
.from(FilesTypesTable)
.prepare("getAllFilesTypes")
.execute()
.execute();
}
public async removeFileType() {