r002 / captains-log

Over the years, I've toiled away many nights & weekends on various pet projects; each always with its own repo, theme, and urls. Well, no more! Moving forward, all experimentations now live here! 😄
https://captains-log.web.app
0 stars 0 forks source link

♻️ Parse logs on entry to add 'command' & 'activity' fields to Log in Firestore #14

Open r002 opened 3 years ago

r002 commented 3 years ago

Instead of using regex during the processing phase, refactor the code to parse the log entry on input.
Parsing upfront offers several advantages:

  1. If the command is invalid, reject.
  2. Store command and activity as their own fields per log in Firestore. This will allow us to use/analyze them easier later.

Commands that resolve:

  1. wake up ➡️ sleep
  2. return ➡️ go for depart depart for take break nap take nap
  3. finish ➡️ start eat begin watch

Supported mono-commands :

  1. brush teeth