fix: allow editing expenses in pre-migration events (empty month_id)

This commit is contained in:
Claus Lohmar 2026-07-14 11:24:24 +00:00
parent 2f2fbf7630
commit dfefd0208c

View file

@ -15,10 +15,11 @@ func normalizeImagePath(path string) string {
} }
// verifyMonthOwnership checks that a month exists and belongs to the given user. // verifyMonthOwnership checks that a month exists and belongs to the given user.
// Returns true if the month is owned by the user, false otherwise. // If monthID is empty (pre-migration events), returns true since event ownership
// was already verified by the caller.
func verifyMonthOwnership(db *sql.DB, monthID, userID string) bool { func verifyMonthOwnership(db *sql.DB, monthID, userID string) bool {
if monthID == "" { if monthID == "" {
return false return true
} }
month, err := database.GetMonthByID(db, monthID) month, err := database.GetMonthByID(db, monthID)
if err != nil || month == nil { if err != nil || month == nil {