2020-08-10 09:22:33 +02:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using AutoMapper;
|
|
|
|
|
using Giants.Services;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
|
|
|
|
namespace Giants.WebApi.Controllers
|
|
|
|
|
{
|
|
|
|
|
[ApiController]
|
2020-10-12 23:42:44 +02:00
|
|
|
|
[ApiVersion("1.0")]
|
2020-11-07 00:30:31 +01:00
|
|
|
|
[ApiVersion("1.1")]
|
2020-08-10 09:22:33 +02:00
|
|
|
|
[Route("api/[controller]")]
|
|
|
|
|
public class VersionController : ControllerBase
|
|
|
|
|
{
|
|
|
|
|
private readonly IMapper mapper;
|
|
|
|
|
private readonly IUpdaterService updaterService;
|
|
|
|
|
|
|
|
|
|
public VersionController(
|
|
|
|
|
IMapper mapper,
|
|
|
|
|
IUpdaterService updaterService)
|
|
|
|
|
{
|
|
|
|
|
this.mapper = mapper;
|
|
|
|
|
this.updaterService = updaterService;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
2020-08-16 11:03:10 +02:00
|
|
|
|
public async Task<DataContract.V1.VersionInfo> GetVersionInfo(string appName)
|
2020-08-10 09:22:33 +02:00
|
|
|
|
{
|
2020-08-11 10:29:45 +02:00
|
|
|
|
Services.VersionInfo versionInfo = await this.updaterService.GetVersionInfo(appName);
|
2020-08-10 09:22:33 +02:00
|
|
|
|
|
2020-09-06 01:47:00 +02:00
|
|
|
|
return this.mapper.Map<DataContract.V1.VersionInfo>(versionInfo);
|
2020-08-10 09:22:33 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|