< Summary

Information
Class: OzonOrdersWeb.WebServices.JobLogs.JobLogsGridDefinitions
Assembly: OzonOrdersWeb
File(s): /home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/JobLogs/JobLogsGridDefinitions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 124
Coverable lines: 124
Total lines: 145
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%210%
OneCPostings(...)100%210%

File(s)

/home/runner/work/Studio2Prod/Studio2Prod/OzonOrdersWeb/WebServices/JobLogs/JobLogsGridDefinitions.cs

#LineLine coverage
 1using OzonDomains.Models;
 2using OzonOrdersWeb.WebServices.Grid;
 3using OzonRepositories.Context;
 4
 5namespace OzonOrdersWeb.WebServices.JobLogs;
 6
 7/// <summary>
 8/// Серверные гриды журнала задач (/Studio2/JobLogs): whitelist колонок (colId → выражение EF), поиск и порядок
 9/// по умолчанию для каждой вкладки-журнала. Колонки совпадают с colId гридов в job-logs-grid.js.
 10/// </summary>
 11public static class JobLogsGridDefinitions
 12{
 013    public static readonly ServerGridDefinition<SystemAlertIncident> SystemAlerts =
 014        new ServerGridDefinition<SystemAlertIncident>
 015            {
 016                DefaultOrder = q => q.OrderByDescending(x => x.IsActive).ThenByDescending(x => x.LastObservedAtUtc).Then
 017                TieBreaker = x => x.Id
 018            }
 019            .Col("id", x => x.Id)
 020            .Col("isActive", x => x.IsActive)
 021            .Col("domain", x => x.Domain)
 022            .Col("severity", x => x.Severity)
 023            .Col("title", x => x.Title)
 024            .Col("details", x => x.Details)
 025            .Col("firstObservedAtUtc", x => x.FirstObservedAtUtc)
 026            .Col("lastObservedAtUtc", x => x.LastObservedAtUtc)
 027            .Col("resolvedAtUtc", x => x.ResolvedAtUtc)
 028            .Col("occurrenceCount", x => x.OccurrenceCount)
 029            .Col("orderCount", x => x.OrderCount)
 030            .Col("mutedUntilUtc", x => x.MutedUntilUtc)
 031            .Col("acknowledgedAtUtc", x => x.AcknowledgedAtUtc)
 032            .Search(x => x.Domain, x => x.Title, x => x.Details);
 33
 034    public static readonly ServerGridDefinition<BackgroundJobExecution> Executions =
 035        new ServerGridDefinition<BackgroundJobExecution>
 036            {
 037                DefaultOrder = q => q.OrderByDescending(e => e.StartedAt).ThenByDescending(e => e.Id),
 038                TieBreaker = e => e.Id
 039            }
 040            .Col("id", e => e.Id)
 041            .Col("scheduleName", e => e.Schedule != null ? e.Schedule.Name : null)
 042            .Col("jobType", e => e.JobType)
 043            .Col("triggerType", e => e.TriggerType)
 044            .Col("status", e => e.Status)
 045            .Col("startedAt", e => e.StartedAt)
 046            .Col("completedAt", e => e.CompletedAt)
 047            .Col("durationMs", e => e.DurationMs)
 048            .Col("totalOrders", e => e.TotalOrders)
 049            .Col("successfulOrders", e => e.SuccessfulOrders)
 050            .Col("failedOrders", e => e.FailedOrders)
 051            .Col("errorMessage", e => e.ErrorMessage)
 052            .Search(e => e.ErrorMessage, e => e.Schedule != null ? e.Schedule.Name : null);
 53
 54    /// <summary>Проведения 1С: «кто провёл», запуск и номер отправления — подзапросами, чтобы по ним работали фильтры.<
 55    public static ServerGridDefinition<OrderHistoryOneCPosting> OneCPostings(ApplicationDbContext db) =>
 056        new ServerGridDefinition<OrderHistoryOneCPosting>
 057            {
 058                DefaultOrder = q => q.OrderByDescending(p => p.PostedAt).ThenByDescending(p => p.Id),
 059                TieBreaker = p => p.Id
 060            }
 061            .Col("postedAt", p => p.PostedAt)
 062            .Col("success", p => p.Success)
 063            .Col("operationKind", p => p.OperationKind)
 064            .Col("performedBy", p => p.ChangedBy ?? db.Transactions.Where(t => t.Id == p.TransactionId).Select(t => t.Cr
 065            .Col("organizationName", p => p.OrganizationName)
 066            .Col("warehouseSender", p => p.WarehouseSender)
 067            .Col("warehouseRecipient", p => p.WarehouseRecipient)
 068            .Col("errorSummary", p => p.ErrorSummary)
 069            .Col("ordersCount", p => p.OrdersCount)
 070            .Col("productsCount", p => p.ProductsCount)
 071            .Col("articlesSummary", p => p.ArticlesSummary)
 072            .Col("documentsCount", p => p.DocumentsCount)
 073            .Col("documentNumbers", p => p.DocumentNumbers)
 074            .Col("isPosted", p => p.IsPosted)
 075            .Col("orderId", p => p.OrderId)
 076            .Col("shipmentNumber", p => db.Orders.Where(o => o.Id == p.OrderId).Select(o => o.ShipmentNumber).FirstOrDef
 077            .Col("executionId", p => db.BackgroundTransactionResults.Where(r => r.TransactionId == p.TransactionId).Min(
 078            .Search(p => p.DocumentNumbers, p => p.ArticlesSummary, p => p.ErrorSummary, p => p.ChangedBy);
 79
 080    public static readonly ServerGridDefinition<OzonPushNotification> Webhook =
 081        new ServerGridDefinition<OzonPushNotification>
 082            {
 083                DefaultOrder = q => q.OrderByDescending(n => n.ReceivedAt).ThenByDescending(n => n.Id),
 084                TieBreaker = n => n.Id
 085            }
 086            .Col("id", n => n.Id)
 087            .Col("receivedAt", n => n.ReceivedAt)
 088            .Col("processedAt", n => n.ProcessedAt)
 089            .Col("messageType", n => n.MessageType)
 090            .Col("postingNumber", n => n.PostingNumber)
 091            .Col("sellerId", n => n.SellerId)
 092            .Col("warehouseId", n => n.WarehouseId)
 093            .Col("processingStatus", n => n.ProcessingStatus)
 094            .Col("result", n => n.ErrorMessage ?? n.ActionDetails)
 095            .Search(n => n.PostingNumber, n => n.MessageType, n => n.ErrorMessage, n => n.ActionDetails);
 96
 097    public static readonly ServerGridDefinition<EmailAttachmentProcessingResult> Email =
 098        new ServerGridDefinition<EmailAttachmentProcessingResult>
 099            {
 0100                DefaultOrder = q => q.OrderByDescending(r => r.CreatedAt).ThenByDescending(r => r.Id),
 0101                TieBreaker = r => r.Id
 0102            }
 0103            .Col("createdAt", r => r.CreatedAt)
 0104            .Col("status", r => r.Status)
 0105            .Col("ruleName", r => r.Rule != null ? r.Rule.Name : null)
 0106            .Col("sender", r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null)
 0107            .Col("subject", r => r.EmailMessage != null ? r.EmailMessage.Subject : null)
 0108            .Col("fileName", r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName)
 0109            .Col("dropboxFolderPath", r => r.DropboxFolderPath)
 0110            .Col("reason", r => r.Error ?? r.Reason)
 0111            .Search(r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName,
 0112                r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null,
 0113                r => r.Error, r => r.Reason);
 114
 0115    public static readonly ServerGridDefinition<FileUploadRecord> FileUpload =
 0116        new ServerGridDefinition<FileUploadRecord>
 0117            {
 0118                DefaultOrder = q => q.OrderByDescending(r => r.Date).ThenByDescending(r => r.Id),
 0119                TieBreaker = r => r.Id
 0120            }
 0121            .Col("id", r => r.Id)
 0122            .Col("fileName", r => r.FileName)
 0123            .Col("folderName", r => r.FolderName)
 0124            .Col("date", r => r.Date)
 0125            .Col("result", r => r.Result)
 0126            .Search(r => r.FileName, r => r.FolderName, r => r.Result);
 127
 0128    public static readonly ServerGridDefinition<WarehouseStockSyncRun> StockSync =
 0129        new ServerGridDefinition<WarehouseStockSyncRun>
 0130            {
 0131                DefaultOrder = q => q.OrderByDescending(r => r.StartedAtUtc).ThenByDescending(r => r.Id),
 0132                TieBreaker = r => r.Id
 0133            }
 0134            .Col("id", r => r.Id)
 0135            .Col("sourceType", r => r.SourceType)
 0136            .Col("status", r => r.Status)
 0137            .Col("startedAtUtc", r => r.StartedAtUtc)
 0138            .Col("completedAtUtc", r => r.CompletedAtUtc)
 0139            .Col("rowsRead", r => r.RowsRead)
 0140            .Col("rowsSaved", r => r.RowsSaved)
 0141            .Col("triggeredBy", r => r.TriggeredBy)
 0142            .Col("sourceFileName", r => r.SourceFileName)
 0143            .Col("errorMessage", r => r.ErrorMessage)
 0144            .Search(r => r.SourceFileName, r => r.ErrorMessage, r => r.TriggeredBy);
 145}