LEGLINK-964: Fix inconsistent timestamp formats in FacilityReportingPlans CRUD - #1828
Conversation
CreateDate/ModifyDate are datetime2 columns with no offset, so a value that round-tripped through EF Core comes back DateTimeKind.Unspecified while a value stamped in memory just before SaveChangesAsync stays DateTimeKind.Utc. System.Text.Json only appends "Z" for Kind.Utc, so Create returned a "Z" suffix while Get/Update (which re-fetch first) did not - same field, two different formats depending on the operation. FacilityReportingPlanMapper.ToModel now pins both fields to Utc, mirroring the fix MockEntryMapper already applies to the same problem in MockDmrpApi.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe mapper now marks ChangesFacility Reporting Plan timestamp handling
Estimated code review effort: 2 (Simple) | ~10 minutes Mergeability Score: ⚪ Minimal · up to The change standardizes timestamp formatting for FacilityReportingPlans and is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
ValidateAsync used to query for an existing row with the same facility/mapping/period before every Create and Update, throwing DuplicateReportingPlanException up front. That extra round trip is gone: duplicate periods are now reported only when the database's unique index rejects the save, via TranslateSaveFailureAsync (which still recognizes the violation from the provider exception first, falling back to a query only when the exception doesn't name the index).
🛠️ Description of Changes
CreateDate/ModifyDate are datetime2 columns with no offset, so a value that round-tripped through EF Core comes back DateTimeKind.Unspecified while a value stamped in memory just before SaveChangesAsync stays DateTimeKind.Utc. System.Text.Json only appends "Z" for Kind.Utc, so Create returned a "Z" suffix while Get/Update (which re-fetch first) did not - same field, two different formats depending on the operation. FacilityReportingPlanMapper.ToModel now pins both fields to Utc, mirroring the fix MockEntryMapper already applies to the same problem in MockDmrpApi.
🧪 Testing Performed
Tested locally
🧑🔬 Unit Testing
📓 Documentation Updated
Please update any relevant sections in the project documentation that were impacted by the changes in the PR.
Summary by CodeRabbit
Bug Fixes
Zsuffix.Tests