From f8a4924d5637ad9e7550dda455330df76ef02573 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Mon, 24 Mar 2025 13:11:33 +0800 Subject: [PATCH] :bug: Fix post leave program --- pkg/internal/services/programs.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/internal/services/programs.go b/pkg/internal/services/programs.go index b21e3b4..ef524cb 100644 --- a/pkg/internal/services/programs.go +++ b/pkg/internal/services/programs.go @@ -46,7 +46,9 @@ func JoinProgram(user models.Account, program models.Program) (models.ProgramMem func LeaveProgram(user models.Account, program models.Program) error { var member models.ProgramMember - if err := database.C.Where("account_id = ? AND program_id = ?", user.ID, program.ID).First(&member).Error; err != nil { + if err := database.C.Where("account_id = ? AND program_id = ?", user.ID, program.ID). + Preload("Program"). + First(&member).Error; err != nil { return err } if err := database.C.Delete(&member).Error; err != nil {