authorize atribute added to shppinglistcontroller
This commit is contained in:
parent
1ce1f355c0
commit
edf8c73ec4
@ -1,6 +1,7 @@
|
||||
|
||||
using API.BusinessLogic;
|
||||
using API.Models.ShoppingListModels;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Security.Claims;
|
||||
|
||||
@ -17,6 +18,7 @@ namespace API.Controllers
|
||||
_shoppingListLogic = shoppingListLogic;
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpGet("get")]
|
||||
public async Task<IActionResult> ReadShoppingList()
|
||||
{
|
||||
@ -26,6 +28,7 @@ namespace API.Controllers
|
||||
return await _shoppingListLogic.ReadShoppingList(userId);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpPost("add")]
|
||||
public async Task<IActionResult> AddItem([FromBody] ShoppingListItemDTO listItemDTO)
|
||||
{
|
||||
@ -35,6 +38,7 @@ namespace API.Controllers
|
||||
return await _shoppingListLogic.AddItemToShoppingList(listItemDTO, userId);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpPut("check")]
|
||||
public async Task<IActionResult> CheckItem(int itemId)
|
||||
{
|
||||
@ -44,6 +48,7 @@ namespace API.Controllers
|
||||
return await _shoppingListLogic.CheckItemInShoppingList(userId, itemId);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpPut("update")]
|
||||
public async Task<IActionResult> UpdateItem([FromBody] ShoppingListItemDTO listItemDTO, int itemId)
|
||||
{
|
||||
@ -53,6 +58,7 @@ namespace API.Controllers
|
||||
return await _shoppingListLogic.UpdateItemInShoppingList(userId, itemId, listItemDTO);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpDelete("delete")]
|
||||
public async Task<IActionResult> DeleteItem(int itemId)
|
||||
{
|
||||
@ -62,6 +68,7 @@ namespace API.Controllers
|
||||
return await _shoppingListLogic.DeleteItemInShoppingList(userId, itemId);
|
||||
}
|
||||
|
||||
[Authorize]
|
||||
[HttpPost("recipeadd")]
|
||||
public async Task<IActionResult> AddARecipesItems(int recipeId)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user