BRAKING refactor project structure.

Refactor: the project is now divided into a more clear structure, with **Infrastructure** and **Application** layers added.

Refactor: configurations are split into sections for different layers.

Fix: now EF Core related operations, such as migration, should be invoked in `OptixServe.Infrastructure`, with config file and data dir passed into `dotnet ef` command. See `OptixServe.Infrastructure/Utilites/DesignTimeDbContextFactory.cs` for details.

Fix: EF migrations are ignored in gitignore on purpose in early development.
This commit is contained in:
2025-07-11 14:48:50 +08:00
parent 47cbdc21c1
commit 8b18de1735
20 changed files with 286 additions and 100 deletions

View File

@ -13,9 +13,9 @@ public interface ITokenService
public string GenerateToken(User user);
}
public class TokenService(IOptions<OptixServeSettings> optixServeSettings) : ITokenService
public class TokenService(IOptions<ApiConfiguration> apiConfiguration) : ITokenService
{
private readonly JwtSettings _jwtSettings = optixServeSettings.Value.Jwt ?? throw new ArgumentNullException(nameof(optixServeSettings), "JWT settings are not configured.");
private readonly JwtSettings _jwtSettings = apiConfiguration.Value.Jwt ?? throw new ArgumentNullException(nameof(apiConfiguration), "JWT settings are not configured.");
public string GenerateToken(User user)
{
@ -41,4 +41,4 @@ public class TokenService(IOptions<OptixServeSettings> optixServeSettings) : ITo
var token = tokenHandler.CreateToken(tokenDescriptor);
return tokenHandler.WriteToken(token);
}
}
}