isn/src/isnd/Controllers/Packages/Delete.cs

24 lines
793 B
C#
Raw Normal View History

2021-09-05 15:44:47 +01:00
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using isnd.Helpers;
2022-04-17 16:22:40 +01:00
using isnd.Entities;
2021-09-05 15:44:47 +01:00
using System.ComponentModel.DataAnnotations;
2021-09-05 19:33:39 +01:00
using isnd.Attributes;
2022-09-23 20:34:51 +01:00
using System.Security.Claims;
2021-09-05 15:44:47 +01:00
namespace isnd.Controllers
{
public partial class PackagesController
{
2022-09-23 20:34:51 +01:00
[HttpDelete(_pkgRootPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
public async Task<IActionResult> ApiDelete(
2021-09-05 15:44:47 +01:00
[FromRoute][SafeName][Required] string id,
2022-09-23 20:34:51 +01:00
[FromRoute][SafeName][Required] string lower,
[FromRoute] string type)
2021-09-05 15:44:47 +01:00
{
2022-09-23 20:34:51 +01:00
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
var report = await packageManager.UserAskForPackageDeletionAsync(uid, id, lower, type);
2021-09-05 15:44:47 +01:00
return Ok(report);
}
}
}