More fixes to how dates are handled

This commit is contained in:
2025-07-21 23:34:45 +01:00
parent 54732c9b38
commit 519e87888d
2 changed files with 4 additions and 3 deletions
+3 -3
View File
@@ -126,14 +126,14 @@ func (exp *Expense) Insert() error {
defer db.Close()
query := "INSERT INTO expenses(" +
"Description,Value,StoreID,CategoryID,TypeID,OwnerUserID,ExpDate" +
"Description,Value,StoreID,CategoryID,TypeID,OwnerUserID,ExpDate,CreationDate" +
") " +
"VALUES(?, ?, ? , ?, ?, ?, ?)"
"VALUES(?, ?, ? , ?, ?, ?, ?, ?)"
// TODO
// Add a transaction here so that it fails when necessary
res, err := db.Exec(query, exp.Description, exp.Value, exp.ExpStore.StoreID,
exp.ExpCategory.CategoryID, exp.ExpType.TypeID, 1, exp.ExpDate,
exp.ExpCategory.CategoryID, exp.ExpType.TypeID, 1, exp.ExpDate, exp.CreationDate,
)
if err != nil {
return err
+1
View File
@@ -149,6 +149,7 @@ func expenseFromForm(c *gin.Context) (*expenses.Expense, error) {
// This needs to be dynamic - to be added once we have logins and whatnot
UserID: 1,
},
CreationDate: time.Now().Unix(),
Shares: shares,
Payments: payments,
}