v3: allow users to edit dump title
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 2m54s
All checks were successful
Build and Publish Docker Image / build-and-push (push) Successful in 2m54s
This commit is contained in:
@@ -39,6 +39,7 @@ router.post(
|
||||
const formData = await ctx.request.body.formData();
|
||||
const file = formData.get("file");
|
||||
const comment = formData.get("comment");
|
||||
const title = formData.get("title");
|
||||
const isPrivate = formData.get("isPrivate") === "true";
|
||||
|
||||
if (!(file instanceof File)) {
|
||||
@@ -54,6 +55,7 @@ router.post(
|
||||
typeof comment === "string" && comment ? comment : undefined,
|
||||
userId,
|
||||
isPrivate,
|
||||
typeof title === "string" && title ? title : undefined,
|
||||
);
|
||||
} else {
|
||||
const body = await ctx.request.body.json();
|
||||
@@ -109,6 +111,7 @@ router.put("/:dumpId/file", authMiddleware, async (ctx) => {
|
||||
const formData = await ctx.request.body.formData();
|
||||
const file = formData.get("file");
|
||||
const comment = formData.get("comment");
|
||||
const title = formData.get("title");
|
||||
|
||||
if (!(file instanceof File)) {
|
||||
throw new APIException(
|
||||
@@ -122,6 +125,7 @@ router.put("/:dumpId/file", authMiddleware, async (ctx) => {
|
||||
dumpId,
|
||||
file,
|
||||
typeof comment === "string" && comment ? comment : undefined,
|
||||
typeof title === "string" && title ? title : undefined,
|
||||
);
|
||||
const responseBody: APIResponse<Dump> = { success: true, data: updatedDump };
|
||||
ctx.response.body = responseBody;
|
||||
|
||||
Reference in New Issue
Block a user