Model layer is "complete"

I don't really like how it is for now but I will learn about it later
This commit is contained in:
2025-08-09 12:02:16 +01:00
parent e76261d5d5
commit 89679d6bb6
26 changed files with 516 additions and 329 deletions
+2 -9
View File
@@ -38,17 +38,10 @@ func (e *Expense) GetShares() error {
return nil
}
func (sh *ExpenseShare) Insert(expID int64) error {
cfg := config.GetInstance()
func (sh *ExpenseShare) Insert(tx *sql.Tx, expID int64) error {
ctx := context.Background()
db, err := sql.Open(cfg.DBSys, "file:"+cfg.DBPath+"?_foreign_keys=on")
if err != nil {
return err
}
defer db.Close()
queries := repo.New(db)
queries := repo.New(tx)
res, err := queries.InsertShare(ctx, repo.InsertShareParams{
ExpID: expID,
Share: sh.Share,