Open nagy-nabil opened 1 year ago
You can think of expense_store and expenses as products and orders, where you store products and later add them to order to gain profit, but expenses are the opposite you add them to expenses table to indicate losses
Losses are not periodic thing so won't try to store them before hand
Expenses types meta
id uuid
name text
createdAT datetime
createdBY datetime
description text
Expenses store
As we want the user to be able to store expenses for later use we also want the user to add expenses on the fly if needed without showing them to the user again
So the concept of on the fly expenses would be user only concept but any expenses will be stored here
id uuid
name text
description text
type/category EXPENSES_TYPE
remindAT datetime can be null
money_amount float
createedAT datetime
createdBY datetime
# this field indicate is this expense considered on the fly to the user
on_fly boolean
Expenses
id uuid
expeseID EXPENSES_STORE
createdBY user
createdAT datetime
unlike expenses/spendings i think losses are more related to products
in other words my mental model is the following
so the user should use spendings/losses system like this:
id cuid
name text
additionalAmount float
// losses are just like order
// you can loss more than product at a time
// need to take snapshot of the product while the time of
// loss to correctly calc the loss amount
// need quntity of each item
many to many relation between loss and products in the loss
DON’T FORGET TO DECREASE THE INVENTORY AFTER ADDING THE LOSS.