1.6 KiB
1.6 KiB
AI_TASKS.md
Quick task cookbook for common changes in this repo.
Add a new API endpoint group
- Create
Freman.Sample.Web/Endpoints/<Feature>Endpoints.cs - Add an extension method:
public static IEndpointRouteBuilder Map<Feature>Endpoints(this IEndpointRouteBuilder app)
- Call it from
Freman.Sample.Web/Program.cs:app.Map<Feature>Endpoints();
Add a new Client page that calls the API
- Create page in
Freman.Sample.Web.Client/Pages/<Page>.razor - Ensure it runs as WASM and avoids server prerender DI issues:
@rendermode @(new InteractiveWebAssemblyRenderMode(prerender: false))
- Inject
HttpClient:@inject HttpClient Http
- Call server endpoints under
/api/*
Add shared request/response models
- Add to
Freman.Sample.Web.Contracts - Reference contracts project from Server + Client
- Use contracts types in endpoints + client code (avoid duplicates)
Add an EF Core migration
From solution root:
powershell dotnet tool restore
dotnet tool run dotnet-ef -- migrations add --project .\Freman.Sample.Web\Freman.Sample.Web\Freman.Sample.Web.csproj --startup-project .\Freman.Sample.Web\Freman.Sample.Web\Freman.Sample.Web.csproj ` --output-dir Data\Migrations
Apply migrations manually (optional)
powershell dotnet tool run dotnet-ef -- database update --project .\Freman.Sample.Web\Freman.Sample.Web\Freman.Sample.Web.csproj --startup-project .\Freman.Sample.Web\Freman.Sample.Web\Freman.Sample.Web.csproj
Add a confirmation step in the client
Use Freman.Sample.Web.Client/Components/ConfirmModal.razor and call:
await _confirmModal.ShowAsync("Title", "Message")