Skip to content

Commit

Permalink
Raise state
Browse files Browse the repository at this point in the history
  • Loading branch information
cultpodcasts committed Feb 18, 2024
1 parent 7188790 commit 5f310c4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,15 @@ export default {
.prepare("SELECT id FROM urls WHERE state=0");
let result = await submissionIds.all();
if (result.success) {
return new Response(JSON.stringify(result.results))
let raiseState = await env.DB
.prepare("UPDATE urls SET state=1 WHERE id IN (?)")
.bind(result.results)
.run();
if (raiseState.success) {
return new Response(JSON.stringify(result.results))
} else {
return new Response("Failure to raise state of new submissons in ids " + result.results.join(", "), { status: 400 })
}
} else {
return new Response(result.error, { status: 500 });
}
Expand Down

0 comments on commit 5f310c4

Please sign in to comment.