Categories and Summary
15 min read
Give Income a Null Category
An income transaction is not an expense category, so stop storing a fake category such as Income.
The final model uses:
{
type: "income",
category: null
}
For expenses, category contains the real category name.
Update the form, server validation, normalization, and seed data together so the rule is consistent end to end.
Test it
Add an income transaction and inspect the stored object in server/data/db.json. Its category should be null.
Checkpoint
The transaction shape expresses the actual meaning of income and expense records.