WEB-509:fix(notifications): resolve account navigation using entity resolution (#3032)
improve
This commit is contained in:
@@ -12,6 +12,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { map, catchError } from 'rxjs/operators';
|
||||
|
||||
/**
|
||||
* Notification service.
|
||||
@@ -37,6 +38,86 @@ export class NotificationsService {
|
||||
return this.http.put('/notifications', {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get loan account details to retrieve client/group ID
|
||||
* @param {string} loanId Loan Account ID
|
||||
* @returns {Observable<any>} Loan account with clientId or groupId
|
||||
*/
|
||||
getLoanAccount(loanId: string): Observable<any> {
|
||||
return this.http.get(`/loans/${loanId}`).pipe(
|
||||
map((response: any) => ({
|
||||
clientId: response.clientId,
|
||||
groupId: response.groupId,
|
||||
accountId: loanId
|
||||
})),
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get savings account details to retrieve client/group ID
|
||||
* @param {string} savingsId Savings Account ID
|
||||
* @returns {Observable<any>} Savings account with clientId or groupId
|
||||
*/
|
||||
getSavingsAccount(savingsId: string): Observable<any> {
|
||||
return this.http.get(`/savingsaccounts/${savingsId}`).pipe(
|
||||
map((response: any) => ({
|
||||
clientId: response.clientId,
|
||||
groupId: response.groupId,
|
||||
accountId: savingsId
|
||||
})),
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fixed deposit account details to retrieve client/group ID
|
||||
* @param {string} accountId Fixed Deposit Account ID
|
||||
* @returns {Observable<any>} Fixed deposit account with clientId or groupId
|
||||
*/
|
||||
getFixedDepositAccount(accountId: string): Observable<any> {
|
||||
return this.http.get(`/fixeddepositaccounts/${accountId}`).pipe(
|
||||
map((response: any) => ({
|
||||
clientId: response.clientId,
|
||||
groupId: response.groupId,
|
||||
accountId: accountId
|
||||
})),
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recurring deposit account details to retrieve client/group ID
|
||||
* @param {string} accountId Recurring Deposit Account ID
|
||||
* @returns {Observable<any>} Recurring deposit account with clientId or groupId
|
||||
*/
|
||||
getRecurringDepositAccount(accountId: string): Observable<any> {
|
||||
return this.http.get(`/recurringdepositaccounts/${accountId}`).pipe(
|
||||
map((response: any) => ({
|
||||
clientId: response.clientId,
|
||||
groupId: response.groupId,
|
||||
accountId: accountId
|
||||
})),
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get share account details to retrieve client/group ID
|
||||
* @param {string} accountId Share Account ID
|
||||
* @returns {Observable<any>} Share account with clientId or groupId
|
||||
*/
|
||||
getShareAccount(accountId: string): Observable<any> {
|
||||
return this.http.get(`/accounts/share/${accountId}`).pipe(
|
||||
map((response: any) => ({
|
||||
clientId: response.clientId,
|
||||
groupId: response.groupId,
|
||||
accountId: accountId
|
||||
})),
|
||||
catchError(() => of(null))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {Observable<any>} Mock Unread Notifications for Testing.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user