Skip to content

Commit 3391cc1

Browse files
authored
Complete Salesforce Settings Migration (#57)
complete Salesforce settings migration and fix bugs
1 parent a76f58d commit 3391cc1

4 files changed

Lines changed: 448 additions & 358 deletions

File tree

src/@seed/api/salesforce/salesforce.service.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ export class SalesforceService {
5050
return response
5151
}),
5252
catchError((error: HttpErrorResponse) => {
53-
// TODO need to figure out error handling
54-
return this._errorService.handleError(error, 'Error fetching organization')
53+
return this._errorService.handleError(error, 'Error fetching Salesforce config')
5554
}),
5655
)
5756
}
@@ -64,22 +63,20 @@ export class SalesforceService {
6463
return response
6564
}),
6665
catchError((error: HttpErrorResponse) => {
67-
// TODO need to figure out error handling
68-
return this._errorService.handleError(error, 'Error fetching organization')
66+
return this._errorService.handleError(error, 'Error fetching Salesforce mappings')
6967
}),
7068
)
7169
}
7270

7371
create(organizationId: number, config: SalesforceConfig): Observable<SalesforceConfig> {
74-
console.log('Creating: ', config)
7572
const url = `/api/v3/salesforce_configs/?organization_id=${organizationId}`
7673
return this._httpClient.post<SalesforceConfigResponse>(url, { ...config }).pipe(
7774
map((response) => {
7875
this._config.next(response.salesforce_config)
7976
return response.salesforce_config
8077
}),
8178
catchError((error: HttpErrorResponse) => {
82-
return this._errorService.handleError(error, 'Error fetching organization')
79+
return this._errorService.handleError(error, 'Error creating Salesforce config')
8380
}),
8481
)
8582
}
@@ -93,7 +90,7 @@ export class SalesforceService {
9390
return response.salesforce_config
9491
}),
9592
catchError((error: HttpErrorResponse) => {
96-
return this._errorService.handleError(error, 'Error fetching organization')
93+
return this._errorService.handleError(error, 'Error updating Salesforce config')
9794
}),
9895
)
9996
}
@@ -119,10 +116,11 @@ export class SalesforceService {
119116
return response
120117
}),
121118
catchError((error: HttpErrorResponse) => {
122-
return this._errorService.handleError(error, `Salesforce Mapping could not be created: ${error.message}`)
119+
return this._errorService.handleError(error, 'Error creating Salesforce mapping')
123120
}),
124121
)
125122
}
123+
126124
updateMapping(organizationId: number, mapping: SalesforceMapping): Observable<SalesforceMappingResponse> {
127125
const url = `/api/v3/salesforce_mappings/${mapping.id}/?organization_id=${organizationId}`
128126
return this._httpClient.put<SalesforceMappingResponse>(url, { ...mapping }).pipe(
@@ -131,7 +129,7 @@ export class SalesforceService {
131129
return response
132130
}),
133131
catchError((error: HttpErrorResponse) => {
134-
return this._errorService.handleError(error, `Salesforce Mapping could not be created: ${error.message}`)
132+
return this._errorService.handleError(error, 'Error updating Salesforce mapping')
135133
}),
136134
)
137135
}

src/@seed/api/salesforce/salesforce.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export type SalesforceConfigsResponse = {
4545
export type SalesforceMapping = {
4646
id: number;
4747
organization_id: number;
48-
column: 10;
48+
column: number;
4949
salesforce_fieldname: string;
5050
}
5151

0 commit comments

Comments
 (0)