Finished adding user support and ability to update specific novels or set your last read chapter
This commit is contained in:
31
WebNovelPortalAPI/Controllers/AuthorizedController.cs
Normal file
31
WebNovelPortalAPI/Controllers/AuthorizedController.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Treestar.Shared.Models.DBDomain;
|
||||
using WebNovelPortalAPI.Middleware;
|
||||
|
||||
namespace WebNovelPortalAPI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class AuthorizedController : ControllerBase
|
||||
{
|
||||
protected int UserId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (int) (HttpContext.Items[EnsureUserCreatedMiddleware.UserIdItemName] ?? 0);
|
||||
}
|
||||
}
|
||||
|
||||
public AuthorizedController()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user