From 4f22460313f21494442fbea5b1fcda49fb897df0 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sat, 10 Aug 2024 00:27:07 -0400 Subject: Refactor scheduleAdaptiveNextDueDate function for improved readability and fix bug, Add New Tests for it --- internal/user/repo/repository.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'internal/user') 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 +} -- cgit