Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 671fb65

Browse files
authored
Fix Querying Current Records + Metadata Hash (#11)
* Fix Current Records Request (#8) * Get Data for GET Requests (#9) * Get Data for GET Requests * Fixes Metadata Hash (#10) * Fix Unique Record Identifier
1 parent cf41bc2 commit 671fb65

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class App {
138138
// This would be better suited if we already knew the data
139139
// to which to update or insert which out querying the XIS.
140140
// This is a fail safe though for those IDs that failed to be inserted.
141-
const query = `id=${process.env.PROVIDER}`;
141+
const query = `provider=${process.env.PROVIDER}`;
142142
return await this.destinationWebService.request(`${process.env.DESTINATION_ENDPOINT}?${query}`);
143143
} catch (error) {
144144
this.outputToConsole(error, 'error');
@@ -212,7 +212,7 @@ class App {
212212
*/
213213
private addHashes(value: MappedItem): MappedItem {
214214
value["metadata_key_hash"] = md5(value.metadata_key as string);
215-
value["metadata_hash"] = md5(value.metadata as string);
215+
value["metadata_hash"] = md5(JSON.stringify(value.metadata));
216216
return value;
217217
}
218218

@@ -242,7 +242,7 @@ class App {
242242
(data.metadata as MappedItem).Metadata_Ledger = metadata;
243243
try {
244244
this.outputToConsole('record exists... patching');
245-
await this.destinationWebService.patch(`${process.env.DESTINATION_ENDPOINT}${data.unique_identifier}/`, data);
245+
await this.destinationWebService.patch(`${process.env.DESTINATION_ENDPOINT}${data.unique_record_identifier}/`, data);
246246
} catch (error) {
247247
this.outputToConsole(error, 'error');
248248
}

src/webservice/webservice.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Webservice {
3636
* @returns The response.
3737
*/
3838
async request(url: string): Promise<unknown> {
39-
return await axios.get(`${this.host}${url}`);
39+
return (await axios.get(`${this.host}${url}`)).data;
4040
}
4141
}
4242

0 commit comments

Comments
 (0)