30 lines
850 B
C#
30 lines
850 B
C#
using qtc_api.Services.BucketService;
|
|
|
|
namespace qtc_api.Controllers
|
|
{
|
|
[ApiController]
|
|
[Route("api/tags")]
|
|
public class TagController : ControllerBase
|
|
{
|
|
private readonly IBucketService _bucketService;
|
|
public TagController(IBucketService bucketService)
|
|
{
|
|
_bucketService = bucketService;
|
|
}
|
|
|
|
[HttpGet]
|
|
[Route("{tagName}")]
|
|
[Authorize]
|
|
public async Task<ActionResult> GetTagPicBytes(string tagName)
|
|
{
|
|
var _s3Res = await _bucketService.GetTagImageBytes(tagName);
|
|
if (_s3Res != null)
|
|
return new FileContentResult(_s3Res, "image/jpeg");
|
|
else
|
|
{
|
|
return NotFound(); // TODO - code the legacy way of finding images here (mostly for self-hosters)
|
|
}
|
|
}
|
|
}
|
|
}
|