v2 token endpoints#312
Merged
Merged
Conversation
hhvrc
approved these changes
Jun 2, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces v2 token read endpoints and updates the underlying ApiToken.LastUsed storage/model to use NULL instead of a PostgreSQL -infinity sentinel, aligning the API surface with a nullable “never used” concept.
Changes:
- Make
ApiToken.LastUsednullable and remove the-infinitydefault from the EF model. - Add a migration to convert existing
-infinityvalues toNULL(and restore on down migration). - Add v2 token response DTO + versioned v1/v2 GET endpoints to expose
LastUsedas nullable in v2.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| Common/OpenShockDb/OpenShockContext.cs | Removes LastUsed default value SQL from the EF model configuration. |
| Common/OpenShockDb/ApiToken.cs | Changes LastUsed to DateTime?. |
| Common/Migrations/OpenShockContextModelSnapshot.cs | Updates snapshot to reflect nullable LastUsed and removed default. |
| Common/Migrations/20260601005411_MakeApiTokenLastUsedNullable.Designer.cs | Adds migration designer for the nullable LastUsed change. |
| Common/Migrations/20260601005411_MakeApiTokenLastUsedNullable.cs | Adds migration logic, including data rewrite from -infinity to NULL. |
| API/Models/Response/TokenResponseV2.cs | Introduces v2 token response model with nullable LastUsed. |
| API/Controller/Tokens/Tokens.cs | Adds v1/v2-mapped GET endpoints and shared query/projection helpers. |
| API/Controller/Tokens/GetTokenSelf.cs | Adds v2 self-token endpoint and shares mapping logic between versions. |
| API/Controller/Tokens/_ApiController.cs | Declares token controller supports API versions 1 and 2. |
Files not reviewed (1)
- Common/Migrations/20260601005411_MakeApiTokenLastUsedNullable.Designer.cs: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
hhvrc
reviewed
Jun 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.