Finish appeal[id] middleware
This commit is contained in:
parent
55817306d2
commit
75005da3b3
@ -10,15 +10,18 @@ export async function onRequestPost(context: RequestContext) {
|
||||
});
|
||||
|
||||
const { body } = context.data;
|
||||
const id = context.params.id as string;
|
||||
|
||||
if (typeof body.accept !== "boolean")
|
||||
return new Response('{"error":"Invalid acceptance status"}', {
|
||||
if (id.search(/^\d{16,19}$/) === -1)
|
||||
return new Response('{"error":"Invalid target id"}', {
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
},
|
||||
status: 400,
|
||||
});
|
||||
|
||||
context.data.targetId = id;
|
||||
|
||||
if (
|
||||
body.feedback &&
|
||||
(typeof body.feedback !== "string" || body.feedback.length > 512)
|
||||
@ -29,4 +32,6 @@ export async function onRequestPost(context: RequestContext) {
|
||||
},
|
||||
status: 400,
|
||||
});
|
||||
|
||||
return await context.next();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user