Refactor scheduleAdaptiveNextDueDate function for improved readability and fix bug, Add New Tests for it

This commit is contained in:
Mo Tarbin 2024-08-10 00:27:07 -04:00
parent 042cd3b473
commit 4f22460313
3 changed files with 251 additions and 12 deletions

View file

@ -158,3 +158,7 @@ func (r *UserRepository) GetAllUserTokens(c context.Context, userID int) ([]*uMo
func (r *UserRepository) DeleteAPIToken(c context.Context, userID int, tokenID string) error {
return r.db.WithContext(c).Where("id = ? AND user_id = ?", tokenID, userID).Delete(&uModel.APIToken{}).Error
}
func (r *UserRepository) UpdateNotificationTarget(c context.Context, userID int, targetID string, targetType uModel.UserNotificationType) error {
return r.db.WithContext(c).Model(&uModel.UserNotificationTarget{}).Where("user_id = ? AND type = ?", userID, targetType).Update("target_id", targetID).Error
}