Skip to content

map cerated date for the get system user requets#2054

Merged
acn-dgopa merged 2 commits into
mainfrom
feature/bug-created-mapping
Jun 18, 2026
Merged

map cerated date for the get system user requets#2054
acn-dgopa merged 2 commits into
mainfrom
feature/bug-created-mapping

Conversation

@acn-dgopa

@acn-dgopa acn-dgopa commented Jun 18, 2026

Copy link
Copy Markdown
Member

Description

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)
  • All tests run green

Documentation

  • User documentation is updated with a separate linked PR in altinn-studio-docs. (if applicable)

Summary by CodeRabbit

  • New Features
    • Request responses now include creation timestamps, enabling better tracking and auditing of request lifecycle across all request lookup endpoints.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@acn-dgopa, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 12 minutes and 37 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a72469bc-d14e-4e7e-8028-39cca07967fa

📥 Commits

Reviewing files that changed from the base of the PR and between e0d53cb and fed5568.

📒 Files selected for processing (3)
  • src/Authentication/Services/ChangeRequestSystemUserService.cs
  • src/Core/Models/SystemUsers/ChangeRequestResponse.cs
  • test/Altinn.Platform.Authentication.Tests/Controllers/ChangeRequestControllerTest.cs
📝 Walkthrough

Walkthrough

[JsonPropertyName("created")] is added to the Created property on RequestSystemResponse and AgentRequestSystemResponse. Five request-lookup methods in RequestSystemUserService now assign Created = res.Created when constructing their response objects. Tests gain Assert.NotEqual(default(DateTime), ...) assertions and switch some deserializations to ReadFromJsonAsync.

Changes

Created Timestamp in Request Responses

Layer / File(s) Summary
DTO JSON mapping and service population
src/Core/Models/SystemUsers/RequestSystemResponse.cs, src/Core/Models/SystemUsers/AgentRequestSystemResponse.cs, src/Authentication/Services/RequestSystemUserService.cs
Adds [JsonPropertyName("created")] to the Created property on both response DTOs, then assigns Created = res.Created in GetRequestByExternalRef, GetRequestByGuid, GetRequestByPartyAndRequestId, GetAgentRequestByGuid, and GetAgentRequestByPartyAndRequestId.
Test assertions for Created field
test/Altinn.Platform.Authentication.Tests/Controllers/RequestControllerTests.cs
Adds Assert.NotEqual(default(DateTime), response.Created) in five test paths (GUID, agent GUID, external-ref, and both party-scoped variants); switches party-scoped tests from manual JsonSerializer.Deserialize to ReadFromJsonAsync.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title contains a spelling error ('cerated' instead of 'created') and is vague about which specific methods or endpoints are affected, though it does address the core change of mapping created date for system user requests. Correct the spelling to 'created' and consider making the title more specific, such as 'Add created date mapping to system user request responses' for clarity.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/bug-created-mapping

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Authentication/Services/RequestSystemUserService.cs (1)

470-482: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve TimedOut in party-scoped response mappings.

Line 470 and Line 507 construct new DTOs but never assign TimedOut, so timed-out requests can be returned as false by default for these two endpoints while other lookup endpoints return the persisted value.

Suggested fix
         var request = new RequestSystemResponse
         {
             Id = find.Id,
             IntegrationTitle = find.IntegrationTitle,
             SystemId = find.SystemId,
             ExternalRef = find.ExternalRef,
             Rights = find.Rights,
             AccessPackages = find.AccessPackages,
             PartyOrgNo = find.PartyOrgNo,
             Status = find.Status,
             RedirectUrl = find.RedirectUrl,
+            TimedOut = find.TimedOut,
             Created = find.Created
         };

         var request = new AgentRequestSystemResponse
         {
             Id = find.Id,
             IntegrationTitle = find.IntegrationTitle,
             SystemId = find.SystemId,
             ExternalRef = find.ExternalRef,
             AccessPackages = find.AccessPackages,
             PartyOrgNo = find.PartyOrgNo,
             Status = find.Status,
             RedirectUrl = find.RedirectUrl,
+            TimedOut = find.TimedOut,
             Created = find.Created
         };

Also applies to: 507-518

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Authentication/Services/RequestSystemUserService.cs` around lines 470 -
482, The RequestSystemResponse DTO being constructed at the mapping in
RequestSystemUserService.cs is missing the TimedOut property assignment, causing
timed-out requests to be returned with a default false value instead of
preserving the actual persisted value from the find object. Add TimedOut =
find.TimedOut to the RequestSystemResponse object initialization to preserve
this property. This same issue also exists at another similar DTO construction
location around line 507-518, so ensure both RequestSystemResponse mappings are
updated with the TimedOut assignment.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/Authentication/Services/RequestSystemUserService.cs`:
- Around line 470-482: The RequestSystemResponse DTO being constructed at the
mapping in RequestSystemUserService.cs is missing the TimedOut property
assignment, causing timed-out requests to be returned with a default false value
instead of preserving the actual persisted value from the find object. Add
TimedOut = find.TimedOut to the RequestSystemResponse object initialization to
preserve this property. This same issue also exists at another similar DTO
construction location around line 507-518, so ensure both RequestSystemResponse
mappings are updated with the TimedOut assignment.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b19d2810-7fb8-4d8a-b3ff-fa4597f78e27

📥 Commits

Reviewing files that changed from the base of the PR and between 45cd68f and e0d53cb.

📒 Files selected for processing (4)
  • src/Authentication/Services/RequestSystemUserService.cs
  • src/Core/Models/SystemUsers/AgentRequestSystemResponse.cs
  • src/Core/Models/SystemUsers/RequestSystemResponse.cs
  • test/Altinn.Platform.Authentication.Tests/Controllers/RequestControllerTests.cs

@sonarqubecloud

Copy link
Copy Markdown

@acn-dgopa acn-dgopa merged commit 76a31b8 into main Jun 18, 2026
9 of 10 checks passed
@acn-dgopa acn-dgopa deleted the feature/bug-created-mapping branch June 18, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Created date for systembrukerforespørsel (standard) gir feil dato

3 participants