chore: Add chore archiving and unarchiving functionality

This commit is contained in:
Mo Tarbin 2024-12-21 01:49:19 -05:00
parent b9160bf681
commit d1d07b84a0
2 changed files with 75 additions and 0 deletions

View file

@ -293,3 +293,11 @@ func (r *ChoreRepository) GetChoreDetailByID(c context.Context, choreID int, cir
}
return &choreDetail, nil
}
func (r *ChoreRepository) ArchiveChore(c context.Context, choreID int, userID int) error {
return r.db.WithContext(c).Model(&chModel.Chore{}).Where("id = ? and created_by = ?", choreID, userID).Update("is_active", false).Error
}
func (r *ChoreRepository) UnarchiveChore(c context.Context, choreID int, userID int) error {
return r.db.WithContext(c).Model(&chModel.Chore{}).Where("id = ? and created_by = ?", choreID, userID).Update("is_active", true).Error
}