/// <inheritdoc />
        public async Task HandleAsync(IMessageContext context, IncidentReOpened e)
        {
            var tags = await _repository.GetIncidentTagsAsync(e.IncidentId);

            if (tags.Any(x => x.Name == "incident-reopened"))
            {
                return;
            }

            await _repository.AddAsync(e.IncidentId, new[] { new Tag("incident-reopened", 1) });
        }
Пример #2
0
        /// <summary>
        ///     Process an event asynchronously.
        /// </summary>
        /// <param name="e">event to process</param>
        /// <returns>
        ///     Task to wait on.
        /// </returns>
        public async Task HandleAsync(IMessageContext context, ReportAddedToIncident e)
        {
            _logger.Debug("Checking tags..");
            var tags = await _repository.GetIncidentTagsAsync(e.Incident.Id);

            var ctx         = new TagIdentifierContext(e.Report, tags);
            var identifiers = _tagIdentifierProvider.GetIdentifiers(ctx);

            foreach (var identifier in identifiers)
            {
                identifier.Identify(ctx);
            }

            ExtractTagsFromCollections(e, ctx);

            _logger.DebugFormat("Done, identified {0} new tags", ctx.NewTags);

            if (ctx.NewTags.Count == 0)
            {
                return;
            }

            await _repository.AddAsync(e.Incident.Id, ctx.NewTags.ToArray());
        }
 public async Task <TagDTO[]> HandleAsync(IMessageContext context, GetTagsForIncident query)
 {
     return((await _repository.GetIncidentTagsAsync(query.IncidentId)).Select(ConvertTag).ToArray());
 }