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:
parent
6bb9510356
commit
877e13043d
@ -136,14 +136,14 @@ export class FilesController {
|
|||||||
@HttpCode(HttpStatus.FOUND)
|
@HttpCode(HttpStatus.FOUND)
|
||||||
@Get("types")
|
@Get("types")
|
||||||
async getTypes() {
|
async getTypes() {
|
||||||
//TODO
|
return await this.filesService.getAllFilesTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@HttpCode(HttpStatus.CREATED)
|
@HttpCode(HttpStatus.CREATED)
|
||||||
@UseGuards(AdminGuard)
|
@UseGuards(AdminGuard)
|
||||||
@Post("types/new")
|
@Post("types/new")
|
||||||
async newType(@Body() body: CreateFileTypeDto) {
|
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)
|
@HttpCode(HttpStatus.ACCEPTED)
|
||||||
|
@ -285,12 +285,13 @@ export class FilesService {
|
|||||||
*
|
*
|
||||||
* @return {Promise<Array>} Promise that resolves to an array of file types.
|
* @return {Promise<Array>} Promise that resolves to an array of file types.
|
||||||
*/
|
*/
|
||||||
public async getAllFilesTypes() {
|
public async getAllFilesTypes(): Promise<Array<object>> {
|
||||||
return await this.database.use()
|
return await this.database
|
||||||
|
.use()
|
||||||
.select()
|
.select()
|
||||||
.from(FilesTypesTable)
|
.from(FilesTypesTable)
|
||||||
.prepare("getAllFilesTypes")
|
.prepare("getAllFilesTypes")
|
||||||
.execute()
|
.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async removeFileType() {
|
public async removeFileType() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user