Commit Graph

6 Commits

Author SHA1 Message Date
Jonas fc99c91bd8 Add auth controller/DTOs and update seed password
Introduce authentication API: add AuthController with login, logout and me endpoints using SignInManager/UserManager; add LoginRequest and CurrentUserResponse DTOs. Login enforces active users, updates UpdatedAt on success, and returns localized messages. Also change default seed admin password from "Hoard" to "HoardPassword".
2026-04-18 22:04:51 +02:00
Jonas ffaf5d24c1 Add ASP.NET Identity, AppUser, migrations
Introduce ASP.NET Core Identity with Guid keys: add Microsoft.AspNetCore.Identity.EntityFrameworkCore and update EF packages to 10.0.6. Replace DbContext with IdentityDbContext<AppUser, IdentityRole<Guid>, Guid>, apply entity configurations and map Identity tables to custom names (Users, Roles, UserRoles, etc.).

Add AppUser model (IsAdmin, IsActive, MustChangePassword, CreatedAt, UpdatedAt) and AppUserConfiguration to enforce required properties and table name. Add IdentitySeedService to create an initial admin account if none exists and log results.

Add generated migration InitIdentity and update the DbContext model snapshot. Wire up Identity in Program.cs (identity options, cookie config, AddEntityFrameworkStores), enable structured console logging and HTTP request logging, run migrations on startup and call the seed service, and enable authentication/authorization middleware. Update codexInfo.md to document the logging and seeding changes.
2026-04-18 21:54:57 +02:00
Jonas fcd2dca8dc Integrate PostgreSQL with EF Core & migrations
Add PostgreSQL support and EF Core migrations for local development. Introduces ApplicationDbContext, adds Npgsql.EntityFrameworkCore.PostgreSQL and EF Core Design packages, and includes generated migrations (InitialPostgres and RemoveTestItems) plus updated model snapshot. Program.cs now loads an optional API/appsettings.custom.json, configures the DbContext from ConnectionStrings:Postgres and runs Database.Migrate() on startup. Adds a Dev docker-compose.yml to run postgres + pgAdmin, pins dotnet-ef in dotnet-tools.json, and adds ConnectionStrings to appsettings files. Also ignores API/appsettings.custom.json in .gitignore and updates README/codexInfo to document the new DB/dev workflow.
2026-04-18 17:40:42 +02:00
Jonas db8ed2a868 Add Swagger/OpenAPI support (development only)
Add Swashbuckle.AspNetCore (v6.6.2) to API project and register Swagger services (AddEndpointsApiExplorer, AddSwaggerGen). Enable UseSwagger/UseSwaggerUI only in Development to expose /swagger for API exploration without affecting production behavior. Update codexInfo.md to document the dev-only Swagger endpoint.
2026-04-18 15:28:24 +02:00
Jonas 522d31dc6e Serve SPA from API and add health endpoint
Switch backend to serve the built SPA and static assets, add a minimal health endpoint, and clean up template code. Changes: added API/Controllers/HealthController.cs (GET /api/health -> 200), removed WeatherForecast controller and model, removed OpenAPI package reference and OpenAPI wiring from API.csproj/Program.cs, updated Program.cs to serve wwwroot with default files/static files and a SPA fallback that returns index.html for non-/api routes (/api/* returns 404), updated GUI/vite.config.ts to output build to API/wwwroot and clear the directory, added API/wwwroot to .gitignore, and updated codexInfo.md to document these changes. This enables the GUI build to be deployed directly into the API project and served as a single-page app.
2026-04-18 12:45:02 +02:00
Jonas 80da30f454 Init 2026-04-15 20:34:10 +02:00