-
Notifications
You must be signed in to change notification settings - Fork 15
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: send only name and value in check_policies and expenses calls #3459
Conversation
WalkthroughIn a stylish transformation worthy of a blockbuster, the Changes
Suggested Reviewers
Possibly related PRs
Suggested Labels
Poem
Tip 🌐 Web search-backed reviews and chat
✨ 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 (
|
custom_fields: transaction.custom_properties.map((customProperty) => ({ | ||
name: customProperty.name, | ||
value: customProperty.value, | ||
})), |
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.
transformTO method
custom_fields: transaction.custom_properties.map((customProperty: TxnCustomProperties) => ({ | ||
name: customProperty.name, | ||
value: customProperty.value, | ||
})), |
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.
transformTO
method
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
src/app/core/services/platform/v1/spender/expenses.service.ts
(1 hunks)src/app/core/services/policy.service.ts
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build (12.x)
🔇 Additional comments (2)
src/app/core/services/policy.service.ts (2)
17-17
: Mind-blowing import statement, I tell you!The import of TxnCustomProperties model brings type safety to our custom properties mapping. Simply superb!
50-53
: What a style, what a style! Custom properties transformation is now razor-sharp!The transformation now precisely picks only the required name and value fields, making the API payload clean and efficient. This is exactly what we wanted, mind it!
custom_fields: transaction.custom_properties.map((customProperty) => ({ | ||
name: customProperty.name, | ||
value: customProperty.value, | ||
})), |
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.
🧹 Nitpick (assertive)
Listen carefully! The transformation is powerful, but needs a small punch!
While the implementation is spot on, let's add type annotation for better type safety, just like we did in policy.service.ts.
Apply this style enhancement:
- custom_fields: transaction.custom_properties.map((customProperty) => ({
+ custom_fields: transaction.custom_properties.map((customProperty: TxnCustomProperties) => ({
name: customProperty.name,
value: customProperty.value,
})),
Committable suggestion skipped: line range outside the PR's diff.
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
src/app/core/mock-data/platform-policy-expense.data.ts
(0 hunks)src/app/core/services/policy.service.spec.ts
(1 hunks)
💤 Files with no reviewable changes (1)
- src/app/core/mock-data/platform-policy-expense.data.ts
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/core/services/policy.service.spec.ts
[error] 32-33: Don't focus the test.
The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.
(lint/suspicious/noFocusedTests)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: gitStream.cm
- GitHub Check: build (12.x)
@@ -30,7 +30,7 @@ import { fileObject4 } from '../mock-data/file-object.data'; | |||
import { unspecifiedCategory } from '../mock-data/org-category.data'; | |||
import { eCCCData1 } from '../mock-data/corporate-card-expense-unflattened.data'; | |||
|
|||
describe('PolicyService', () => { | |||
fdescribe('PolicyService', () => { |
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.
🧹 Nitpick (assertive)
Remove Focused Test Suite
My friend, fdescribe is like using a superpower meant only for debugging—but in production, even Rajinikanth leaves nothing to chance. Replace fdescribe
with describe
so that all tests run, not just your favorite ones.
- fdescribe('PolicyService', () => {
+ describe('PolicyService', () => {
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
fdescribe('PolicyService', () => { | |
describe('PolicyService', () => { |
🧰 Tools
🪛 Biome (1.9.4)
[error] 32-33: Don't focus the test.
The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.
(lint/suspicious/noFocusedTests)
|
Clickup
https://app.clickup.com/t/86cxv4pb9
Code Coverage
Please add code coverage here
UI Preview
Please add screenshots for UI changes
Summary by CodeRabbit