fix(auth): add more logs to syncing subscription
This commit is contained in:
parent
3da7a21cde
commit
c7217a92ba
1 changed files with 16 additions and 1 deletions
|
@ -38,6 +38,10 @@ export class SubscriptionSyncRequestedEventHandler implements DomainEventHandler
|
||||||
})
|
})
|
||||||
|
|
||||||
if (event.payload.offline) {
|
if (event.payload.offline) {
|
||||||
|
this.logger.info('Syncing offline subscription', {
|
||||||
|
subscriptionId: event.payload.subscriptionId,
|
||||||
|
})
|
||||||
|
|
||||||
const offlineUserSubscription = await this.createOrUpdateOfflineSubscription(
|
const offlineUserSubscription = await this.createOrUpdateOfflineSubscription(
|
||||||
event.payload.subscriptionId,
|
event.payload.subscriptionId,
|
||||||
event.payload.subscriptionName,
|
event.payload.subscriptionName,
|
||||||
|
@ -66,11 +70,19 @@ export class SubscriptionSyncRequestedEventHandler implements DomainEventHandler
|
||||||
value: offlineFeaturesTokenDecoded.extensionKey,
|
value: offlineFeaturesTokenDecoded.extensionKey,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
this.logger.info('Offline subscription synced', {
|
||||||
|
subscriptionId: event.payload.subscriptionId,
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const usernameOrError = Username.create(event.payload.userEmail)
|
const usernameOrError = Username.create(event.payload.userEmail)
|
||||||
if (usernameOrError.isFailed()) {
|
if (usernameOrError.isFailed()) {
|
||||||
|
this.logger.warn(`Could not sync subscription: ${usernameOrError.getError()}`, {
|
||||||
|
subscriptionId: event.payload.subscriptionId,
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const username = usernameOrError.getValue()
|
const username = usernameOrError.getValue()
|
||||||
|
@ -78,7 +90,10 @@ export class SubscriptionSyncRequestedEventHandler implements DomainEventHandler
|
||||||
const user = await this.userRepository.findOneByUsernameOrEmail(username)
|
const user = await this.userRepository.findOneByUsernameOrEmail(username)
|
||||||
|
|
||||||
if (user === null) {
|
if (user === null) {
|
||||||
this.logger.warn(`Could not find user with email: ${username.value}`)
|
this.logger.warn(`Could not find user with email: ${username.value}`, {
|
||||||
|
subscriptionId: event.payload.subscriptionId,
|
||||||
|
})
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue