mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Logging;
|
|
using Wabbajack.DTOs.JsonConverters;
|
|
using Wabbajack.Hashing.xxHash64;
|
|
using Wabbajack.Server.DataLayer;
|
|
|
|
namespace Wabbajack.BuildServer.Controllers
|
|
{
|
|
[Authorize(Roles = "User")]
|
|
[ApiController]
|
|
[Route("/mod_files")]
|
|
public class ModFilesForHash : ControllerBase
|
|
{
|
|
private SqlService _sql;
|
|
private ILogger<ModFilesForHash> _logger;
|
|
private readonly DTOSerializer _dtos;
|
|
|
|
public ModFilesForHash(ILogger<ModFilesForHash> logger, SqlService sql, DTOSerializer dtos)
|
|
{
|
|
_logger = logger;
|
|
_sql = sql;
|
|
_dtos = dtos;
|
|
}
|
|
|
|
[HttpGet("by_hash/{hashAsHex}")]
|
|
public async Task<IActionResult> GetByHash(string hashAsHex)
|
|
{
|
|
var files = await _sql.ResolveDownloadStatesByHash(Hash.FromHex(hashAsHex));
|
|
return Ok(_dtos.Serialize(files));
|
|
}
|
|
}
|
|
}
|