Add processing key check for reports

This commit is contained in:
regalijan 2023-10-19 16:49:45 -04:00
parent c7945de0ac
commit e84b02c403
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -34,6 +34,17 @@ export async function onRequestGet(context: RequestContext) {
if (!item) if (!item)
item = await context.env.DATA.get(`closed${types[type].prefix}${itemId}`); item = await context.env.DATA.get(`closed${types[type].prefix}${itemId}`);
if (
type === "report" &&
(await context.env.DATA.get(`reportprocessing_${itemId}`))
)
return new Response('{"error":"Report is processing"}', {
headers: {
"content-type": "application/json",
},
status: 409,
});
return new Response(item ? item : '{"error":"Not found"}', { return new Response(item ? item : '{"error":"Not found"}', {
headers: { headers: {
"content-type": "application/json", "content-type": "application/json",