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 { body } = context.data;
|
||||||
|
const id = context.params.id as string;
|
||||||
|
|
||||||
if (typeof body.accept !== "boolean")
|
if (id.search(/^\d{16,19}$/) === -1)
|
||||||
return new Response('{"error":"Invalid acceptance status"}', {
|
return new Response('{"error":"Invalid target id"}', {
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
},
|
},
|
||||||
status: 400,
|
status: 400,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
context.data.targetId = id;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
body.feedback &&
|
body.feedback &&
|
||||||
(typeof body.feedback !== "string" || body.feedback.length > 512)
|
(typeof body.feedback !== "string" || body.feedback.length > 512)
|
||||||
@ -29,4 +32,6 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
},
|
},
|
||||||
status: 400,
|
status: 400,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return await context.next();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user