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;
|
2026-07-05 17:22:57 +01:00
|
|
|
using Isn.Abstract;
|
2022-09-23 20:34:51 +01:00
|
|
|
|
2021-09-05 15:44:47 +01:00
|
|
|
namespace isnd.Controllers
|
|
|
|
|
{
|
|
|
|
|
public partial class PackagesController
|
|
|
|
|
{
|
2023-03-18 12:50:31 +00:00
|
|
|
[HttpDelete(Constants.PackageRootServerPrefix + ApiConfig.Delete + "/{id}/{lower?}/{type?}")]
|
2022-09-23 20:34:51 +01:00
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|