Projekt

Obecné

Profil

« Předchozí | Další » 

Revize f2e3b199

Přidáno uživatelem Vojtěch Bartička před téměř 3 roky(ů)

Document export takes only list of doc IDs

Zobrazit rozdíly:

Backend/Core/Services/AnnotationService/AnnotationServiceEF.cs
776 776

  
777 777
            return true;
778 778
        }
779
        
779

  
780 780
        public void SetTagIsFinal(Guid annotationId, Guid occurenceId, bool isFinal)
781 781
        {
782 782
            Annotation annotation;
......
806 806

  
807 807
        public MemoryStream Export(ExportRequest request)
808 808
        {
809
            if (request.ExportAllDone && request.DocumentIds == null)
810
            {
811
                throw new InvalidOperationException("No documents specified");
812
            }
813

  
814 809
            // Get documents
815
            IEnumerable<Document> documentsToExport = null;
816
            if (request.ExportAllDone)
817
            {
818
                documentsToExport = context.Documents
819
                    .Include(d => d.Content);
820
            }
821
            else
822
            {
823
                documentsToExport = context.Documents
824
                    .Include(d => d.Content)
825
                    .Where(d => request.DocumentIds.Contains(d.Id));
826
            }
810
            var documentsToExport = context.Documents
811
                .Include(d => d.Content)
812
                .Where(d => request.DocumentIds.Contains(d.Id));
827 813

  
828 814
            // Get annotations
829 815
            Dictionary<Document, List<Annotation>> annotationsToExport = new();
Backend/Models/Documents/ExportRequest.cs
8 8
{
9 9
    public class ExportRequest
10 10
    {
11
        public List<Guid>? DocumentIds { get; set; }
12
        public bool ExportAllDone { get; set; }
11
        public List<Guid> DocumentIds { get; set; }
13 12
    }
14 13
}

Také k dispozici: Unified diff