🐛 Fix post leave program

This commit is contained in:
LittleSheep 2025-03-24 13:11:33 +08:00
parent fa3561ae58
commit f8a4924d56

View File

@ -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 {