Trial status endpoint for the workspace banner

C# · ASP.NET Core · beginner · modification

Adds the trial status endpoint the web app's trial banner reads. `TrialStatus.For` (new, `Workspaces/TrialStatus.cs`) turns a workspace's `TrialEndsOn` and today's date into `active`, `daysLeft` and `endsOn`; a workspace with no trial gets an inactive status with no end date. `WorkspaceEndpoints.cs` maps `GET /trial` in the existing workspace group (so it inherits sign-in and the membership filter), reads only `TrialEndsOn`, takes today's UTC date from the injected `TimeProvider` and returns the status, or 404 if the workspace row is not found. `TrialStatusTests.cs` adds xUnit tests for `TrialStatus.For`.

ASP.NET Core 10 minimal API on .NET 10 (C# 14, nullable reference types enabled, implicit usings), EF Core 10 with Npgsql, xUnit for tests. Existing and unchanged: `Program.cs` registers `AppDbContext`, `TimeProvider.System` as a singleton and the auth scheme, and calls `app.MapWorkspaceEndpoints()`; `AppDbContext.Workspaces` is the `Workspace` entity (`int Id`, `string Name`, `string Plan`, `DateOnly? TrialEndsOn` mapped to a Postgres `date` column, set by the signup flow and cleared by the billing webhook when the workspace pays, both unchanged); `WorkspaceSummary` is an existing record; `WorkspaceMemberFilter` answers itself unless the signed-in user is a member of the workspace in the path: 401 when signed out, 404 when no workspace has the path's id, 403 when the user is not a member. JSON uses the ASP.NET Core web defaults (camelCase names, `DateOnly` as `"yyyy-MM-dd"`). The banner (web app) ships separately and only reads this endpoint.

Requirements

Files touched

Review this PR

C# practice