2024-01-05 13:22:56 -06:00
|
|
|
/// <reference no-default-lib="true" />
|
|
|
|
/// <reference lib="dom" />
|
|
|
|
/// <reference lib="dom.iterable" />
|
|
|
|
/// <reference lib="dom.asynciterable" />
|
|
|
|
/// <reference lib="deno.ns" />
|
2024-01-05 21:10:38 -06:00
|
|
|
/// <reference lib="deno.unstable" />
|
2024-01-05 13:22:56 -06:00
|
|
|
|
|
|
|
import '$std/dotenv/load.ts'
|
|
|
|
|
|
|
|
import { start } from '$fresh/server.ts'
|
|
|
|
import manifest from './fresh.gen.ts'
|
|
|
|
import config from './fresh.config.ts'
|
2024-01-21 20:15:43 -06:00
|
|
|
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)
|
|
|
|
},
|
|
|
|
)
|
|
|
|
})
|
2024-01-05 13:22:56 -06:00
|
|
|
|
|
|
|
await start(manifest, config)
|