fix: allow editing expenses in pre-migration events (empty month_id)
This commit is contained in:
parent
2f2fbf7630
commit
dfefd0208c
1 changed files with 3 additions and 2 deletions
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue