private async Task <ViewDTO> CreateDefaultViewAsync(CustomerId customerId) { var customer = await _persistence.Customers.GetAsync(customerId); var accessKey = ConfigurationController.GenerateAPIKey(); var newView = new ViewDTO(null, customerId, accessKey, new ViewCustomizationDTO("", "https://app.auditlog.co/images/logo56.png", customer.DisplayName, new List <ViewCustomizationHeaderLinkDTO>(), ""), CreateDefaultColumnLayout()); return(await _persistence.Views.CreateNewAsync(newView)); }
public async Task <IActionResult> ResetKeyAsync([FromBody] Guid viewId) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var id = new ViewId(viewId); var customerId = _membership.GetCustomerId(User); var accessKey = ConfigurationController.GenerateAPIKey(); var freshKey = await _persistence.Views.ResetKeyAsync(id, customerId, accessKey); return(Ok(new { Id = id, Key = freshKey })); }