This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user