public async Task <IActionResult> Get(Guid commandId, [FromQuery] bool expand = false) { var organizationId = Guid.Parse(OrganizationId); var entity = await commandAuditReader .GetAsync(organizationId, commandId, expand) .ConfigureAwait(false); return(DataResult <CommandAuditEntity> .Ok(entity) .ToActionResult()); }
private async Task <string> GetAuditAsync(ComponentTask document) { var audit = await commandAuditReader .GetAsync(Guid.Parse(document.Organization), Guid.Parse(document.Id)) .ConfigureAwait(false); if (audit is not null) { var username = await graphService .GetDisplayNameAsync(audit.UserId) .ConfigureAwait(false); var output = new StringBuilder(); output.AppendLine($"User: {username}"); output.AppendLine($"Created: {audit.Created}"); if (audit.RuntimeStatus.IsActive()) { output.AppendLine($"Updated: {audit.Updated}"); } else { output.AppendLine($"Finished: {audit.Updated}"); } if (!string.IsNullOrEmpty(audit.Errors)) { output.AppendLine(Seperator); output.AppendLine(audit.Errors); } return(output.ToString()); } return(default);