Fixed the delete button on the shares table of the expenses page

This commit is contained in:
2025-08-12 12:19:19 +01:00
parent a977f98586
commit ceea5344ce
9 changed files with 95 additions and 2 deletions
+19
View File
@@ -76,3 +76,22 @@ func (sh *ExpenseShare) Update(tx *sql.Tx) error {
return nil
}
func (sh *ExpenseShare) Delete(tx *sql.Tx) error {
ctx := context.Background()
queries := repo.New(tx)
res, err := queries.DeleteShare(ctx, sh.ExpShareID)
if err != nil {
return err
}
rowsAffected, err := res.RowsAffected()
if err != nil {
return err
} else if rowsAffected == 0 {
return fmt.Errorf("no rows were created")
}
return nil
}