| | | 1 | | using OzonDomains.Models; |
| | | 2 | | using OzonOrdersWeb.WebServices.Grid; |
| | | 3 | | using OzonRepositories.Context; |
| | | 4 | | |
| | | 5 | | namespace OzonOrdersWeb.WebServices.JobLogs; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Серверные гриды журнала задач (/Studio2/JobLogs): whitelist колонок (colId → выражение EF), поиск и порядок |
| | | 9 | | /// по умолчанию для каждой вкладки-журнала. Колонки совпадают с colId гридов в job-logs-grid.js. |
| | | 10 | | /// </summary> |
| | | 11 | | public static class JobLogsGridDefinitions |
| | | 12 | | { |
| | 0 | 13 | | public static readonly ServerGridDefinition<SystemAlertIncident> SystemAlerts = |
| | 0 | 14 | | new ServerGridDefinition<SystemAlertIncident> |
| | 0 | 15 | | { |
| | 0 | 16 | | DefaultOrder = q => q.OrderByDescending(x => x.IsActive).ThenByDescending(x => x.LastObservedAtUtc).Then |
| | 0 | 17 | | TieBreaker = x => x.Id |
| | 0 | 18 | | } |
| | 0 | 19 | | .Col("id", x => x.Id) |
| | 0 | 20 | | .Col("isActive", x => x.IsActive) |
| | 0 | 21 | | .Col("domain", x => x.Domain) |
| | 0 | 22 | | .Col("severity", x => x.Severity) |
| | 0 | 23 | | .Col("title", x => x.Title) |
| | 0 | 24 | | .Col("details", x => x.Details) |
| | 0 | 25 | | .Col("firstObservedAtUtc", x => x.FirstObservedAtUtc) |
| | 0 | 26 | | .Col("lastObservedAtUtc", x => x.LastObservedAtUtc) |
| | 0 | 27 | | .Col("resolvedAtUtc", x => x.ResolvedAtUtc) |
| | 0 | 28 | | .Col("occurrenceCount", x => x.OccurrenceCount) |
| | 0 | 29 | | .Col("orderCount", x => x.OrderCount) |
| | 0 | 30 | | .Col("mutedUntilUtc", x => x.MutedUntilUtc) |
| | 0 | 31 | | .Col("acknowledgedAtUtc", x => x.AcknowledgedAtUtc) |
| | 0 | 32 | | .Search(x => x.Domain, x => x.Title, x => x.Details); |
| | | 33 | | |
| | 0 | 34 | | public static readonly ServerGridDefinition<BackgroundJobExecution> Executions = |
| | 0 | 35 | | new ServerGridDefinition<BackgroundJobExecution> |
| | 0 | 36 | | { |
| | 0 | 37 | | DefaultOrder = q => q.OrderByDescending(e => e.StartedAt).ThenByDescending(e => e.Id), |
| | 0 | 38 | | TieBreaker = e => e.Id |
| | 0 | 39 | | } |
| | 0 | 40 | | .Col("id", e => e.Id) |
| | 0 | 41 | | .Col("scheduleName", e => e.Schedule != null ? e.Schedule.Name : null) |
| | 0 | 42 | | .Col("jobType", e => e.JobType) |
| | 0 | 43 | | .Col("triggerType", e => e.TriggerType) |
| | 0 | 44 | | .Col("status", e => e.Status) |
| | 0 | 45 | | .Col("startedAt", e => e.StartedAt) |
| | 0 | 46 | | .Col("completedAt", e => e.CompletedAt) |
| | 0 | 47 | | .Col("durationMs", e => e.DurationMs) |
| | 0 | 48 | | .Col("totalOrders", e => e.TotalOrders) |
| | 0 | 49 | | .Col("successfulOrders", e => e.SuccessfulOrders) |
| | 0 | 50 | | .Col("failedOrders", e => e.FailedOrders) |
| | 0 | 51 | | .Col("errorMessage", e => e.ErrorMessage) |
| | 0 | 52 | | .Search(e => e.ErrorMessage, e => e.Schedule != null ? e.Schedule.Name : null); |
| | | 53 | | |
| | | 54 | | /// <summary>Проведения 1С: «кто провёл», запуск и номер отправления — подзапросами, чтобы по ним работали фильтры.< |
| | | 55 | | public static ServerGridDefinition<OrderHistoryOneCPosting> OneCPostings(ApplicationDbContext db) => |
| | 0 | 56 | | new ServerGridDefinition<OrderHistoryOneCPosting> |
| | 0 | 57 | | { |
| | 0 | 58 | | DefaultOrder = q => q.OrderByDescending(p => p.PostedAt).ThenByDescending(p => p.Id), |
| | 0 | 59 | | TieBreaker = p => p.Id |
| | 0 | 60 | | } |
| | 0 | 61 | | .Col("postedAt", p => p.PostedAt) |
| | 0 | 62 | | .Col("success", p => p.Success) |
| | 0 | 63 | | .Col("operationKind", p => p.OperationKind) |
| | 0 | 64 | | .Col("performedBy", p => p.ChangedBy ?? db.Transactions.Where(t => t.Id == p.TransactionId).Select(t => t.Cr |
| | 0 | 65 | | .Col("organizationName", p => p.OrganizationName) |
| | 0 | 66 | | .Col("warehouseSender", p => p.WarehouseSender) |
| | 0 | 67 | | .Col("warehouseRecipient", p => p.WarehouseRecipient) |
| | 0 | 68 | | .Col("errorSummary", p => p.ErrorSummary) |
| | 0 | 69 | | .Col("ordersCount", p => p.OrdersCount) |
| | 0 | 70 | | .Col("productsCount", p => p.ProductsCount) |
| | 0 | 71 | | .Col("articlesSummary", p => p.ArticlesSummary) |
| | 0 | 72 | | .Col("documentsCount", p => p.DocumentsCount) |
| | 0 | 73 | | .Col("documentNumbers", p => p.DocumentNumbers) |
| | 0 | 74 | | .Col("isPosted", p => p.IsPosted) |
| | 0 | 75 | | .Col("orderId", p => p.OrderId) |
| | 0 | 76 | | .Col("shipmentNumber", p => db.Orders.Where(o => o.Id == p.OrderId).Select(o => o.ShipmentNumber).FirstOrDef |
| | 0 | 77 | | .Col("executionId", p => db.BackgroundTransactionResults.Where(r => r.TransactionId == p.TransactionId).Min( |
| | 0 | 78 | | .Search(p => p.DocumentNumbers, p => p.ArticlesSummary, p => p.ErrorSummary, p => p.ChangedBy); |
| | | 79 | | |
| | 0 | 80 | | public static readonly ServerGridDefinition<OzonPushNotification> Webhook = |
| | 0 | 81 | | new ServerGridDefinition<OzonPushNotification> |
| | 0 | 82 | | { |
| | 0 | 83 | | DefaultOrder = q => q.OrderByDescending(n => n.ReceivedAt).ThenByDescending(n => n.Id), |
| | 0 | 84 | | TieBreaker = n => n.Id |
| | 0 | 85 | | } |
| | 0 | 86 | | .Col("id", n => n.Id) |
| | 0 | 87 | | .Col("receivedAt", n => n.ReceivedAt) |
| | 0 | 88 | | .Col("processedAt", n => n.ProcessedAt) |
| | 0 | 89 | | .Col("messageType", n => n.MessageType) |
| | 0 | 90 | | .Col("postingNumber", n => n.PostingNumber) |
| | 0 | 91 | | .Col("sellerId", n => n.SellerId) |
| | 0 | 92 | | .Col("warehouseId", n => n.WarehouseId) |
| | 0 | 93 | | .Col("processingStatus", n => n.ProcessingStatus) |
| | 0 | 94 | | .Col("result", n => n.ErrorMessage ?? n.ActionDetails) |
| | 0 | 95 | | .Search(n => n.PostingNumber, n => n.MessageType, n => n.ErrorMessage, n => n.ActionDetails); |
| | | 96 | | |
| | 0 | 97 | | public static readonly ServerGridDefinition<EmailAttachmentProcessingResult> Email = |
| | 0 | 98 | | new ServerGridDefinition<EmailAttachmentProcessingResult> |
| | 0 | 99 | | { |
| | 0 | 100 | | DefaultOrder = q => q.OrderByDescending(r => r.CreatedAt).ThenByDescending(r => r.Id), |
| | 0 | 101 | | TieBreaker = r => r.Id |
| | 0 | 102 | | } |
| | 0 | 103 | | .Col("createdAt", r => r.CreatedAt) |
| | 0 | 104 | | .Col("status", r => r.Status) |
| | 0 | 105 | | .Col("ruleName", r => r.Rule != null ? r.Rule.Name : null) |
| | 0 | 106 | | .Col("sender", r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null) |
| | 0 | 107 | | .Col("subject", r => r.EmailMessage != null ? r.EmailMessage.Subject : null) |
| | 0 | 108 | | .Col("fileName", r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName) |
| | 0 | 109 | | .Col("dropboxFolderPath", r => r.DropboxFolderPath) |
| | 0 | 110 | | .Col("reason", r => r.Error ?? r.Reason) |
| | 0 | 111 | | .Search(r => r.Attachment != null ? r.Attachment.FileName : r.DropboxFileName, |
| | 0 | 112 | | r => r.EmailMessage != null ? r.EmailMessage.SenderEmail : null, |
| | 0 | 113 | | r => r.Error, r => r.Reason); |
| | | 114 | | |
| | 0 | 115 | | public static readonly ServerGridDefinition<FileUploadRecord> FileUpload = |
| | 0 | 116 | | new ServerGridDefinition<FileUploadRecord> |
| | 0 | 117 | | { |
| | 0 | 118 | | DefaultOrder = q => q.OrderByDescending(r => r.Date).ThenByDescending(r => r.Id), |
| | 0 | 119 | | TieBreaker = r => r.Id |
| | 0 | 120 | | } |
| | 0 | 121 | | .Col("id", r => r.Id) |
| | 0 | 122 | | .Col("fileName", r => r.FileName) |
| | 0 | 123 | | .Col("folderName", r => r.FolderName) |
| | 0 | 124 | | .Col("date", r => r.Date) |
| | 0 | 125 | | .Col("result", r => r.Result) |
| | 0 | 126 | | .Search(r => r.FileName, r => r.FolderName, r => r.Result); |
| | | 127 | | |
| | 0 | 128 | | public static readonly ServerGridDefinition<WarehouseStockSyncRun> StockSync = |
| | 0 | 129 | | new ServerGridDefinition<WarehouseStockSyncRun> |
| | 0 | 130 | | { |
| | 0 | 131 | | DefaultOrder = q => q.OrderByDescending(r => r.StartedAtUtc).ThenByDescending(r => r.Id), |
| | 0 | 132 | | TieBreaker = r => r.Id |
| | 0 | 133 | | } |
| | 0 | 134 | | .Col("id", r => r.Id) |
| | 0 | 135 | | .Col("sourceType", r => r.SourceType) |
| | 0 | 136 | | .Col("status", r => r.Status) |
| | 0 | 137 | | .Col("startedAtUtc", r => r.StartedAtUtc) |
| | 0 | 138 | | .Col("completedAtUtc", r => r.CompletedAtUtc) |
| | 0 | 139 | | .Col("rowsRead", r => r.RowsRead) |
| | 0 | 140 | | .Col("rowsSaved", r => r.RowsSaved) |
| | 0 | 141 | | .Col("triggeredBy", r => r.TriggeredBy) |
| | 0 | 142 | | .Col("sourceFileName", r => r.SourceFileName) |
| | 0 | 143 | | .Col("errorMessage", r => r.ErrorMessage) |
| | 0 | 144 | | .Search(r => r.SourceFileName, r => r.ErrorMessage, r => r.TriggeredBy); |
| | | 145 | | } |