More fixes to how dates are handled
This commit is contained in:
@@ -126,14 +126,14 @@ func (exp *Expense) Insert() error {
|
|||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|
||||||
query := "INSERT INTO expenses(" +
|
query := "INSERT INTO expenses(" +
|
||||||
"Description,Value,StoreID,CategoryID,TypeID,OwnerUserID,ExpDate" +
|
"Description,Value,StoreID,CategoryID,TypeID,OwnerUserID,ExpDate,CreationDate" +
|
||||||
") " +
|
") " +
|
||||||
"VALUES(?, ?, ? , ?, ?, ?, ?)"
|
"VALUES(?, ?, ? , ?, ?, ?, ?, ?)"
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// Add a transaction here so that it fails when necessary
|
// Add a transaction here so that it fails when necessary
|
||||||
res, err := db.Exec(query, exp.Description, exp.Value, exp.ExpStore.StoreID,
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -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
|
// This needs to be dynamic - to be added once we have logins and whatnot
|
||||||
UserID: 1,
|
UserID: 1,
|
||||||
},
|
},
|
||||||
|
CreationDate: time.Now().Unix(),
|
||||||
Shares: shares,
|
Shares: shares,
|
||||||
Payments: payments,
|
Payments: payments,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user