Пример #1
0
        //[Route("Index")]
        public async Task <IActionResult> Index()
        {
            var sleeps = await _fitbitService.GetSleepSummaries(DateTime.Now.AddDays(-30), DateTime.Now);

            var restingHeartRates = await _fitbitService.GetRestingHeartRates(DateTime.Now.AddDays(-30), DateTime.Now);

            var weights = await _withingsService.GetWeights(DateTime.Now.AddDays(-30));

            var bloodPressures = await _withingsService.GetBloodPressures(DateTime.Now.AddDays(-30));

            var targets = await _sheetsService.GetTargets();

            var exercises = await _sheetsService.GetExercises(DateTime.Now.AddDays(-30));

            var drinks = await _sheetsService.GetDrinks(DateTime.Now.AddDays(-30));

            var dbWeightDate = _healthRepository.GetLatestWeightDate();

            var resp = new CanaryResponse
            {
                FitbitSleepSummaries    = sleeps.Any(),
                FitbitRestingHeartRates = restingHeartRates.Any(),
                WithingsWeights         = weights.Any(),
                WithingsBloodPressures  = bloodPressures.Any(),
                GoogleSheetsTargets     = targets.Any(),
                GoogleSheetsExercises   = exercises.Any(),
                GoogleSheetsDrinks      = drinks.Any(),
                DatabaseQuery           = dbWeightDate.HasValue
            };

            return(Ok(resp));
        }
Пример #2
0
        public DateTime GetLatestWeightDate(DateTime defaultDateTime)
        {
            var latestWeightDate = _healthRepository.GetLatestWeightDate();

            return(latestWeightDate ?? defaultDateTime);
        }