diff --git a/src/PandaWebApi.Tests/PandaWebApi.Tests.csproj b/src/PandaWebApi.Tests/PandaWebApi.Tests.csproj index 125cc39..1998077 100644 --- a/src/PandaWebApi.Tests/PandaWebApi.Tests.csproj +++ b/src/PandaWebApi.Tests/PandaWebApi.Tests.csproj @@ -15,14 +15,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/PandaWebApi/Attributes/AuthorizeAttribute.cs b/src/PandaWebApi/Attributes/AuthorizeAttribute.cs index 09949b5..b242854 100644 --- a/src/PandaWebApi/Attributes/AuthorizeAttribute.cs +++ b/src/PandaWebApi/Attributes/AuthorizeAttribute.cs @@ -1,6 +1,4 @@ -using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc.Filters; -using PandaWebApi.Contexts; using PandaWebApi.DTOs.User; using PandaWebApi.Enums; using PandaWebApi.Services.Interfaces; diff --git a/src/PandaWebApi/Extensions/HangfireExtension.cs b/src/PandaWebApi/Extensions/HangfireExtension.cs index c297fdf..0dcb38e 100644 --- a/src/PandaWebApi/Extensions/HangfireExtension.cs +++ b/src/PandaWebApi/Extensions/HangfireExtension.cs @@ -28,7 +28,11 @@ public static WebApplicationBuilder AddHangfireServer(this WebApplicationBuilder configuration.UseRecommendedSerializerSettings(); configuration.UsePostgreSqlStorage(c => c.UseNpgsqlConnection(postgresConnectionString)); }); - builder.Services.AddHangfireServer(); + + builder.Services.AddHangfireServer(options => + { + options.WorkerCount = 5; + }); return builder; } diff --git a/src/PandaWebApi/Models/UserToken.cs b/src/PandaWebApi/Models/UserToken.cs index 008b80b..1c3c32f 100644 --- a/src/PandaWebApi/Models/UserToken.cs +++ b/src/PandaWebApi/Models/UserToken.cs @@ -14,9 +14,9 @@ public class UserToken public byte[] RefreshTokenHash { get; set; } = null!; public DateTime AccessTokenExpiresAt { get; set; } public DateTime RefreshTokenExpiresAt { get; set; } - public DateTime OriginalRefreshTokenCreatedAt { get; set; } + public DateTime InitialRefreshTokenCreatedAt { get; set; } public DateTime CreatedAt { get; set; } public User User { get; set; } = null!; - + public UserToken PreviousUserToken { get; set; } = null!; } \ No newline at end of file diff --git a/src/PandaWebApi/PandaWebApi.csproj b/src/PandaWebApi/PandaWebApi.csproj index 287004e..957a504 100644 --- a/src/PandaWebApi/PandaWebApi.csproj +++ b/src/PandaWebApi/PandaWebApi.csproj @@ -39,7 +39,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -60,5 +60,10 @@ <_ContentIncludedByDefault Remove="be-tmp-web-api-postgres-logs\elastic-buffer-20230824.json" /> + <_ContentIncludedByDefault Remove="wwwroot\assets\css\panda-style.css" /> + <_ContentIncludedByDefault Remove="wwwroot\assets\images\favicon.svg" /> + <_ContentIncludedByDefault Remove="wwwroot\assets\images\logo-wording.svg" /> + <_ContentIncludedByDefault Remove="wwwroot\assets\images\logo.svg" /> + <_ContentIncludedByDefault Remove="wwwroot\assets\js\docs.js" /> diff --git a/src/PandaWebApi/Services/Implementations/UserTokenService.cs b/src/PandaWebApi/Services/Implementations/UserTokenService.cs index 2ed1f4d..bad9b3b 100644 --- a/src/PandaWebApi/Services/Implementations/UserTokenService.cs +++ b/src/PandaWebApi/Services/Implementations/UserTokenService.cs @@ -66,7 +66,7 @@ public async Task CreateTokenAsync(IdentifyUserDto user, HttpContext RefreshTokenHash = Sha3.Hash(refreshTokenSignature), AccessTokenExpiresAt = now.AddMinutes(AccessTokenExpirationMinutes), RefreshTokenExpiresAt = now.AddMinutes(_refreshTokenExpirationMinutes), - OriginalRefreshTokenCreatedAt = now, + InitialRefreshTokenCreatedAt = now, CreatedAt = now }; await _context.UserTokens.AddAsync(token); @@ -203,9 +203,9 @@ public async Task RefreshTokenAsync(RefreshTokenDto refreshTokenDto) var newExpirationDate = now.AddMinutes(_refreshTokenExpirationMinutes); - if (newExpirationDate > userToken.OriginalRefreshTokenCreatedAt.AddMinutes(_refreshTokenMaxExpirationMinutes)) + if (newExpirationDate > userToken.InitialRefreshTokenCreatedAt.AddMinutes(_refreshTokenMaxExpirationMinutes)) { - newExpirationDate = userToken.OriginalRefreshTokenCreatedAt.AddMinutes(_refreshTokenMaxExpirationMinutes); + newExpirationDate = userToken.InitialRefreshTokenCreatedAt.AddMinutes(_refreshTokenMaxExpirationMinutes); } if (newExpirationDate <= now.AddMinutes(60)) @@ -224,7 +224,7 @@ public async Task RefreshTokenAsync(RefreshTokenDto refreshTokenDto) RefreshTokenHash = Sha3.Hash(newRefreshTokenSignature), AccessTokenExpiresAt = now.AddMinutes(AccessTokenExpirationMinutes), RefreshTokenExpiresAt = newExpirationDate, - OriginalRefreshTokenCreatedAt = userToken.OriginalRefreshTokenCreatedAt, + InitialRefreshTokenCreatedAt = userToken.InitialRefreshTokenCreatedAt, CreatedAt = now }; diff --git a/src/PandaWebApi/wwwroot/assets/css/panda-style.css b/src/PandaWebApi/wwwroot/assets/css/panda-style.css index e72c034..329c5de 100644 --- a/src/PandaWebApi/wwwroot/assets/css/panda-style.css +++ b/src/PandaWebApi/wwwroot/assets/css/panda-style.css @@ -122,7 +122,7 @@ div.topbar { } .swagger-ui .dialog-ux .modal-ux { - max-width: 300px; + max-width: 600px; } .opblock-summary-get:hover { diff --git a/src/PandaWebApi/wwwroot/assets/js/docs.js b/src/PandaWebApi/wwwroot/assets/js/docs.js index 57c9e94..e81be03 100644 --- a/src/PandaWebApi/wwwroot/assets/js/docs.js +++ b/src/PandaWebApi/wwwroot/assets/js/docs.js @@ -1,16 +1,24 @@ -(function () { - - var link = - document.querySelector("link[rel*='icon']") || - document.createElement("link"); - document.head.removeChild(link); - link = - document.querySelector("link[rel*='icon']") || - document.createElement("link"); +document.addEventListener('DOMContentLoaded', function () { + + var link = document.querySelector("link[rel*='icon']") || document.createElement("link"); document.head.removeChild(link); link = document.createElement("link"); link.type = "image/x-icon"; link.rel = "shortcut icon"; link.href = "../assets/images/favicon.svg"; document.getElementsByTagName("head")[0].appendChild(link); -})(); + + // Adjusted MutationObserver code + const observer = new MutationObserver((mutations) => { + const modal = document.querySelector('.modal-ux-content'); + if (modal) { + modal.scrollTo(0, 0); + observer.disconnect(); + } + }); + + observer.observe(document.body, { + childList: true, + subtree: true, + }); +}); \ No newline at end of file