-
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
feat: Move My Expenses to Platform: Moved API Call Of Expenses in My Expenses And Updated Mapping In Expenses Card #2542
Conversation
* fix: Per Diem scan fix and redirection fix for view report * small fix * pr comments
PR title must start with "fix:" or "feat:" or "test:" |
1 similar comment
PR title must start with "fix:" or "feat:" or "test:" |
Please ignore the unit tests, for now, I will fix them in the next PR. As of now only the logic for fetching the expenses and displaying them using the expense cards is updated. The logic for filtering and searching will be moved in the upcoming PRs, and subsequently, the PRs will be shorter since the major portion of the API call is done in this one. |
@@ -90,18 +91,22 @@ export class MyExpensesPage implements OnInit { | |||
|
|||
isConnected$: Observable<boolean>; | |||
|
|||
myExpenses$: Observable<Expense[]>; | |||
myExpenses$: Observable<PlatformExpense[]>; | |||
|
|||
count$: Observable<number>; | |||
|
|||
isInfiniteScrollRequired$: Observable<boolean>; | |||
|
|||
loadData$: BehaviorSubject<Partial<GetExpensesQueryParamsWithFilters>>; |
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.
Will remove this property when working on filtering
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.
Can you check latest master, I have merged a few changes which add the expense models and services, you can use those directly
f593a16
to
979143a
Compare
@@ -79,6 +78,9 @@ import { UniqueCards } from 'src/app/core/models/unique-cards.model'; | |||
import { CategoriesService } from 'src/app/core/services/categories.service'; | |||
import { PlatformCategory } from 'src/app/core/models/platform/platform-category.model'; | |||
import { ReportV1 } from 'src/app/core/models/report-v1.model'; | |||
import { PlatformGetExpenseQueryParam } from 'src/app/core/models/platform/platform-get-expenses-query.model'; | |||
import { ExpensesService } from 'src/app/core/services/platform/v1/spender/expenses.service'; | |||
import { Expense as PlatformExpense } from 'src/app/core/models/platform/v1/expense.model'; |
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.
using an alias right now to avoid errors, will remove it once the entire page is migrated
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.
added comments
export interface ExpenseParams { | ||
split_group_id?: string; | ||
employee_id?: string; | ||
state?: string; | ||
or?: string | string[]; | ||
report_id?: string; | ||
order?: string; | ||
scalar?: boolean; | ||
id?: 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.
@arjunaj5 Is also adding a similar model, can you check with him to avoid conflicts?
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.
Merged latest master and using the pre-existing models and services
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.
Added a comment about this model here.
source_account: { | ||
id: string; | ||
type: AccountType; | ||
}; |
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.
Didn't follow this change
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.
Was trying to fix some type error, no longer required, reverting back.
@@ -79,7 +79,7 @@ | |||
class="expenses-card--receipt-container expenses-card--with-image" | |||
[ngStyle]="{ | |||
'background-image': | |||
expense.tx_dataUrls?.length > 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.
tx_dataUrls was manually added by us I think in the frontend, can we safely replace this with file_ids?
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.
Yes, if I can recall we generated this on our end to get all file URLs for receipts, although this key looks similar, we have to use it for now, until the proper key can be determined
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.
Sure, pls add a TODO to make sure we don't miss this if needed
src/app/shared/components/expenses-card/expenses-card.component.ts
Outdated
Show resolved
Hide resolved
src/app/shared/components/expenses-card/expenses-card.component.ts
Outdated
Show resolved
Hide resolved
…s://app.clickup.com/t/85ztztwg6 (#2539) * fix: Added fix for Item not in list: https://app.clickup.com/t/85ztztwg6 * fix: console.log removed * fix: Hack for diaplay_name field * fix: moved the exception to a seprate function * feat: Added Display Name Additional condition * fix; comment added * feat: added tests * test: UT fix * test: test file formatting * test: text change * feat: added any type in template ref * fix: review based typing * fix: typing added to noop methods * feat: typing fix * feat: comment updated
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.
Some more comments
src/app/core/models/platform/platform-get-expenses-query.model.ts
Outdated
Show resolved
Hide resolved
offset: number; | ||
limit: number; | ||
order: string; | ||
queryParams: ExpenseParams; |
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.
This whole thing can be a model
queryParams: ExpenseParams; | ||
}> | ||
): Observable<PlatformApiResponse<Expense>> { | ||
return from(this.authServie.getEou()).pipe( |
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.
authService
src/app/shared/components/expenses-card/expenses-card.component.ts
Outdated
Show resolved
Hide resolved
src/app/shared/components/expenses-card/expenses-card.component.ts
Outdated
Show resolved
Hide resolved
src/app/shared/components/expenses-card/expenses-card.component.ts
Outdated
Show resolved
Hide resolved
@@ -19,4 +21,35 @@ export class ExpensesService { | |||
|
|||
return this.spenderService.get<PlatformApiResponse<Expense>>('/expenses', data).pipe(map((res) => res.data[0])); | |||
} | |||
|
|||
getExpenses( |
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.
Will these methods be not used by the approver persona? (team pages)
You can add them under approver/expenses.service.ts
too if needed
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.
Will add them later
params: { | ||
offset: config.offset, | ||
limit: config.limit, | ||
employee_id: `eq.${eou.ou.id}`, |
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.
Is this needed? In platform the spender API will by default return the user's expenses only
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.
Merged master and a lot of changes I added were already done by others, so I removed my methods and used the services and models already on master.
export interface ExpenseParams { | ||
split_group_id?: string; | ||
employee_id?: string; | ||
state?: string; | ||
or?: string | string[]; | ||
report_id?: string; | ||
order?: string; | ||
scalar?: boolean; | ||
id?: 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.
Added a comment about this model here.
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.
2 reviewed have checked, will skip
#2546) * fixed expense navigation and search * reverted dates on pending transaction list * feat: Move My Expenses to Platform: Fixing Select Functionality and Create Report From List (#2557) * fixed select expense and add to report * fixed select all * changed create-report card * removed commented code * resolved comments * feat: Move My Expenses to Platform: Fixing Filters and Sorting (#2562) * fixed filters and sorting * resolved comments * feat: Move My Expenses to Platform: Fixed Delete and Card Filters (#2569) * fixed delete and card sorting * resolved comments * feat: Move My Expenses to Platform: Fixing Filters on Refresh and Broken Filters (#2570) * fixing filter refresh and broken filters * resolved comments * fixed typo * feat: Move My Expenses to Platform: Fixed Stats (#2571) * fixed stats * added cloneDeep * resolved comments * feat: Fixing Merge and Search Refresh on Platform My Expenses (#2581) * fixing merge -1 * fixed search params * fixed extra card on empty search and cancel search * fixed merge expense bug * fixed create report from my expenses * resolved comments * test: Move My Expenses To My Platform: Fixing Types and Errors (#2586) * fixed all types issues and errors * resovled comments * test: Move My Expenses To Platform: Fixing tests on Merge Expenses and Create New Report Component (#2587) * fixed test for merge expense and create report modal * fixed ionviewwillenter test in merge * resolved comments * test: Move My Expenses to Platform: Fixing tests on My Expenses Service (#2588) * fixed my expenses service * resolved comments * test: Move My Expenses To Platform: Fixing Test on My Expenses Part 1 (#2590) * fixed my expenses * removed fdescribe * test: Move My Expenses to Platform: Fixing Test on My Expenses Part 2 (#2596) * fixed tests for other methods * resolved comments * test: Move My Expenses to Platform: Fixed IonViewWillEnter tests (#2597) * fixed all tests * feat: Move My Expenses to Platform: Fixing Review Expenses (#2598) * fixed review expenses * test: Move My Expenses to Platform: Fixing OpenReviewExpenses Tests (#2599) * fixing openreviewexpenses tests * resovled comments * test: Move My Expenses to Platform: Fixed All Tests (#2601) * fixed all tests * removed optional chaining * resolved comments * fixed broken test * fixing failing test -1 * fixing test -3 * added data * feat: Move My Expenses to Platform: Added Public My Expenses And Renamed Platform to V2 (#2602) * added public my-expenses page * removed unrequired files * updated imports * feat: Move My Expenses to Platform: Fixed Card Filter Param (#2603) * fixed card params * feat: Move My Expenses To Platform: Added Route Guard for redirection And Updated Model (#2607) * added guard and updated model * added test and resolved comments --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]> --------- Co-authored-by: Jay Budhadev <[email protected]>
|
Description
🤖 Generated by Copilot at be953d5
This pull request migrates the app from using the old expense model to the new platform expense model. It updates the transaction service, the my expenses page, and the expenses card component to use the new model and api service. It also adds new models and interfaces for platform expenses, categories and cost centers.
🤖 Generated by Copilot at be953d5
Walkthrough
🤖 Generated by Copilot at be953d5
Clickup
https://app.clickup.com/t/86ctv3kk4
Code Coverage
Please add code coverage here
UI Preview
Please add screenshots for UI changes