-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] Tag Type DTO #8740
[Fix] Tag Type DTO #8740
Conversation
WalkthroughThis pull request introduces several modifications across warehouse and tag-related modules. The changes primarily focus on refining type safety, error handling, and module configuration. Key updates include adjusting the Changes
Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
packages/core/src/lib/tags/dto/update-tag.dto.ts
(1 hunks)packages/core/src/lib/tags/tag.entity.ts
(1 hunks)packages/core/src/lib/warehouse/warehouse-product-service.ts
(2 hunks)packages/core/src/lib/warehouse/warehouse.controller.ts
(2 hunks)packages/core/src/lib/warehouse/warehouse.module.ts
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: build
- GitHub Check: test
🔇 Additional comments (4)
packages/core/src/lib/tags/dto/update-tag.dto.ts (1)
5-5
: Simplify UpdateTagDTO by extending PartialType of CreateTagDTORefactoring
UpdateTagDTO
to extendPartialType(CreateTagDTO)
streamlines the DTO structure, enhancing code maintainability and consistency across the application.packages/core/src/lib/warehouse/warehouse.module.ts (1)
5-5
: Enhance modularity by importing ProductModuleBy importing
ProductModule
, the warehouse module now leverages product services without directly depending on theProduct
entity. This improves modularity and promotes separation of concerns.packages/core/src/lib/warehouse/warehouse.controller.ts (1)
22-23
: LGTM! Import changes align with type standardization.The addition of the
ID
type import from@gauzy/contracts
helps standardize ID types across the codebase.packages/core/src/lib/tags/tag.entity.ts (1)
140-144
: Verify the impact of making tagTypeId optional.The changes to make
tagTypeId
optional represent a breaking change that could affect existing code. While the validation improvements with@IsUUID()
are good, we should verify:
- Existing code handling tag creation/updates
- Impact on related entities
✅ Verification successful
Making
tagTypeId
optional aligns with existing implementationThe change to make
tagTypeId
optional is not a breaking change as:
- The database schema already supports nullable
tagTypeId
withON DELETE SET NULL
- UI components and business logic already handle optional tag types
- Existing tag creation/update operations support tags without types
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for direct usage of tagTypeId rg "tagTypeId" -t ts -A 3 # Search for Tag creation/update operations ast-grep --pattern 'new Tag()' -l ts ast-grep --pattern 'tagRepository.save($_)' -l ts ast-grep --pattern 'tagRepository.update($_)' -l tsLength of output: 17106
View your CI Pipeline Execution ↗ for commit e4d203f.
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
packages/core/src/lib/warehouse/warehouse.controller.ts (1)
78-82
:⚠️ Potential issueFix return type for bulk creation endpoint.
The return type change from
Promise<IPagination<IWarehouseProduct[]>>
toPromise<IPagination<IWarehouseProduct>>
is incorrect because:
- This is a bulk creation endpoint accepting an array input
- The method name suggests multiple products are being added
- Pagination typically returns an array of items
Apply this diff to fix the return type:
- ): Promise<IPagination<IWarehouseProduct>> { + ): Promise<IPagination<IWarehouseProduct[]>> {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/core/src/lib/warehouse/warehouse-product-service.ts
(2 hunks)packages/core/src/lib/warehouse/warehouse.controller.ts
(11 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/core/src/lib/warehouse/warehouse-product-service.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: build
- GitHub Check: test
🔇 Additional comments (5)
packages/core/src/lib/warehouse/warehouse.controller.ts (5)
10-12
: LGTM! Good type standardization.The addition of the
ID
type from@gauzy/contracts
helps standardize identifier types across the codebase.
54-58
: LGTM! Consistent type and route path updates.Good updates to:
- Use the standardized
ID
type- Include leading slash in route path for consistency
105-109
: LGTM! Consistent type and route path updates.Good updates to:
- Use the standardized
ID
type- Include leading slash in route path for consistency
132-135
: LGTM! Consistent type and route path updates.Good updates to:
- Use the standardized
ID
type- Include leading slash in route path for consistency
194-195
: LGTM! Clean error handling.Good simplification of error handling by leveraging NestJS's built-in exception filters and service-layer error handling.
Also applies to: 219-220
PR
Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.
Summary by CodeRabbit
Release Notes
Improvements
Bug Fixes
Refactoring
UpdateTagDTO
class for better clarity.