diff --git a/backend/src/features/subscriptions/domain/subscriptions.service.ts b/backend/src/features/subscriptions/domain/subscriptions.service.ts index 9e5fffe..9a31bbe 100644 --- a/backend/src/features/subscriptions/domain/subscriptions.service.ts +++ b/backend/src/features/subscriptions/domain/subscriptions.service.ts @@ -767,7 +767,7 @@ export class SubscriptionsService { ): Promise { try { // Get user profile for email and name - const userProfile = await this.userProfileRepository.getByAuth0Sub(userId); + const userProfile = await this.userProfileRepository.getById(userId); if (!userProfile) { logger.warn('User profile not found for tier change notification', { userId }); return; @@ -925,7 +925,7 @@ export class SubscriptionsService { // Sync tier to user_profiles table (within same transaction) await client.query( - 'UPDATE user_profiles SET subscription_tier = $1 WHERE auth0_sub = $2', + 'UPDATE user_profiles SET subscription_tier = $1 WHERE id = $2', [newTier, userId] ); diff --git a/backend/src/features/subscriptions/jobs/grace-period.job.ts b/backend/src/features/subscriptions/jobs/grace-period.job.ts index 60ce022..f4345b5 100644 --- a/backend/src/features/subscriptions/jobs/grace-period.job.ts +++ b/backend/src/features/subscriptions/jobs/grace-period.job.ts @@ -50,7 +50,7 @@ export async function processGracePeriodExpirations(): Promise> { // Get user's subscription tier - const userProfile = await this.userProfileRepository.getByAuth0Sub(userId); + const userProfile = await this.userProfileRepository.getById(userId); if (!userProfile) { throw new Error('User profile not found'); }