addfunfacts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2021-05-19 17:56:56 +02:00
parent 8cd1e10cd7
commit 634488c2d8
107 changed files with 5270 additions and 289 deletions

View File

@@ -1,7 +1,11 @@
using HanyadikHetVan.Services;
using HanyadikHetVan.Data.Entities;
using HanyadikHetVan.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
namespace HanyadikHetVan.Controllers.V2
@@ -12,10 +16,12 @@ namespace HanyadikHetVan.Controllers.V2
public class HanyadikHetVanController : Controller
{
private readonly HanyadikHetVanEntityService _hanyadikHetVanEntityService;
private readonly UserManager<User> _userManager;
public HanyadikHetVanController(HanyadikHetVanEntityService hanyadikHetVanEntityService)
public HanyadikHetVanController(HanyadikHetVanEntityService hanyadikHetVanEntityService, UserManager<User> userManager)
{
_hanyadikHetVanEntityService = hanyadikHetVanEntityService ?? throw new ArgumentNullException(nameof(hanyadikHetVanEntityService));
_userManager = userManager ?? throw new ArgumentNullException(nameof(userManager));
}
[HttpGet("{weeklytimespanId}")]
@@ -49,5 +55,24 @@ namespace HanyadikHetVan.Controllers.V2
return BadRequest();
}
}
[HttpGet("my")]
[Authorize]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(int))]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
public async Task<IActionResult> GetUserDefaultWeek()
{
try
{
var wts = await _hanyadikHetVanEntityService.GetUserDefaultWeek(this.User.FindFirst(ClaimTypes.NameIdentifier).Value);
return Ok(wts);
}
catch (Exception)
{
return NotFound();
}
}
}
}