add more information to annotationbulkmessage

This commit is contained in:
Alex Bezdieniezhnykh
2025-05-22 00:32:56 +03:00
parent 0d51f3c373
commit 757fb1e454
3 changed files with 11 additions and 5 deletions
@@ -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; }
}
+1 -1
View File
@@ -132,7 +132,7 @@ public class AnnotationService : IAnnotationService, INotificationHandler<Annota
public async Task<Annotation> 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);
}
+4 -1
View File
@@ -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);