예제 #1
0
        public async Task <UserPreferences> GetUserPreferencesAsync(string userId)
        {
            UserPreferences userPreferences = new UserPreferences();

            var prefs = await userPreferencesRepository.GetUserPreferencesAsync(userId);

            if (prefs == null)
            {
                userPreferences.UrgencyConfiguration = new UrgencyConfiguration
                {
                    ImminentDays = 7,
                    SoonDays     = 14
                };
            }
            else
            {
                userPreferences.UrgencyConfiguration = new UrgencyConfiguration
                {
                    ImminentDays = prefs.ImminentDays,
                    SoonDays     = prefs.SoonDays
                };
            }

            return(userPreferences);
        }
예제 #2
0
        public async Task <UserPreferences> GetUserPreferencesAsync(Guid appUserId)
        {
            var userPreferences = await _userPreferencesRepository.GetUserPreferencesAsync(appUserId);

            if (userPreferences == null)
            {
                throw new NotFoundException($"{nameof(UserPreferences)} for appUserId {appUserId} not found.");
            }

            return(userPreferences);
        }