homeman-deno/playground.ts

63 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-01-21 14:23:45 -06:00
import { DailyPhase, TaskModel } from '@homeman/models.ts'
2024-01-21 15:52:46 -06:00
import { kv } from '@homeman/db.ts'
2024-01-21 14:23:45 -06:00
import { ulid } from 'https://deno.land/x/ulid@v0.3.0/mod.ts'
const hardcoded: Record<DailyPhase, [string, string][]> = {
'Morning': [
['🥣', 'Breakfast'],
['🪥', 'Brush teeth'],
['👕', 'Get dressed'],
['🙏', 'Ask and thank Jesus'],
['✝️', 'Bible story or devotional'],
['📚', 'School: with Mrs. Emily or Mama'],
['🎨', 'Create time: 🧶craft ✏️ draw 🧑🏼‍🎨 paint'],
['🏗️', ' Build time: 🧱legos 🚂train tracks 🏎magna tiles'],
['👯', 'Friend time: playdate or neighbor time'],
['🚗', 'Outing: 📚library 🌳park 🥑groceries ☕ coffee shop'],
],
'Midday': [
['🥓', 'Lunch'],
['🧹', 'Tidy time'],
['🤫', 'Quiet time'],
['🏃', 'BIG energy time: 🚲bike 🥁 drums 🤸 silly play'],
['👯', 'Friend time: playdate or neighbor time'],
['🚗', 'Outing: 📚library 🌳park 🥑groceries'],
],
'Evening': [
['🍽️', 'Dinner'],
['🚗', 'Outing'],
['👪', 'Family time: 🃏games 🕺dance party 🤸silly play 🏋workout'],
],
'Bedtime': [
['🪥', 'Brush teeth'],
['🛁', 'Take bath'],
['👕', 'Put on pajamas'],
['🙏', 'Ask and thank Jesus'],
['✝️', 'Bible story or devotional'],
['📕', 'Read a story'],
['❤', 'Emotions check in: 😭 😡 😂 😟 😣 😀 ☹️ 😰 😁'],
],
'Night': [
['👨‍⚖️', 'Sleep!'],
],
}
2024-01-21 15:52:46 -06:00
console.log({ kv })
2024-01-21 14:23:45 -06:00
Object.entries(hardcoded).forEach(async ([tphase, phaseTasks]) => {
const phase = tphase as DailyPhase
for (const [emoji, description] of phaseTasks) {
const task = TaskModel.parse({
phase,
emoji,
description,
id: ulid(),
doneAt: null,
})
console.log(task)
2024-01-21 15:52:46 -06:00
try {
await kv.set(['task', task.id], task)
} catch (e) {
console.error('error creating:', e)
}
2024-01-21 14:23:45 -06:00
}
})