public async Task Save(Notification notification, JsonElement json) { BackingStoreInfo storeInfo = await GetBackingStoreInfo(notification); await _notificationDal.Save(storeInfo, json.GetRawText()); await CalculateAndSaveReport(notification, storeInfo); }
public static string Build(BackingStoreInfo info, string fileName) { var path = string.Format(Constants.PathFormat, info.Source, info.DirIndex); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return(Path.Combine(path, string.Format(fileName, info.FileId))); }
private async Task CalculateAndSaveReport(Notification notification, BackingStoreInfo stateInfo) { var summary = await _reportCalculator.Calculate(notification); var report = new NotificationReport { Source = notification.Source, Id = notification.Id, WordCount = summary.WordCount }; await _reportDal.Save(stateInfo, report.ToString()); }
public async Task Save(BackingStoreInfo info, string data) { var filePath = FilePathBuilder.Build(info, Constants.NotificationFileNameFormat); await File.WriteAllTextAsync(filePath, data); }