diff options
author | Mo Tarbin <mhed.t91@gmail.com> | 2024-08-10 00:27:07 -0400 |
---|---|---|
committer | Mo Tarbin <mhed.t91@gmail.com> | 2024-08-10 00:27:07 -0400 |
commit | 4f22460313f21494442fbea5b1fcda49fb897df0 (patch) | |
tree | cbfd2d9432c9ae9f6b84fc2dcba352e03c09abff /internal/user/repo | |
parent | 042cd3b473d0bfe32f2ebcac907437f456e3e112 (diff) | |
download | donetick-4f22460313f21494442fbea5b1fcda49fb897df0.tar.gz donetick-4f22460313f21494442fbea5b1fcda49fb897df0.tar.bz2 donetick-4f22460313f21494442fbea5b1fcda49fb897df0.zip |
Refactor scheduleAdaptiveNextDueDate function for improved readability and fix bug, Add New Tests for it
Diffstat (limited to 'internal/user/repo')
-rw-r--r-- | internal/user/repo/repository.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/user/repo/repository.go b/internal/user/repo/repository.go index 76ddd54..7dde6fb 100644 --- a/internal/user/repo/repository.go +++ b/internal/user/repo/repository.go @@ -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 +} |