Fix/save code description and audit order#201
Merged
alessandrobelli merged 9 commits intomainfrom Oct 14, 2025
Merged
Conversation
added 2 commits
October 13, 2025 11:18
Code creation now accepts an optional description field, validated as nullable and up to 500 characters. Audit sorting and filtering now use a timestamp for created_at, improving date handling. Tests added for creating codes with and without descriptions.
Appends ->values() after sorting audit collections by 'created_at_timestamp' in User and AuditService classes to reset indexes. This improves consistency when returning sorted collections.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for storing and validating code descriptions during creation, improves audit timestamp handling for more reliable sorting and filtering, and introduces comprehensive feature tests for code creation scenarios.
- Added optional description field support to code creation with proper validation (up to 500 characters)
- Enhanced audit system with timestamp-based sorting and filtering for improved reliability
- Added comprehensive test coverage for code creation with and without descriptions
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| web/tests/Feature/CodeControllerTest.php | Added feature tests for code creation with and without description fields |
| web/app/Services/AuditService.php | Enhanced audit transformation with timestamp field and improved sorting/filtering |
| web/app/Models/User.php | Updated audit sorting to use timestamp field instead of date string |
| web/app/Http/Requests/StoreCodeRequest.php | Added validation rule for optional description field |
| web/app/Http/Controllers/CodingController.php | Added description field assignment during code creation |
| docs/CURRENT-TESTS.md | Updated test documentation with new test cases |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
added 6 commits
October 13, 2025 11:48
Refines conditional rendering to show color backgrounds only for 'Code' model and 'color' key. Adds handling for 'source.locked' audit events to display locked model information. Enhances clarity and accuracy of audit event presentation.
Added 'modifying_user_id' to the list of attributes excluded from auditing in Project model, but included it in audit transformation for both User and AuditService. Updated Audit.vue to display the code name when relevant for audit entries. This improves audit traceability and UI clarity for code-related changes.
Corrects conditional rendering logic for 'created' and 'modified' audit events when the model is 'Codebook' and the key is 'description' with a null value. Ensures proper display of audit messages in these cases.
Eliminates the 'modifying_user_id' field from project audit exclusion and audit transformation logic in Project, User, and AuditService classes. Also cleans up related conditional display logic in Audit.vue to simplify audit event rendering.
kadewe
reviewed
Oct 13, 2025
kadewe
previously approved these changes
Oct 13, 2025
Contributor
kadewe
left a comment
There was a problem hiding this comment.
OK, wow, so we just forgot to save the description 😬?
Please have a look at my max:500 char string length comment, I think this is to short. If the database supports it, make it longer to 1000 char.
The maximum allowed length for the 'description' field in StoreCodeRequest has been increased from 500 to 5000 characters to support longer input.
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.
This pull request adds support for storing and validating a code's description when creating new codes, improves audit timestamp handling for more reliable sorting and filtering, and introduces new feature tests for code creation. The main changes are grouped below:
Code Creation and Validation
descriptionwhen creating a new code inCodingController.php, and updated validation rules to makedescriptionan optional string up to 500 characters inStoreCodeRequest.php. [1] [2]CodeControllerTest.php.Audit Logging Improvements
created_at_timestampfield, and audit sorting is updated to use this timestamp for more reliable ordering in bothAuditService.phpandUser.php. [1] [2] [3]AuditService.php.Documentation and Test Coverage
docs/CURRENT-TESTS.mdto reflect new test cases for code creation with and without description, and for private codebook access. [1] [2] [3]Solve #199