feat: add sampleName field to Sample schema#2747
Merged
Merged
Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
UpdateSampleDto,sampleNameis marked as required, which may break existing partial update flows; consider making it optional or aligning its validation with how PATCH/partial updates are intended to work for this resource. - The migration
downmethod is currently a no-op; if rollback is expected in your migration flow, consider unsettingsampleNameon documents where it was backfilled to avoid leaving irreversible data shape changes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `UpdateSampleDto`, `sampleName` is marked as required, which may break existing partial update flows; consider making it optional or aligning its validation with how PATCH/partial updates are intended to work for this resource.
- The migration `down` method is currently a no-op; if rollback is expected in your migration flow, consider unsetting `sampleName` on documents where it was backfilled to avoid leaving irreversible data shape changes.
## Individual Comments
### Comment 1
<location path="src/samples/dto/update-sample.dto.ts" line_range="26" />
<code_context>
+ */
+ @IsString()
+ @IsNotEmpty()
+ readonly sampleName: string;
+
/**
</code_context>
<issue_to_address>
**question:** Consider whether `sampleName` should be optional in an update DTO
For an update DTO, requiring `sampleName` means every update must supply it, even when modifying other fields only. If this endpoint is intended for partial updates, consider marking `sampleName` as `@IsOptional()` and `readonly sampleName?: string`, and keep it required only in the create DTO. If updates are meant to be full replacements, this is fine—just confirm it aligns with the API contract.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Merged
2 tasks
nitrosx
approved these changes
May 22, 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.
Description
This PR adds sampleName field to the Sample schema. Since existing samples were created without this field, a migration has been added to backfill sampleName with the existing sampleId value.
Motivation
Fixes
Changes:
Tests included
Documentation
official documentation info
Summary by Sourcery
Add a required sampleName field to the Sample model and backfill existing records from sampleId.
New Features:
Enhancements: