public async Task <IStandardInstance> HandleCreation(IStandardInstance instance) { IStandardInstance handledInstance = new StandardTopic(); if (!instance.Identifiers.ContainsKey(InstanceKeyNames.EASY_ACCESS_TOPIC)) { Debug.WriteLine("Creating new Topic from instance from: " + instance.MessageOrigin); handledInstance = await _resourceService.CreateInstanceAsync(instance); await _resourcePublisher.PublishKeyMap(instance.Identifiers); } return(handledInstance); }
public async Task <IStandardInstance> ToStandardObject(Topic topic, List <Comment> comments) { var author = topic.AuthorId == null ? null : await _dbService.GetClientUserFrom(_configSettings.UserColumnName, topic.AuthorId); var assignee = topic.AssignedToId == null ? null : await _dbService.GetClientUserFrom(_configSettings.UserColumnName, topic.AssignedToId); var instance = new StandardTopic() { Identifiers = GetIdentifiers(topic.Id, topic.ProjectId, comments), Author = author, Assignee = assignee, Created = topic.CreationDate.Value, Summary = topic.Title, Type = topic.TopicType, Status = topic.Status, Priority = topic.Priority, Labels = topic.Labels }; return(instance); }