public async Task OnFileEditDeleteRemoveFileAnalysis(FileEditNotification notification) { var fileAnalysis = await GetByFileIdAsync(notification.FileId, notification.Hash); _dbContext.Remove(fileAnalysis); await _dbContext.SaveChangesAsync(); }
public async Task OnFileEditChangesRunFileAnalysis(FileEditNotification notification) { var getFileEditResponse = await _fileEditService.GetByFileIdAsync(notification.FileId, notification.Hash); if (getFileEditResponse.HasError) { // File edit has been changed again and has sent another notification return; } var fileEdit = getFileEditResponse.Result; var diagnosticItems = await _GetDiagnosticsForContent(fileEdit.Content); var results = JsonConvert.SerializeObject(diagnosticItems .Select(d => FileAnalysisEntry.FromDiagnostic(d)) .ToList()); await _UpdateFileAnalysisAsync(notification.FileId, notification.Hash, results); }