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