From 757fb1e454b9357ac100bccbcd30fb14b7f8dcc3 Mon Sep 17 00:00:00 2001 From: Alex Bezdieniezhnykh Date: Thu, 22 May 2025 00:32:56 +0300 Subject: [PATCH] add more information to annotationbulkmessage --- Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs | 9 ++++++--- Azaion.Common/Services/AnnotationService.cs | 2 +- Azaion.Common/Services/FailsafeProducer.cs | 5 ++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs b/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs index 98d3bab..6bcf78e 100644 --- a/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs +++ b/Azaion.Common/DTO/Queue/AnnotationCreatedMessage.cs @@ -14,8 +14,8 @@ public class AnnotationMessage [Key(4)] public string ImageExtension { get; set; } = null!; [Key(5)] public string Detections { get; set; } = null!; [Key(6)] public byte[]? Image { get; set; } = null!; - [Key(7)] public RoleEnum Role { get; set; } - [Key(8)] public string Email { get; set; } = null!; + [Key(7)] public RoleEnum Role { get; set; } + [Key(8)] public string Email { get; set; } = null!; [Key(9)] public SourceEnum Source { get; set; } [Key(10)] public AnnotationStatus Status { get; set; } } @@ -23,5 +23,8 @@ public class AnnotationMessage [MessagePackObject] public class AnnotationBulkMessage { - [Key(0)] public string[] AnnotationNames { get; set; } = null!; + [Key(0)] public string[] AnnotationNames { get; set; } = null!; + [Key(1)] public AnnotationStatus AnnotationStatus { get; set; } + [Key(2)] public string Email { get; set; } = null!; + [Key(3)] public DateTime CreatedDate { get; set; } } \ No newline at end of file diff --git a/Azaion.Common/Services/AnnotationService.cs b/Azaion.Common/Services/AnnotationService.cs index 92fc516..ef60ffb 100644 --- a/Azaion.Common/Services/AnnotationService.cs +++ b/Azaion.Common/Services/AnnotationService.cs @@ -132,7 +132,7 @@ public class AnnotationService : IAnnotationService, INotificationHandler SaveAnnotation(AnnotationImage a, CancellationToken ct = default) { a.Time = TimeSpan.FromMilliseconds(a.Milliseconds); - return await SaveAnnotationInner(DateTime.Now, a.OriginalMediaName, a.Time, a.Detections.ToList(), + return await SaveAnnotationInner(DateTime.UtcNow, a.OriginalMediaName, a.Time, a.Detections.ToList(), SourceEnum.AI, new MemoryStream(a.Image), _api.CurrentUser.Role, _api.CurrentUser.Email, token: ct); } diff --git a/Azaion.Common/Services/FailsafeProducer.cs b/Azaion.Common/Services/FailsafeProducer.cs index 5beafc1..98b87bc 100644 --- a/Azaion.Common/Services/FailsafeProducer.cs +++ b/Azaion.Common/Services/FailsafeProducer.cs @@ -87,7 +87,10 @@ public class FailsafeAnnotationsProducer { var message = new Message(MessagePackSerializer.Serialize(new AnnotationBulkMessage { - AnnotationNames = record.AnnotationNames.ToArray() + AnnotationNames = record.AnnotationNames.ToArray(), + AnnotationStatus = record.Operation, + Email = _azaionApi.CurrentUser.Email, + CreatedDate = record.DateTime })) { ApplicationProperties = appProperties }; messages.Add(message);