Skip to content

Commit 15916f3

Browse files
committed
fix(arc-saas): changes in manage comp
changes in manage comp GH-64
1 parent c03fa94 commit 15916f3

File tree

4 files changed

+12
-21
lines changed

4 files changed

+12
-21
lines changed

projects/arc-lib/src/lib/core/api/commands/get-api.command.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export abstract class GetAPICommand<T, R = T> implements ICommand {
2727
if (this.parameters) {
2828
options = {};
2929
options.observe = this.parameters.observe || 'body';
30-
options.observe = 'response';
3130

3231
if (this.parameters.headers) {
3332
options.headers = this.parameters.headers;

projects/saas-ui/src/app/main/components/manage-plans/manage-plans.component.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class ManagePlansComponent extends RouteComponentBaseDirective {
2727
[x: string]: any;
2828
gridApi: GridApi;
2929
gridOptions: GridOptions;
30-
getResp: any;
30+
getResp: Plan[];
3131
limit = 5;
3232
colDefs: ColDef[] = [
3333
{field: 'name', headerName: 'Plan Name', width: 200, minWidth: 20},
@@ -101,22 +101,11 @@ export class ManagePlansComponent extends RouteComponentBaseDirective {
101101
return this.billingPlanService.getPlanOptions(filter).pipe(
102102
map(res => {
103103
try {
104-
// const body = JSON.parse(JSON.stringify(res)).body;
105-
this.getResp = res;
106-
const rows = this.getResp.map(item => {
104+
const rows = res.map(item => {
107105
return {
108106
id: item.id,
109107
name: item.name,
110108
description: item.description,
111-
// cycleName: item['billingCycle']
112-
// ? item['billingCycle'].cycleName
113-
// : '',
114-
// currencyName: item['currency']
115-
// ? item['currency'].currencyName
116-
// : '',
117-
// price: item.price,
118-
// };
119-
// });
120109
cycleName: item['billingCycle']?.cycleName,
121110

122111
currencyName: item['currency']?.currencyName,

projects/saas-ui/src/app/on-boarding/commands/get-plan.command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ import {Plan} from '../../shared/models';
88

99
import {IAnyObject} from '@project-lib/core/i-any-object';
1010

11-
export class GetPlanCommand<T> extends GetAPICommand<AnyObject[]> {
11+
export class GetPlanCommand<T> extends GetAPICommand<Plan[]> {
1212
constructor(
1313
apiService: IApiService,
14-
adapter: IAdapter<AnyObject[]>,
14+
adapter: IAdapter<Plan[]>,
1515
appConfig: IAnyObject,
1616
) {
1717
super(
1818
apiService,
1919
adapter,
20-
`${appConfig.baseApiUrl}${appConfig.subscriptionServiceUrl}/plans`,
20+
`${appConfig.baseApiUrl}${appConfig.subscriptionServiceUrl}/plans`,
2121
);
2222
}
2323
}

projects/saas-ui/src/app/shared/services/billing-plan-service.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,26 +39,28 @@ interface BackendFilter<MT extends object = AnyObject> {
3939
providedIn: 'root',
4040
})
4141
export class BillingPlanService {
42+
43+
4244
constructor(
4345
private readonly apiService: ApiService,
4446
private readonly anyAdapter: AnyAdapter,
4547
@Inject(APP_CONFIG) private readonly appConfig: IAnyObject,
4648
private readonly getPlanAdapter: GetPlanAdapter,
4749
) {}
4850

49-
getPlanOptions(filter?: BackendFilter<AnyObject>) {
50-
const command: GetPlanCommand<AnyObject[]> = new GetPlanCommand(
51+
getPlanOptions(filter?: BackendFilter<Plan>) {
52+
const command: GetPlanCommand<Plan[]> = new GetPlanCommand(
5153
this.apiService,
5254
this.anyAdapter,
5355
this.appConfig,
5456
);
55-
const backendFilter: BackendFilter<AnyObject> = filter
57+
const backendFilter: BackendFilter<Plan> = filter
5658
? {
5759
where: filter.where,
5860
offset: filter.offset,
5961
limit: filter.limit,
6062
order: filter.order,
61-
include: filter.include || [], // Adding include from filter parameter
63+
include: filter.include || [],
6264
}
6365
: {};
6466
command.parameters = {
@@ -164,6 +166,7 @@ export class BillingPlanService {
164166
this.anyAdapter,
165167
this.appConfig,
166168
);
169+
167170
return command.execute();
168171
}
169172
}

0 commit comments

Comments
 (0)