This commit is contained in:
2020-08-10 19:28:16 +00:00
parent 98a7d77069
commit 6ce9ce4d8f
5 changed files with 74 additions and 15 deletions

View File

@@ -96,16 +96,6 @@ namespace AyaNova.Api.Controllers
} }
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
// var asText = Newtonsoft.Json.JsonConvert.SerializeObject(
// o,
// Newtonsoft.Json.Formatting.None,
// new JsonSerializerSettings { ContractResolver = new ShouldSerializeContractResolver(new string[] { "Concurrency", "Id", "LogoId" }) });
// var bytes = System.Text.Encoding.UTF8.GetBytes(asText);
// var file = new FileContentResult(bytes, "application/octet-stream");
// file.FileDownloadName = Util.FileUtil.StringToSafeFileName(o.Name) + ".json";
// return file;
} }
@@ -176,5 +166,58 @@ namespace AyaNova.Api.Controllers
} }
return Accepted(); return Accepted();
} }
/// <summary>
/// Delete logo
/// </summary>
/// <param name="size"></param>
/// <returns>NoContent</returns>
[Authorize]
[HttpDelete("{size}")]
public async Task<IActionResult> DeleteLogo([FromRoute] string size)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.Global))
return StatusCode(403, new ApiNotAuthorizedResponse());
if (string.IsNullOrWhiteSpace(size))
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_REQUIRED, "size", "Size is required and must be one of 'small', 'medium' or 'large'"));
size = size.ToLowerInvariant();
if (size != "small" && size != "medium" && size != "large")
return BadRequest(new ApiErrorResponse(ApiErrorCode.VALIDATION_INVALID_VALUE, "size", "Size parameter must be one of 'small', 'medium' or 'large'"));
//get the one and only logo object
var logo = await ct.Logo.FirstOrDefaultAsync();
if (logo != null)
{
switch (size)
{
case "small":
logo.Small = null;
logo.SmallType = string.Empty;
break;
case "medium":
logo.Medium = null;
logo.MediumType = string.Empty;
break;
case "large":
logo.Large = null;
logo.LargeType = string.Empty;
break;
}
await ct.SaveChangesAsync();
}
return NoContent();
}
} }
} }

View File

@@ -1910,5 +1910,9 @@
"AyaNovaServerURL": "AyaNova Server URL", "AyaNovaServerURL": "AyaNova Server URL",
"DeliverAfter": "Liefern nach", "DeliverAfter": "Liefern nach",
"NotifyQueue": "Warteschlange für Benachrichtigungszustellung", "NotifyQueue": "Warteschlange für Benachrichtigungszustellung",
"DirectNotification": "Direkte Benachrichtigung" "DirectNotification": "Direkte Benachrichtigung",
"GlobalLogo":"Geschäftslogos",
"SmallLogo":"Kleines Logo",
"MediumLogo":"Mittelgroßes Logo",
"LargeLogo":"Großes Logo"
} }

View File

@@ -1910,5 +1910,9 @@
"AyaNovaServerURL": "AyaNova server URL", "AyaNovaServerURL": "AyaNova server URL",
"DeliverAfter":"Deliver after", "DeliverAfter":"Deliver after",
"NotifyQueue":"Notify event delivery queue", "NotifyQueue":"Notify event delivery queue",
"DirectNotification":"Direct notification" "DirectNotification":"Direct notification",
"GlobalLogo":"Business logos",
"SmallLogo":"Small sized logo",
"MediumLogo":"Medium sized logo",
"LargeLogo":"Large sized logo"
} }

View File

@@ -1910,5 +1910,9 @@
"AyaNovaServerURL": "URL del servidor AyaNova", "AyaNovaServerURL": "URL del servidor AyaNova",
"DeliverAfter": "Entregar después", "DeliverAfter": "Entregar después",
"NotifyQueue": "Notificar cola de entrega de eventos", "NotifyQueue": "Notificar cola de entrega de eventos",
"DirectNotification": "Notificación directa" "DirectNotification": "Notificación directa",
"GlobalLogo":"Logotipos comerciales",
"SmallLogo":"Logotipo de tamaño pequeño",
"MediumLogo":"Logotipo de tamaño mediano",
"LargeLogo":"Logotipo de gran tamaño"
} }

View File

@@ -1910,5 +1910,9 @@
"AyaNovaServerURL": "URL du serveur AyaNova", "AyaNovaServerURL": "URL du serveur AyaNova",
"DeliverAfter": "Livrer après", "DeliverAfter": "Livrer après",
"NotifyQueue": "Notifier file d'attente de remise des événements", "NotifyQueue": "Notifier file d'attente de remise des événements",
"DirectNotification": "Notification directe" "DirectNotification": "Notification directe",
"GlobalLogo":"Logos d'entreprise",
"SmallLogo":"Logo de petite taille",
"MediumLogo":"Logo de taille moyenne",
"LargeLogo":"Logo de grande taille"
} }