Skip to content
This repository has been archived by the owner on Feb 29, 2024. It is now read-only.

Commit

Permalink
Update propelauth_user_id with propelauthUser.userId if propelauthUse…
Browse files Browse the repository at this point in the history
…r exists
  • Loading branch information
csulit committed Sep 29, 2023
1 parent 6df14f5 commit a0f67c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/users/services/cron/user-update.cron.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class UserUpdateCronService {
u.email,
);

if (userInErpHrV1.status === 200) {
if (userInErpHrV1.status === 200 && propelauthUser) {
const {
sr,
name,
Expand All @@ -55,7 +55,7 @@ export class UserUpdateCronService {
const updatedUser = await this.pgsql
.updateTable('users')
.set({
propelauth_user_id: propelauthUser ? propelauthUser.userId : null,
propelauth_user_id: propelauthUser.userId,
employee_id: sr || 'Not set in erp hr',
full_name: name,
first_name: firstName,
Expand All @@ -67,6 +67,7 @@ export class UserUpdateCronService {
? TEMPORARY_APPROVER
: hrbpEmail,
position,
temporary_propelauth_user_id: false,
updated_via_cron_erp_hr: true,
})
.returning(['users.email'])
Expand Down

0 comments on commit a0f67c7

Please sign in to comment.