Set and handle open property on inactivity notices
This commit is contained in:
parent
3cc44bab83
commit
4adae3af51
@ -62,6 +62,16 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
requestedNotice.decisions = decisions;
|
requestedNotice.decisions = decisions;
|
||||||
|
|
||||||
|
if (Object.values(decisions).length === requestedNotice.departments.length) {
|
||||||
|
requestedNotice.open = false;
|
||||||
|
|
||||||
|
await context.env.D1.prepare(
|
||||||
|
"UPDATE inactivity_notices SET open = 0 WHERE id = ?;",
|
||||||
|
)
|
||||||
|
.bind(context.params.id)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
await context.env.DATA.put(
|
await context.env.DATA.put(
|
||||||
`inactivity_${context.params.id as string}`,
|
`inactivity_${context.params.id as string}`,
|
||||||
JSON.stringify(requestedNotice),
|
JSON.stringify(requestedNotice),
|
||||||
|
@ -24,6 +24,7 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
created_at: Date.now(),
|
created_at: Date.now(),
|
||||||
departments,
|
departments,
|
||||||
end,
|
end,
|
||||||
|
open: true,
|
||||||
reason,
|
reason,
|
||||||
start,
|
start,
|
||||||
user: {
|
user: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user