Compare commits
3 Commits
1c78912f99
...
8ee5410c91
| Author | SHA1 | Date | |
|---|---|---|---|
|
8ee5410c91
|
|||
|
e7830095b3
|
|||
|
055c48dbf9
|
@@ -1,6 +1,7 @@
|
||||
import { IncomingMessage } from "node:http";
|
||||
import {
|
||||
BadRequestException,
|
||||
Body,
|
||||
Controller,
|
||||
DefaultValuePipe,
|
||||
Delete,
|
||||
@@ -9,6 +10,7 @@ import {
|
||||
HttpStatus,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
ParseUUIDPipe,
|
||||
Post,
|
||||
Query,
|
||||
Req,
|
||||
@@ -18,6 +20,7 @@ import {
|
||||
StreamableFile,
|
||||
UseGuards,
|
||||
} from "@nestjs/common";
|
||||
import { CreateFileTypeDto } from "apps/backend/src/app/files/files.dto";
|
||||
import { AdminGuard, InsertAdminState } from "../auth/auth.guard";
|
||||
import { FilesService } from "./files.service";
|
||||
|
||||
@@ -25,8 +28,8 @@ import { FilesService } from "./files.service";
|
||||
export class FilesController {
|
||||
constructor(private readonly filesService: FilesService) {}
|
||||
|
||||
@UseGuards(InsertAdminState)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@UseGuards(InsertAdminState)
|
||||
@Post("new")
|
||||
async saveFile(@Req() req: IncomingMessage, @Res() res: Response) {
|
||||
let fileBuffer: Buffer = Buffer.from([]);
|
||||
@@ -123,10 +126,30 @@ export class FilesController {
|
||||
return await this.filesService.get(fileId);
|
||||
}
|
||||
|
||||
@UseGuards(AdminGuard)
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@UseGuards(AdminGuard)
|
||||
@Delete(":fileId")
|
||||
async deleteFile(@Param("fileId") fileId: string) {
|
||||
async deleteFile(@Param("fileId", ParseUUIDPipe) fileId: string) {
|
||||
return await this.filesService.deleteFile(fileId);
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.FOUND)
|
||||
@Get("types")
|
||||
async getTypes() {
|
||||
//TODO
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@UseGuards(AdminGuard)
|
||||
@Post("types/new")
|
||||
async newType(@Body() body: CreateFileTypeDto) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
@HttpCode(HttpStatus.ACCEPTED)
|
||||
@UseGuards(AdminGuard)
|
||||
@Delete("types/:typeId")
|
||||
async delType(@Param(":typeId", ParseUUIDPipe) typeId: string) {
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,3 +16,7 @@ export class CreateFilesDto {
|
||||
@IsUUID()
|
||||
groupId: string;
|
||||
}
|
||||
|
||||
export class CreateFileTypeDto {
|
||||
//TODO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user