Fixed
This commit is contained in:
parent
2aaeb1ac7f
commit
53b36b1957
13
main.ts
13
main.ts
|
@ -10,5 +10,18 @@ import '$std/dotenv/load.ts'
|
||||||
import { start } from '$fresh/server.ts'
|
import { start } from '$fresh/server.ts'
|
||||||
import manifest from './fresh.gen.ts'
|
import manifest from './fresh.gen.ts'
|
||||||
import config from './fresh.config.ts'
|
import config from './fresh.config.ts'
|
||||||
|
import { kv } from '@homeman/db.ts'
|
||||||
|
import { Task } from '@homeman/models.ts'
|
||||||
|
|
||||||
|
Deno.cron('Reset daily tasks', '0 4 * * *', async () => {
|
||||||
|
console.log('4am daily tasks reset')
|
||||||
|
const tasks = await Array.fromAsync(kv.list<Task>({ prefix: ['task'] }))
|
||||||
|
tasks.forEach(
|
||||||
|
async (t) => {
|
||||||
|
const nv = { ...t.value, doneAt: null }
|
||||||
|
await kv.set(t.key, nv)
|
||||||
|
},
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
await start(manifest, config)
|
await start(manifest, config)
|
||||||
|
|
Loading…
Reference in a new issue