-
Notifications
You must be signed in to change notification settings - Fork 3.2k
refactor: add BaseTransactionParams. #57635
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
refactor: add BaseTransactionParams. #57635
Conversation
Signed-off-by: krishna2323 <[email protected]>
@paultsimura Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Signed-off-by: krishna2323 <[email protected]>
Signed-off-by: krishna2323 <[email protected]>
src/libs/actions/IOU.ts
Outdated
iouRequestType?: IOURequestType; | ||
taxCode?: string; | ||
taxAmount?: number; | ||
comment: string; |
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.
The BaseTransactionParams
already includes comment: string;
- no need to omit it and add again.
Also, in BaseTransactionParams
, customUnitRateID
is optional. We probably can go without omitting it either. But would like to hear @neil-marcellini's opinion on this.
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.
@neil-marcellini thoughts?
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.
I don't feel too strongly about this, but if customUnitRateID
isn't used then I think it's more clear to omit it to make it clear that the function never needs it.
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.
We should fix this though
The
BaseTransactionParams
already includescomment: string;
- no need to omit it and add again.
src/libs/actions/IOU.ts
Outdated
currency: string; | ||
merchant: string; | ||
billable?: boolean; | ||
type DistanceRequestTransactionParams = Omit<BaseTransactionParams, 'comment'> & { |
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.
type DistanceRequestTransactionParams = Omit<BaseTransactionParams, 'comment'> & { | |
type DistanceRequestTransactionParams = BaseTransactionParams & { |
src/libs/actions/IOU.ts
Outdated
splitShares?: SplitShares; | ||
comment: string; |
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.
comment: string; |
taxCode: string; | ||
taxAmount: number; |
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.
I've checked the call chain - we can make these 2 optional as well (reuse from BaseTransactionParams
) and remove fallback of these 2 fields in all paces where it's called, e.g.:
Lines 4837 to 4838 in 042ec4d
taxCode = '', | |
taxAmount = 0, |
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.
ESLint will throw errors, taxCode
& taxAmount
are required value in many places. e.g.:
App/src/libs/API/parameters/CategorizeTrackedExpenseParams.ts
Lines 3 to 33 in c5bba74
type CategorizeTrackedExpenseParams = { | |
amount: number; | |
currency: string; | |
comment: string; | |
created: string; | |
merchant: string; | |
policyID: string | undefined; | |
transactionID: string | undefined; | |
moneyRequestPreviewReportActionID: string | undefined; | |
moneyRequestReportID: string | undefined; | |
moneyRequestCreatedReportActionID: string | undefined; | |
actionableWhisperReportActionID: string | undefined; | |
modifiedExpenseReportActionID: string; | |
reportPreviewReportActionID: string | undefined; | |
category?: string; | |
tag?: string; | |
receipt?: Receipt; | |
taxCode: string; | |
taxAmount: number; | |
billable?: boolean; | |
waypoints?: string; | |
customUnitRateID?: string; | |
policyExpenseChatReportID?: string; | |
policyExpenseCreatedReportActionID?: string; | |
adminsChatReportID?: string; | |
adminsCreatedReportActionID?: string; | |
guidedSetupData?: string; | |
engagementChoice?: string; | |
}; | |
export default CategorizeTrackedExpenseParams; |
@Krishna2323 please fix the rest of the comments in the mentime. |
Signed-off-by: krishna2323 <[email protected]>
Thanks, reviewing now. @Krishna2323 please fill in the checklist when you have a chance. |
@paultsimura checklist completed. |
Reviewer Checklist
Screenshots/VideosAndroid: Native417694865-532d4c6a-4d52-4dcc-bc8e-f231a1a12f58.webmAndroid: mWeb Chrome417695756-21470f2a-c44b-4988-a107-559558f4d46e.webmiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-03-11.at.12.05.51.movMacOS: DesktopScreen.Recording.2025-03-11.at.12.11.28.mov |
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.
LGTM ✔️
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.
I'd like to see some small changes to ensure it's logically equivalent to what's on main and to remove some redundancies.
}; | ||
|
||
type PerDiemExpenseTransactionParams = { | ||
currency: string; | ||
comment?: string; |
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.
Comment was optional and now it's required. Can we please undo that by omitting it and then adding it as explicitly optional?
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.
updated.
src/libs/actions/IOU.ts
Outdated
iouRequestType?: IOURequestType; | ||
taxCode?: string; | ||
taxAmount?: number; | ||
comment: string; |
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.
We should fix this though
The
BaseTransactionParams
already includescomment: string;
- no need to omit it and add again.
Signed-off-by: krishna2323 <[email protected]>
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.
Cool thanks
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.1.13-0 🚀
|
🚀 Deployed to production by https://github.com/mountiny in version: 9.1.13-5 🚀
|
Explanation of Change
Fixed Issues
$ #57257
PROPOSAL: #57257 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
android_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4