Exemple #1
0
        public async Task <LogDescriptor> GetDocumentLogs(string documentId)
        {
            var userId = GetCurrentUserId();

            var document = string.IsNullOrEmpty(documentId) ? null : await _documentService.GetAsync(documentId);

            var events = await _logFetcher.GetDocumentEventsAsync(documentId);

            var summary = events.ToSummary(userId);

            return(new LogDescriptor()
            {
                Summary = summary, Events = events
            });
        }
Exemple #2
0
        public static async Task <LogSummary> GetLogSummaryAsync(this DbLogService logger, FileDocument document)
        {
            Ensure.NotNull(logger, $"{nameof(logger)} cannot be null.");
            Ensure.NotNull(document, $"{nameof(document)} cannot be null.");

            var logs = (await logger.GetDocumentEventsAsync(document.DocumentId)) ?? new DbLogEvent[0];

            return(new LogSummary()
            {
                Created = DateTime.MinValue,
                Deleted = null,
                DocumentLog = null,
                DocumentLogId = null,
                LastRead = DateTime.MinValue,
                LastReadOther = DateTime.MinValue,
                LastReadUserId = null,
                LastWrite = DateTime.MinValue,
                ReadCount = 0,
                ReadCountOther = 0,
                WriteCount = 0
            });
        }