From 4add7d6a798bccaf21725f07d37bebc0f3e02e2f Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 30 Apr 2024 14:16:51 +0530 Subject: [PATCH 01/14] Minor --- src/app/core/mock-data/report-stats.data.ts | 13 +- src/app/core/mock-data/task.data.ts | 10 +- src/app/core/services/tasks.service.spec.ts | 128 ++++++++++---------- src/app/core/services/tasks.service.ts | 2 +- 4 files changed, 81 insertions(+), 72 deletions(-) diff --git a/src/app/core/mock-data/report-stats.data.ts b/src/app/core/mock-data/report-stats.data.ts index 89d6ade35a..d3bea2d3ef 100644 --- a/src/app/core/mock-data/report-stats.data.ts +++ b/src/app/core/mock-data/report-stats.data.ts @@ -1,3 +1,4 @@ +import { ReportsStatsResponsePlatform } from '../models/platform/v1/report-stats-response.model'; import { ReportStats } from '../models/report-stats.model'; export const expectedReportStats: ReportStats = { @@ -11,7 +12,7 @@ export const expectedReportStats: ReportStats = { total_amount: 93165.91, }, report: { - count: 45, + count: 2, total_amount: 5177243929.65219, failed_amount: null, failed_count: null, @@ -95,3 +96,13 @@ export const expectedEmptyReportStats: ReportStats = { reimbursable_amount: null, }, }; + +export const expectedSentBackResponse: ReportsStatsResponsePlatform = { + total_amount: 4500, + count: 2, + failed_amount: null, + failed_count: null, + processing_amount: null, + processing_count: null, + reimbursable_amount: null, +}; diff --git a/src/app/core/mock-data/task.data.ts b/src/app/core/mock-data/task.data.ts index b438cb0595..787c701686 100644 --- a/src/app/core/mock-data/task.data.ts +++ b/src/app/core/mock-data/task.data.ts @@ -58,14 +58,14 @@ export const teamReportTaskSample = { }; export const sentBackReportTaskSample = { - amount: '44.53', - count: 1, - header: 'Report sent back!', - subheader: '1 report worth ₹44.53 was sent back by your approver', + amount: '4.5K', + count: 2, + header: 'Reports sent back!', + subheader: '2 reports worth ₹4.5K were sent back by your approver', icon: TaskIcon.REPORT, ctas: [ { - content: 'View Report', + content: 'View Reports', event: TASKEVENT.openSentBackReport, }, ], diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index c70a5c95e6..124415e0f1 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -55,6 +55,10 @@ import { commuteDetailsResponseData3, } from '../mock-data/commute-details-response.data'; import { orgSettingsPendingRestrictions } from '../mock-data/org-settings.data'; +import { SpenderReportsService } from './platform/v1/spender/reports.service'; +import { ApproverReportsService } from './platform/v1/approver/reports.service'; +import { ReportsStatsResponsePlatform } from '../models/platform/v1/report-stats-response.model'; +import { expectedReportStats, expectedSentBackResponse } from '../mock-data/report-stats.data'; describe('TasksService', () => { let tasksService: TasksService; @@ -67,6 +71,8 @@ describe('TasksService', () => { let humanizeCurrencyPipe: jasmine.SpyObj; let expensesService: jasmine.SpyObj; let employeesService: jasmine.SpyObj; + let spenderReportsService: jasmine.SpyObj; + let approverReportsService: jasmine.SpyObj; let orgSettingsService: jasmine.SpyObj; const mockTaskClearSubject = new Subject(); const homeCurrency = 'INR'; @@ -88,6 +94,8 @@ describe('TasksService', () => { const humanizeCurrencyPipeSpy = jasmine.createSpyObj('HumanizeCurrencyPipe', ['transform']); const orgSettingsServiceSpy = jasmine.createSpyObj('OrgSettingsService', ['get']); const employeesServiceSpy = jasmine.createSpyObj('EmployeesService', ['getCommuteDetails']); + const spenderReportsServiceSpy = jasmine.createSpyObj('SpenderReportsService', ['getReportsStats']); + const approverReportsServiceSpy = jasmine.createSpyObj('ApproverReportsService', ['getReportsStats']); TestBed.configureTestingModule({ providers: [ @@ -132,6 +140,14 @@ describe('TasksService', () => { provide: OrgSettingsService, useValue: orgSettingsServiceSpy, }, + { + provide: SpenderReportsService, + useValue: spenderReportsServiceSpy, + }, + { + provide: ApproverReportsService, + useValue: approverReportsServiceSpy, + }, ], }); tasksService = TestBed.inject(TasksService); @@ -148,6 +164,8 @@ describe('TasksService', () => { expensesService = TestBed.inject(ExpensesService) as jasmine.SpyObj; employeesService = TestBed.inject(EmployeesService) as jasmine.SpyObj; orgSettingsService = TestBed.inject(OrgSettingsService) as jasmine.SpyObj; + spenderReportsService = TestBed.inject(SpenderReportsService) as jasmine.SpyObj; + approverReportsService = TestBed.inject(ApproverReportsService) as jasmine.SpyObj; orgSettingsService.get.and.returnValue(of(orgSettingsPendingRestrictions)); }); @@ -172,13 +190,11 @@ describe('TasksService', () => { }); function setupUnsibmittedReportsResponse() { - reportService.getReportStatsData + spenderReportsService.getReportsStats .withArgs({ - scalar: true, - aggregates: 'count(rp_id),sum(rp_amount)', - rp_state: 'in.(DRAFT)', + state: 'eq.DRAFT', }) - .and.returnValue(of(unsubmittedReportsResponse)); + .and.returnValue(of(expectedReportStats.draft)); } it('should be able to fetch unsubmitted reports', (done) => { @@ -228,22 +244,20 @@ describe('TasksService', () => { }); it('should be able to fetch Sent Back Report Tasks', (done) => { - reportService.getReportStatsData + spenderReportsService.getReportsStats .withArgs({ - scalar: true, - aggregates: 'count(rp_id),sum(rp_amount)', - rp_state: 'in.(APPROVER_INQUIRY)', + state: 'eq.APPROVER_INQUIRY', }) - .and.returnValue(of(sentBackResponse)); + .and.returnValue(of(expectedSentBackResponse)); currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); humanizeCurrencyPipe.transform - .withArgs(sentBackResponse[0].aggregates[1].function_value, homeCurrency, true) - .and.returnValue('44.53'); + .withArgs(expectedSentBackResponse.total_amount, homeCurrency, true) + .and.returnValue('4.5K'); humanizeCurrencyPipe.transform - .withArgs(sentBackResponse[0].aggregates[1].function_value, homeCurrency) - .and.returnValue('₹44.53'); + .withArgs(expectedSentBackResponse.total_amount, homeCurrency) + .and.returnValue('₹4.5K'); tasksService.getSentBackReportTasks().subscribe((sentBackReportsTasks) => { expect(sentBackReportsTasks).toEqual([sentBackReportTaskSample]); @@ -256,25 +270,18 @@ describe('TasksService', () => { currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); humanizeCurrencyPipe.transform - .withArgs(teamReportResponse[0].aggregates[1].function_value, homeCurrency, true) + .withArgs(expectedReportStats.report.total_amount, homeCurrency, true) .and.returnValue('733.48K'); humanizeCurrencyPipe.transform - .withArgs(teamReportResponse[0].aggregates[1].function_value, homeCurrency) + .withArgs(expectedReportStats.report.total_amount, homeCurrency) .and.returnValue('₹733.48K'); - reportService.getReportStatsData - .withArgs( - { - approved_by: 'cs.{' + extendedOrgUserResponse.ou.id + '}', - rp_approval_state: ['in.(APPROVAL_PENDING)'], - rp_state: ['in.(APPROVER_PENDING)'], - sequential_approval_turn: ['in.(true)'], - aggregates: 'count(rp_id),sum(rp_amount)', - scalar: true, - }, - false - ) - .and.returnValue(of(teamReportResponse)); + approverReportsService.getReportsStats + .withArgs({ + next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]]`, + state: 'eq.APPROVER_PENDING', + }) + .and.returnValue(of(expectedReportStats.report)); tasksService.getTeamReportsTasks().subscribe((teamReportsTasks) => { expect(teamReportsTasks).toEqual([teamReportTaskSample]); @@ -615,9 +622,9 @@ describe('TasksService', () => { const tasks2 = tasksService.mapAggregateToTeamReportTask( { - totalAmount: 0, - totalCount: 0, - }, + total_amount: 0, + count: 0, + } as ReportsStatsResponsePlatform, homeCurrency ); @@ -625,9 +632,9 @@ describe('TasksService', () => { const tasks3 = tasksService.mapAggregateToUnsubmittedReportTask( { - totalAmount: 0, - totalCount: 0, - }, + total_amount: 0, + count: 0, + } as ReportsStatsResponsePlatform, homeCurrency ); @@ -645,9 +652,9 @@ describe('TasksService', () => { const tasks5 = tasksService.mapSentBackReportsToTasks( { - totalAmount: 0, - totalCount: 0, - }, + total_amount: 0, + count: 0, + } as ReportsStatsResponsePlatform, homeCurrency ); @@ -692,28 +699,19 @@ describe('TasksService', () => { advanceRequestService.getAdvanceRequestStats.and.returnValue(of(sentBackAdvancesResponse)); setupUnsibmittedReportsResponse(); getUnreportedExpenses(); - reportService.getReportStatsData + spenderReportsService.getReportsStats .withArgs({ - scalar: true, - aggregates: 'count(rp_id),sum(rp_amount)', - rp_state: 'in.(APPROVER_INQUIRY)', + state: 'eq.APPROVER_INQUIRY', }) - .and.returnValue(of(sentBackResponse)); + .and.returnValue(of(expectedSentBackResponse)); authService.getEou.and.returnValue(new Promise((resolve) => resolve(extendedOrgUserResponse))); currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); - reportService.getReportStatsData - .withArgs( - { - approved_by: 'cs.{' + extendedOrgUserResponse.ou.id + '}', - rp_approval_state: ['in.(APPROVAL_PENDING)'], - rp_state: ['in.(APPROVER_PENDING)'], - sequential_approval_turn: ['in.(true)'], - aggregates: 'count(rp_id),sum(rp_amount)', - scalar: true, - }, - false - ) - .and.returnValue(of(teamReportResponse)); + spenderReportsService.getReportsStats + .withArgs({ + next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]]`, + state: 'eq.APPROVER_PENDING', + }) + .and.returnValue(of(expectedReportStats.report)); expensesService.getDuplicateSets.and.returnValue(of(expenseDuplicateSets)); expensesService.getExpenseStats .withArgs({ @@ -851,9 +849,9 @@ describe('TasksService', () => { const sentBackReportTask = tasksService.mapSentBackReportsToTasks( { - totalCount: 2, - totalAmount: sentBackResponse[0].aggregates[1].function_value, - }, + count: 2, + total_amount: sentBackResponse[0].aggregates[1].function_value, + } as ReportsStatsResponsePlatform, homeCurrency ); @@ -914,9 +912,9 @@ describe('TasksService', () => { const tasks = tasksService.mapAggregateToUnsubmittedReportTask( { - totalAmount: unsubmittedReportsResponse[0].aggregates[1].function_value, - totalCount: 1, - }, + total_amount: unsubmittedReportsResponse[0].aggregates[1].function_value, + count: 1, + } as ReportsStatsResponsePlatform, homeCurrency ); @@ -947,9 +945,9 @@ describe('TasksService', () => { const tasks = tasksService.mapAggregateToTeamReportTask( { - totalAmount: teamReportResponse[0].aggregates[1].function_value, - totalCount: 1, - }, + total_amount: teamReportResponse[0].aggregates[1].function_value, + count: 1, + } as ReportsStatsResponsePlatform, homeCurrency ); diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index 3d9f9b04d3..bbaaced465 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -660,7 +660,7 @@ export class TasksService { return [ { amount: this.humanizeCurrency.transform(aggregate.total_amount, homeCurrency, true), - count: aggregate.total_amount, + count: aggregate.count, header: `Report${aggregate.count === 1 ? '' : 's'} sent back!`, subheader: `${aggregate.count} report${aggregate.count === 1 ? '' : 's'}${this.getAmountString( aggregate.total_amount, From c22b2abea2f20731d5b70bdc8b9d8270c367033b Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 30 Apr 2024 17:03:54 +0530 Subject: [PATCH 02/14] Minor --- src/app/core/mock-data/report-stats.data.ts | 4 +-- src/app/core/mock-data/task.data.ts | 4 +-- src/app/core/services/tasks.service.spec.ts | 39 ++++++++++----------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/app/core/mock-data/report-stats.data.ts b/src/app/core/mock-data/report-stats.data.ts index d3bea2d3ef..babbb849e1 100644 --- a/src/app/core/mock-data/report-stats.data.ts +++ b/src/app/core/mock-data/report-stats.data.ts @@ -3,13 +3,13 @@ import { ReportStats } from '../models/report-stats.model'; export const expectedReportStats: ReportStats = { draft: { - count: 6, + count: 2, + total_amount: 93165.91, failed_amount: null, failed_count: null, processing_amount: null, processing_count: null, reimbursable_amount: null, - total_amount: 93165.91, }, report: { count: 2, diff --git a/src/app/core/mock-data/task.data.ts b/src/app/core/mock-data/task.data.ts index 787c701686..f15d7f2cdc 100644 --- a/src/app/core/mock-data/task.data.ts +++ b/src/app/core/mock-data/task.data.ts @@ -100,10 +100,10 @@ export const unreportedExpenseTaskSample2 = { }; export const unsubmittedReportTaskSample = { - amount: '0.00', + amount: '93.17K', count: 2, header: 'Unsubmitted reports', - subheader: '2 reports remain in draft state', + subheader: '2 reports worth ₹93.17K remain in draft state', icon: TaskIcon.REPORT, ctas: [ { diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 124415e0f1..758af67bba 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -58,7 +58,11 @@ import { orgSettingsPendingRestrictions } from '../mock-data/org-settings.data'; import { SpenderReportsService } from './platform/v1/spender/reports.service'; import { ApproverReportsService } from './platform/v1/approver/reports.service'; import { ReportsStatsResponsePlatform } from '../models/platform/v1/report-stats-response.model'; -import { expectedReportStats, expectedSentBackResponse } from '../mock-data/report-stats.data'; +import { + expectedEmptyReportStats, + expectedReportStats, + expectedSentBackResponse, +} from '../mock-data/report-stats.data'; describe('TasksService', () => { let tasksService: TasksService; @@ -80,7 +84,6 @@ describe('TasksService', () => { beforeEach(() => { const reportServiceSpy = jasmine.createSpyObj('ReportService', [ 'getReportAutoSubmissionDetails', - 'getReportStatsData', 'getAllExtendedReports', ]); const expensesServiceSpy = jasmine.createSpyObj('ExpensesService', ['getExpenseStats', 'getDuplicateSets']); @@ -189,20 +192,16 @@ describe('TasksService', () => { }); }); - function setupUnsibmittedReportsResponse() { - spenderReportsService.getReportsStats - .withArgs({ - state: 'eq.DRAFT', - }) - .and.returnValue(of(expectedReportStats.draft)); - } - it('should be able to fetch unsubmitted reports', (done) => { - setupUnsibmittedReportsResponse(); + spenderReportsService.getReportsStats.and.returnValue(of(expectedReportStats.draft)); currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); humanizeCurrencyPipe.transform - .withArgs(unsubmittedReportsResponse[0].aggregates[1].function_value, homeCurrency, true) - .and.returnValue('0.00'); + .withArgs(expectedReportStats.draft.total_amount, homeCurrency, true) + .and.returnValue('93.17K'); + humanizeCurrencyPipe.transform + .withArgs(expectedReportStats.draft.total_amount, homeCurrency) + .and.returnValue('₹93.17K'); + humanizeCurrencyPipe.transform.and.returnValue('93.1K'); tasksService.getUnsubmittedReportsTasks().subscribe((unsubmittedReportsTasks) => { expect(unsubmittedReportsTasks).toEqual([unsubmittedReportTaskSample]); done(); @@ -278,7 +277,7 @@ describe('TasksService', () => { approverReportsService.getReportsStats .withArgs({ - next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]]`, + next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]`, state: 'eq.APPROVER_PENDING', }) .and.returnValue(of(expectedReportStats.report)); @@ -697,7 +696,7 @@ describe('TasksService', () => { function setupData() { currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); advanceRequestService.getAdvanceRequestStats.and.returnValue(of(sentBackAdvancesResponse)); - setupUnsibmittedReportsResponse(); + spenderReportsService.getReportsStats.and.returnValue(of(expectedReportStats.draft)); getUnreportedExpenses(); spenderReportsService.getReportsStats .withArgs({ @@ -706,9 +705,9 @@ describe('TasksService', () => { .and.returnValue(of(expectedSentBackResponse)); authService.getEou.and.returnValue(new Promise((resolve) => resolve(extendedOrgUserResponse))); currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); - spenderReportsService.getReportsStats + approverReportsService.getReportsStats .withArgs({ - next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]]`, + next_approver_user_ids: `cs.[${extendedOrgUserResponse.us.id}]`, state: 'eq.APPROVER_PENDING', }) .and.returnValue(of(expectedReportStats.report)); @@ -730,7 +729,7 @@ describe('TasksService', () => { tasksService.getTasks().subscribe((tasks) => { expect(tasks.map((task) => task.header)).toEqual([ '34 Potential Duplicates', - 'Report sent back!', + 'Reports sent back!', 'Incomplete expenses', 'Unsubmitted reports', 'Expenses are ready to report', @@ -764,7 +763,7 @@ describe('TasksService', () => { tasksService.getTasks(true).subscribe((tasks) => { expect(tasks.map((task) => task.header)).toEqual([ '34 Potential Duplicates', - 'Report sent back!', + 'Reports sent back!', 'Incomplete expenses', 'Reports to be approved', 'Advances sent back!', @@ -905,7 +904,7 @@ describe('TasksService', () => { ]); }); - it('should generate proper content in all cases of unsibmitted report tasks', () => { + it('should generate proper content in all cases of unsubmitted report tasks', () => { humanizeCurrencyPipe.transform .withArgs(unsubmittedReportsResponse[0].aggregates[1].function_value, homeCurrency, true) .and.returnValue('0.00'); From c66e7e35531b054ae6e029e70f416f9683f91c79 Mon Sep 17 00:00:00 2001 From: aastha Date: Mon, 6 May 2024 17:05:25 +0530 Subject: [PATCH 03/14] Minor --- .../platform/v1/approver/reports.service.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/core/services/platform/v1/approver/reports.service.spec.ts b/src/app/core/services/platform/v1/approver/reports.service.spec.ts index 2902ee0623..cbe117dd25 100644 --- a/src/app/core/services/platform/v1/approver/reports.service.spec.ts +++ b/src/app/core/services/platform/v1/approver/reports.service.spec.ts @@ -58,6 +58,17 @@ describe('ApproverReportsService', () => { }); }); + it('generateStatsQueryParams(): should generate stats query params', () => { + const queryParams = { + state: 'in.(COMPLETE)', + report_id: 'is.null', + or: '(policy_amount.is.null,policy_amount.gt.0.0001)', + }; + + const result = approverReportsService.generateStatsQueryParams(queryParams); + expect(result).toEqual('state=in.(COMPLETE)&report_id=is.null&or=(policy_amount.is.null,policy_amount.gt.0.0001)'); + }); + it('getReportsCount(): should get a count of reports', (done) => { // Mock the response of getReportsByParams spyOn(approverReportsService, 'getReportsByParams').and.returnValue(of(platformReportCountData)); From a0063a22979b982ffbd771faa21d9b708ce4d955 Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Tue, 7 May 2024 05:10:53 +0530 Subject: [PATCH 04/14] Update reports.service.spec.ts --- .../services/platform/v1/approver/reports.service.spec.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/core/services/platform/v1/approver/reports.service.spec.ts b/src/app/core/services/platform/v1/approver/reports.service.spec.ts index cbe117dd25..2a159d0c32 100644 --- a/src/app/core/services/platform/v1/approver/reports.service.spec.ts +++ b/src/app/core/services/platform/v1/approver/reports.service.spec.ts @@ -60,13 +60,11 @@ describe('ApproverReportsService', () => { it('generateStatsQueryParams(): should generate stats query params', () => { const queryParams = { - state: 'in.(COMPLETE)', - report_id: 'is.null', - or: '(policy_amount.is.null,policy_amount.gt.0.0001)', + state: 'eq.DRAFT', }; const result = approverReportsService.generateStatsQueryParams(queryParams); - expect(result).toEqual('state=in.(COMPLETE)&report_id=is.null&or=(policy_amount.is.null,policy_amount.gt.0.0001)'); + expect(result).toEqual('state=eq.DRAFT'); }); it('getReportsCount(): should get a count of reports', (done) => { From 6b54ffe304699f05828a0faa12afa0f47c7c5453 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 7 May 2024 05:28:17 +0530 Subject: [PATCH 05/14] Minor --- src/app/core/mock-data/report-stats.data.ts | 10 ++++++++ src/app/core/mock-data/task.data.ts | 14 +++++++++++ .../platform/v1/approver/reports.service.ts | 2 +- .../platform/v1/spender/reports.service.ts | 2 +- src/app/core/services/tasks.service.spec.ts | 24 +++++++++++++++++++ 5 files changed, 50 insertions(+), 2 deletions(-) diff --git a/src/app/core/mock-data/report-stats.data.ts b/src/app/core/mock-data/report-stats.data.ts index babbb849e1..6d53b2454a 100644 --- a/src/app/core/mock-data/report-stats.data.ts +++ b/src/app/core/mock-data/report-stats.data.ts @@ -106,3 +106,13 @@ export const expectedSentBackResponse: ReportsStatsResponsePlatform = { processing_count: null, reimbursable_amount: null, }; + +export const expectedSentBackResponseSingularReport: ReportsStatsResponsePlatform = { + total_amount: 4500, + count: 1, + failed_amount: null, + failed_count: null, + processing_amount: null, + processing_count: null, + reimbursable_amount: null, +}; diff --git a/src/app/core/mock-data/task.data.ts b/src/app/core/mock-data/task.data.ts index f15d7f2cdc..d4b62d369f 100644 --- a/src/app/core/mock-data/task.data.ts +++ b/src/app/core/mock-data/task.data.ts @@ -71,6 +71,20 @@ export const sentBackReportTaskSample = { ], }; +export const sentBackReportTaskSingularSample = { + amount: '4.5K', + count: 1, + header: 'Report sent back!', + subheader: '1 report worth ₹4.5K was sent back by your approver', + icon: TaskIcon.REPORT, + ctas: [ + { + content: 'View Report', + event: TASKEVENT.openSentBackReport, + }, + ], +}; + export const unreportedExpenseTaskSample = { amount: '142.26K', count: 13, diff --git a/src/app/core/services/platform/v1/approver/reports.service.ts b/src/app/core/services/platform/v1/approver/reports.service.ts index 262aac223f..73a934f2b0 100644 --- a/src/app/core/services/platform/v1/approver/reports.service.ts +++ b/src/app/core/services/platform/v1/approver/reports.service.ts @@ -44,7 +44,7 @@ export class ApproverReportsService { return this.getReportsByParams(params).pipe(map((res) => res.count)); } - getReportsByParams(queryParams: ReportsQueryParams = {}): Observable> { + getReportsByParams(queryParams: ReportsQueryParams): Observable> { const config = { params: { ...queryParams, diff --git a/src/app/core/services/platform/v1/spender/reports.service.ts b/src/app/core/services/platform/v1/spender/reports.service.ts index 3ae08c3169..9bd5a2ca42 100644 --- a/src/app/core/services/platform/v1/spender/reports.service.ts +++ b/src/app/core/services/platform/v1/spender/reports.service.ts @@ -49,7 +49,7 @@ export class SpenderReportsService { return this.getReportsByParams(params).pipe(map((res) => res.count)); } - getReportsByParams(queryParams: ReportsQueryParams = {}): Observable> { + getReportsByParams(queryParams: ReportsQueryParams): Observable> { const config = { params: { ...queryParams, diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 758af67bba..7dbbf2e5f7 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -36,6 +36,7 @@ import { draftExpenseTaskSample2, unreportedExpenseTaskSample2, commuteDeductionTask, + sentBackReportTaskSingularSample, } from '../mock-data/task.data'; import { mastercardRTFCard } from '../mock-data/platform-corporate-card.data'; import { OrgSettingsService } from './org-settings.service'; @@ -62,6 +63,7 @@ import { expectedEmptyReportStats, expectedReportStats, expectedSentBackResponse, + expectedSentBackResponseSingularReport, } from '../mock-data/report-stats.data'; describe('TasksService', () => { @@ -264,6 +266,28 @@ describe('TasksService', () => { }); }); + it('should show proper content for singular sent back report', (done) => { + spenderReportsService.getReportsStats + .withArgs({ + state: 'eq.APPROVER_INQUIRY', + }) + .and.returnValue(of(expectedSentBackResponseSingularReport)); + + currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); + + humanizeCurrencyPipe.transform + .withArgs(expectedSentBackResponse.total_amount, homeCurrency, true) + .and.returnValue('4.5K'); + humanizeCurrencyPipe.transform + .withArgs(expectedSentBackResponse.total_amount, homeCurrency) + .and.returnValue('₹4.5K'); + + tasksService.getSentBackReportTasks().subscribe((sentBackReportsTasks) => { + expect(sentBackReportsTasks).toEqual([sentBackReportTaskSingularSample]); + done(); + }); + }); + it('should be able to fetch team reports tasks', (done) => { authService.getEou.and.returnValue(new Promise((resolve) => resolve(extendedOrgUserResponse))); currencyService.getHomeCurrency.and.returnValue(of(homeCurrency)); From fc066ab49258a7993da23f2768d62f56ccc1cf78 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 7 May 2024 21:17:23 +0530 Subject: [PATCH 06/14] Minor --- .../services/platform/v1/approver/reports.service.spec.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/app/core/services/platform/v1/approver/reports.service.spec.ts b/src/app/core/services/platform/v1/approver/reports.service.spec.ts index b722c63767..f4d992fbdb 100644 --- a/src/app/core/services/platform/v1/approver/reports.service.spec.ts +++ b/src/app/core/services/platform/v1/approver/reports.service.spec.ts @@ -15,6 +15,7 @@ import { import { ReportsQueryParams } from 'src/app/core/models/platform/v1/reports-query-params.model'; import { StatsResponse } from 'src/app/core/models/platform/v1/stats-response.model'; import { expectedReportStats } from 'src/app/core/mock-data/report-stats.data'; +import { ReportState } from '../../../../models/platform/v1/report.model'; describe('ApproverReportsService', () => { let approverReportsService: ApproverReportsService; @@ -167,14 +168,10 @@ describe('ApproverReportsService', () => { }); it('getReportsStats(): should get advance request stats', (done) => { - const statsResponse: StatsResponse = { - count: 2, - total_amount: 1200, - }; approverPlatformApiService.post.and.returnValue(of({ data: expectedReportStats.draft })); const params = { - state: 'eq.DRAFT', + state: `eq.${ReportState.DRAFT}`, }; approverReportsService.getReportsStats(params).subscribe((res) => { From 5a4de320087372e80bf8264aad8e7ee8776a0487 Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 7 May 2024 21:32:05 +0530 Subject: [PATCH 07/14] Minor --- src/app/core/models/approver.model.ts | 4 +-- src/app/core/models/custom_field.model.ts | 2 +- src/app/core/models/org-user.model.ts | 28 +++++++++---------- src/app/core/services/tasks.service.spec.ts | 20 ++++++------- .../core/test-data/tasks.service.spec.data.ts | 7 +++-- 5 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/app/core/models/approver.model.ts b/src/app/core/models/approver.model.ts index 8fca398da9..7acf529902 100644 --- a/src/app/core/models/approver.model.ts +++ b/src/app/core/models/approver.model.ts @@ -1,6 +1,6 @@ export interface Approver { - full_name: string; - email: string; + full_name: string | null; + email: string | null; } export interface AdvanceApprover { added_by: string; diff --git a/src/app/core/models/custom_field.model.ts b/src/app/core/models/custom_field.model.ts index 9b32cc5545..f1616a6255 100644 --- a/src/app/core/models/custom_field.model.ts +++ b/src/app/core/models/custom_field.model.ts @@ -3,7 +3,7 @@ import { AbstractControl } from '@angular/forms'; export interface CustomField { id?: number; name: string; - value: string | boolean | number | Date | string[] | { display: string }; + value: string | boolean | number | Date | string[] | { display: string } | null; type?: string; displayValue?: string | boolean | number | Date | string[] | { display: string }; mandatory?: boolean; diff --git a/src/app/core/models/org-user.model.ts b/src/app/core/models/org-user.model.ts index c79b311883..6328988531 100644 --- a/src/app/core/models/org-user.model.ts +++ b/src/app/core/models/org-user.model.ts @@ -7,20 +7,20 @@ export interface OrgUser { user_id?: string; employee_id?: number | string; location: string; - level?: number | string; + level?: number | string | null; level_id?: string; - band?: string; - business_unit?: string; - department_id?: string; - department?: string; - sub_department?: string; + band?: string | null; + business_unit?: string | null; + department_id?: string | null; + department?: string | null; + sub_department?: string | null; roles?: string[]; approver1_id?: string; - approver2_id?: string; - approver3_id?: string; - delegatee_id?: string; - delegation_start_at?: Date; - delegation_end_at?: Date; + approver2_id?: string | null; + approver3_id?: string | null; + delegatee_id?: string | null; + delegation_start_at?: Date | null; + delegation_end_at?: Date | null; title?: string; status: string; branch_ifsc?: string; @@ -29,8 +29,8 @@ export interface OrgUser { mobile_verified?: boolean; mobile_verified_at?: Date; is_primary?: boolean; - owner?: boolean; - joining_dt?: Date; + owner?: boolean | null; + joining_dt?: Date | null; special_email?: string; custom_field_values?: CustomField[]; org_name: string; @@ -38,7 +38,7 @@ export interface OrgUser { default_cost_center_id?: number; default_cost_center_name?: string; default_cost_center_code?: string; - rank?: number; + rank?: number | null; cost_center_ids?: number[]; mobile_verification_attempts_left?: number; } diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 12584e2779..eadbbb9df7 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -229,7 +229,7 @@ describe('TasksService', () => { }) .and.returnValue(of(completeStats)); - reportService.getAllExtendedReports.and.returnValue(of(allExtendedReportsResponse)); + spenderReportsService.getAllReportsByParams.and.returnValue(of(allExtendedReportsResponse)); } it('should be able to fetch unreported expenses tasks', () => { @@ -1029,7 +1029,7 @@ describe('TasksService', () => { describe('getMobileNumberVerificationTasks(): ', () => { it('should not return any task if user has verified mobile number', (done) => { - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard])); const mapMobileNumberVerificationTaskSpy = spyOn(tasksService, 'mapMobileNumberVerificationTask'); tasksService.getMobileNumberVerificationTasks().subscribe((res) => { @@ -1044,7 +1044,7 @@ describe('TasksService', () => { it('should not return any task if user has not enrolled for RTF', (done) => { const eou = cloneDeep(extendedOrgUserResponse); eou.ou.mobile_verified = false; - authService.getEou.and.returnValue(Promise.resolve(eou)); + authService.getEou.and.resolveTo(eou); corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([])); const mapMobileNumberVerificationTaskSpy = spyOn(tasksService, 'mapMobileNumberVerificationTask'); tasksService.getMobileNumberVerificationTasks().subscribe((res) => { @@ -1060,7 +1060,7 @@ describe('TasksService', () => { const eou = cloneDeep(extendedOrgUserResponse); eou.ou.mobile_verified = false; eou.ou.mobile = null; - authService.getEou.and.returnValue(Promise.resolve(eou)); + authService.getEou.and.resolveTo(eou); corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard])); const mapMobileNumberVerificationTaskSpy = spyOn(tasksService, 'mapMobileNumberVerificationTask').and.returnValue( [addMobileNumberTask] @@ -1076,7 +1076,7 @@ describe('TasksService', () => { it('should return verify number task if user has verified mobile number', (done) => { const eou = cloneDeep(extendedOrgUserResponse); eou.ou.mobile_verified = false; - authService.getEou.and.returnValue(Promise.resolve(eou)); + authService.getEou.and.resolveTo(eou); corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard])); const mapMobileNumberVerificationTaskSpy = spyOn(tasksService, 'mapMobileNumberVerificationTask').and.returnValue( [addMobileNumberTask] @@ -1093,7 +1093,7 @@ describe('TasksService', () => { describe('getCommuteDetailsTasks():', () => { it('should return commute details task if commute details response data is not defined', (done) => { employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData2)); - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); orgSettingsService.get.and.returnValue(of(orgSettingsWithCommuteDeductionsEnabled)); tasksService.getCommuteDetailsTasks().subscribe((res) => { @@ -1107,7 +1107,7 @@ describe('TasksService', () => { it('should return commute details task if home location is not present', (done) => { employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData3)); - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); orgSettingsService.get.and.returnValue(of(orgSettingsWithCommuteDeductionsEnabled)); tasksService.getCommuteDetailsTasks().subscribe((res) => { @@ -1121,7 +1121,7 @@ describe('TasksService', () => { it('should not return commute details task if mileage is disabled for org', (done) => { employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData3)); - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); orgSettingsService.get.and.returnValue(of(orgSettingsWoMileage)); tasksService.getCommuteDetailsTasks().subscribe((res) => { @@ -1135,7 +1135,7 @@ describe('TasksService', () => { it('should not return commute details task if commute deduction settings is disabled for org', (done) => { employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData3)); - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); orgSettingsService.get.and.returnValue(of(orgSettingsRes)); tasksService.getCommuteDetailsTasks().subscribe((res) => { @@ -1149,7 +1149,7 @@ describe('TasksService', () => { it('should not return commute details task if home location is present in commute details', (done) => { employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData)); - authService.getEou.and.returnValue(Promise.resolve(extendedOrgUserResponse)); + authService.getEou.and.resolveTo(extendedOrgUserResponse); orgSettingsService.get.and.returnValue(of(orgSettingsWithCommuteDeductionsDisabled)); tasksService.getCommuteDetailsTasks().subscribe((res) => { diff --git a/src/app/core/test-data/tasks.service.spec.data.ts b/src/app/core/test-data/tasks.service.spec.data.ts index 3c2d4a34e8..2f2cc4d783 100644 --- a/src/app/core/test-data/tasks.service.spec.data.ts +++ b/src/app/core/test-data/tasks.service.spec.data.ts @@ -1,4 +1,5 @@ import deepFreeze from 'deep-freeze-strict'; +import { ExtendedOrgUser } from '../models/extended-org-user.model'; export const potentialDuplicatesApiResponse = deepFreeze([ { transaction_ids: ['tx3I0ccSGlhg', 'txvAmVCGZUZi'], fields: ['amount', 'currency', 'txn_dt'] }, @@ -22,16 +23,16 @@ export const potentialDuplicatesApiResponse = deepFreeze([ { transaction_ids: ['txT0ZmCrVOiD', 'txzjWIcqYxa9'], fields: ['amount', 'currency', 'txn_dt'] }, ]); -export const extendedOrgUserResponse = deepFreeze({ +export const extendedOrgUserResponse: ExtendedOrgUser = deepFreeze({ ou: { id: 'out3t2X258rd', created_at: new Date('2019-02-04T10:26:36.877Z'), org_id: 'orrjqbDbeP9p', user_id: 'usN0bYiJRI5V', - employee_id: null, + employee_id: 'ouE1vAIIxhaA', location: 'indiax', level: null, - level_id: null, + level_id: 'lvlPtroPaClQy', band: null, rank: null, business_unit: null, From 3581018602fbff3359fda1647fedacd978455ed6 Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Tue, 7 May 2024 21:34:01 +0530 Subject: [PATCH 08/14] Update reports.service.spec.ts --- .../core/services/platform/v1/approver/reports.service.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/platform/v1/approver/reports.service.spec.ts b/src/app/core/services/platform/v1/approver/reports.service.spec.ts index f4d992fbdb..fc13ccd862 100644 --- a/src/app/core/services/platform/v1/approver/reports.service.spec.ts +++ b/src/app/core/services/platform/v1/approver/reports.service.spec.ts @@ -61,7 +61,7 @@ describe('ApproverReportsService', () => { it('generateStatsQueryParams(): should generate stats query params', () => { const queryParams = { - state: 'eq.DRAFT', + state: `eq.${ReportState.DRAFT}`, }; const result = approverReportsService.generateStatsQueryParams(queryParams); From f8f1e1f25abfa42aac38bb80dc9e9e12d069116e Mon Sep 17 00:00:00 2001 From: aastha Date: Tue, 7 May 2024 21:43:47 +0530 Subject: [PATCH 09/14] Minor --- src/app/core/services/platform/v1/spender/reports.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/platform/v1/spender/reports.service.ts b/src/app/core/services/platform/v1/spender/reports.service.ts index 7c218d5930..fa1c9f74dd 100644 --- a/src/app/core/services/platform/v1/spender/reports.service.ts +++ b/src/app/core/services/platform/v1/spender/reports.service.ts @@ -73,7 +73,7 @@ export class SpenderReportsService { ); } - getAllReportsByParams(queryParams: ReportsQueryParams, order?: string): Observable { + getAllReportsByParams(queryParams: ReportsQueryParams): Observable { return this.getReportsCount(queryParams).pipe( switchMap((count) => { count = count > this.paginationSize ? count / this.paginationSize : 1; From 9e11a9198a4fbcc3640d3498604dc9d486bb1320 Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 8 May 2024 07:49:59 +0530 Subject: [PATCH 10/14] Minor --- src/app/core/services/tasks.service.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index eadbbb9df7..5848be7ce8 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -5,7 +5,6 @@ import { HumanizeCurrencyPipe } from 'src/app/shared/pipes/humanize-currency.pip import { TASKEVENT } from '../models/task-event.enum'; import { TaskIcon } from '../models/task-icon.enum'; import { - allExtendedReportsResponse, extendedOrgUserResponse, incompleteExpensesResponse, potentialDuplicatesApiResponse, @@ -65,6 +64,7 @@ import { expectedSentBackResponse, expectedSentBackResponseSingularReport, } from '../mock-data/report-stats.data'; +import { expectedReportsSinglePage } from '../mock-data/platform-report.data'; describe('TasksService', () => { let tasksService: TasksService; @@ -229,7 +229,7 @@ describe('TasksService', () => { }) .and.returnValue(of(completeStats)); - spenderReportsService.getAllReportsByParams.and.returnValue(of(allExtendedReportsResponse)); + spenderReportsService.getAllReportsByParams.and.returnValue(of(expectedReportsSinglePage)); } it('should be able to fetch unreported expenses tasks', () => { From 9588a7ff39dc7c1f355a09e593479756861e1416 Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Wed, 8 May 2024 08:04:08 +0530 Subject: [PATCH 11/14] Update reports.service.ts --- src/app/core/services/platform/v1/spender/reports.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/platform/v1/spender/reports.service.ts b/src/app/core/services/platform/v1/spender/reports.service.ts index fa1c9f74dd..8b81ac6b65 100644 --- a/src/app/core/services/platform/v1/spender/reports.service.ts +++ b/src/app/core/services/platform/v1/spender/reports.service.ts @@ -1,4 +1,4 @@ -import { Inject, Injectable, PlatformRef } from '@angular/core'; +import { Inject, Injectable } from '@angular/core'; import { Observable, Subject, range } from 'rxjs'; import { concatMap, map, reduce, switchMap, tap } from 'rxjs/operators'; import { Report } from 'src/app/core/models/platform/v1/report.model'; From 9e4a17dbfb64c5ad5ae0224634aac37fda24df73 Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 8 May 2024 08:05:04 +0530 Subject: [PATCH 12/14] Minor --- src/app/core/services/tasks.service.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 5848be7ce8..a034d0c749 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -5,6 +5,7 @@ import { HumanizeCurrencyPipe } from 'src/app/shared/pipes/humanize-currency.pip import { TASKEVENT } from '../models/task-event.enum'; import { TaskIcon } from '../models/task-icon.enum'; import { + allExtendedReportsResponse, extendedOrgUserResponse, incompleteExpensesResponse, potentialDuplicatesApiResponse, @@ -59,7 +60,6 @@ import { SpenderReportsService } from './platform/v1/spender/reports.service'; import { ApproverReportsService } from './platform/v1/approver/reports.service'; import { PlatformReportsStatsResponse } from '../models/platform/v1/report-stats-response.model'; import { - expectedEmptyReportStats, expectedReportStats, expectedSentBackResponse, expectedSentBackResponseSingularReport, @@ -229,7 +229,7 @@ describe('TasksService', () => { }) .and.returnValue(of(completeStats)); - spenderReportsService.getAllReportsByParams.and.returnValue(of(expectedReportsSinglePage)); + reportService.getAllExtendedReports.and.returnValue(of(allExtendedReportsResponse)); } it('should be able to fetch unreported expenses tasks', () => { From 61ece5d5471198bff5a1d99038d3646da485b051 Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 8 May 2024 17:07:46 +0530 Subject: [PATCH 13/14] Minor --- src/app/core/services/tasks.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index b7e034f9c7..087c2a38bd 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -579,7 +579,7 @@ export class TasksService { return this.orgSettingsService.get().pipe( map( (orgSetting) => - orgSetting?.corporate_credit_card_settings?.enabled && orgSetting?.pending_cct_expense_restriction?.enabled + orgSetting.corporate_credit_card_settings?.enabled && orgSetting.pending_cct_expense_restriction?.enabled ), switchMap((filterPendingTxn: boolean) => { if (filterPendingTxn) { From 1d686b77453fcb3edd644969e301344756f9052d Mon Sep 17 00:00:00 2001 From: aastha Date: Thu, 9 May 2024 15:41:54 +0530 Subject: [PATCH 14/14] Minor --- src/app/core/models/approver.model.ts | 4 ++-- src/app/core/models/custom_field.model.ts | 2 +- src/app/core/models/org-user.model.ts | 28 +++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/app/core/models/approver.model.ts b/src/app/core/models/approver.model.ts index 7acf529902..8fca398da9 100644 --- a/src/app/core/models/approver.model.ts +++ b/src/app/core/models/approver.model.ts @@ -1,6 +1,6 @@ export interface Approver { - full_name: string | null; - email: string | null; + full_name: string; + email: string; } export interface AdvanceApprover { added_by: string; diff --git a/src/app/core/models/custom_field.model.ts b/src/app/core/models/custom_field.model.ts index f1616a6255..9b32cc5545 100644 --- a/src/app/core/models/custom_field.model.ts +++ b/src/app/core/models/custom_field.model.ts @@ -3,7 +3,7 @@ import { AbstractControl } from '@angular/forms'; export interface CustomField { id?: number; name: string; - value: string | boolean | number | Date | string[] | { display: string } | null; + value: string | boolean | number | Date | string[] | { display: string }; type?: string; displayValue?: string | boolean | number | Date | string[] | { display: string }; mandatory?: boolean; diff --git a/src/app/core/models/org-user.model.ts b/src/app/core/models/org-user.model.ts index 6328988531..c79b311883 100644 --- a/src/app/core/models/org-user.model.ts +++ b/src/app/core/models/org-user.model.ts @@ -7,20 +7,20 @@ export interface OrgUser { user_id?: string; employee_id?: number | string; location: string; - level?: number | string | null; + level?: number | string; level_id?: string; - band?: string | null; - business_unit?: string | null; - department_id?: string | null; - department?: string | null; - sub_department?: string | null; + band?: string; + business_unit?: string; + department_id?: string; + department?: string; + sub_department?: string; roles?: string[]; approver1_id?: string; - approver2_id?: string | null; - approver3_id?: string | null; - delegatee_id?: string | null; - delegation_start_at?: Date | null; - delegation_end_at?: Date | null; + approver2_id?: string; + approver3_id?: string; + delegatee_id?: string; + delegation_start_at?: Date; + delegation_end_at?: Date; title?: string; status: string; branch_ifsc?: string; @@ -29,8 +29,8 @@ export interface OrgUser { mobile_verified?: boolean; mobile_verified_at?: Date; is_primary?: boolean; - owner?: boolean | null; - joining_dt?: Date | null; + owner?: boolean; + joining_dt?: Date; special_email?: string; custom_field_values?: CustomField[]; org_name: string; @@ -38,7 +38,7 @@ export interface OrgUser { default_cost_center_id?: number; default_cost_center_name?: string; default_cost_center_code?: string; - rank?: number | null; + rank?: number; cost_center_ids?: number[]; mobile_verification_attempts_left?: number; }