Skip to content

Commit

Permalink
fix: profiles data string not supporting export fixed (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
mythilytm authored Mar 21, 2024
1 parent 2861a54 commit cec9a6c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion hrm-domain/scheduled-tasks/hrm-data-pull/pull-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export const pullCases = async (startDate: Date, endDate: Date) => {

try {
await Promise.all(uploadPromises);
console.log(`>> ${shortCode} ${hrmEnv} Cases were pulled successfully!`);
console.log(
`>> ${shortCode} ${hrmEnv} ${casesWithContactIdOnly.length} Cases were pulled successfully!`,
);
} catch (err) {
console.error(`>> Error in ${shortCode} ${hrmEnv} Data Pull: Cases`);
console.error(err);
Expand Down
4 changes: 3 additions & 1 deletion hrm-domain/scheduled-tasks/hrm-data-pull/pull-contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export const pullContacts = async (startDate: Date, endDate: Date) => {

try {
await Promise.all(uploadPromises);
console.log(`>> ${shortCode} ${hrmEnv} Contacts were pulled successfully!`);
console.log(
`>> ${shortCode} ${hrmEnv} ${contacts.length} Contacts were pulled successfully!`,
);
} catch (err) {
console.error(`>> Error in ${shortCode} ${hrmEnv} Data Pull: Contacts`);
console.error(err);
Expand Down
9 changes: 7 additions & 2 deletions hrm-domain/scheduled-tasks/hrm-data-pull/pull-profiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ export const pullProfiles = async (startDate: Date, endDate: Date) => {
1) 'totalCount' property, which I think is wrong, so I'm deleting it
*/
delete (profile as any).totalCount;
const date = format(parseISO(profile.updatedAt.toISOString()), 'yyyy/MM/dd');
const date = format(
parseISO(profile.updatedAt.toString() ?? profile.createdAt.toString()),
'yyyy/MM/dd',
);
const key = `hrm-data/${date}/profiles/${profile.id}.json`;
const body = JSON.stringify(profile);
const params = { bucket, key, body };
Expand All @@ -187,7 +190,9 @@ export const pullProfiles = async (startDate: Date, endDate: Date) => {
});

await Promise.all(uploadPromises);
console.log(`>> ${shortCode} ${hrmEnv} Profiles were pulled successfully!`);
console.log(
`>> ${shortCode} ${hrmEnv} ${populatedProfiles.length} Profiles were pulled successfully!`,
);
} catch (err) {
console.error(`>> Error in ${shortCode} ${hrmEnv} Data Pull: Profiles`);
console.error(err);
Expand Down

0 comments on commit cec9a6c

Please sign in to comment.