From 9bf8ab7048e1a98deff92619132818afb344588b Mon Sep 17 00:00:00 2001 From: IanShaw027 Date: Tue, 21 Apr 2026 09:52:12 -0700 Subject: [PATCH] Fix postgres provider grant queries --- backend/internal/service/auth_oauth_first_bind.go | 2 +- backend/internal/service/auth_service.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/internal/service/auth_oauth_first_bind.go b/backend/internal/service/auth_oauth_first_bind.go index b0da5069..aa06e59f 100644 --- a/backend/internal/service/auth_oauth_first_bind.go +++ b/backend/internal/service/auth_oauth_first_bind.go @@ -61,7 +61,7 @@ func (s *AuthService) applyProviderDefaultSettingsOnFirstBind( if err := client.Driver().Exec( ctx, `INSERT INTO user_provider_default_grants (user_id, provider_type, grant_reason) -VALUES (?, ?, ?) +VALUES ($1, $2, $3) ON CONFLICT (user_id, provider_type, grant_reason) DO NOTHING`, []any{userID, strings.TrimSpace(providerType), "first_bind"}, &result, diff --git a/backend/internal/service/auth_service.go b/backend/internal/service/auth_service.go index c3d9cc32..a40fd825 100644 --- a/backend/internal/service/auth_service.go +++ b/backend/internal/service/auth_service.go @@ -855,7 +855,7 @@ func (s *AuthService) hasProviderGrantRecord( rows, err := s.entClient.QueryContext( ctx, - `SELECT 1 FROM user_provider_default_grants WHERE user_id = ? AND provider_type = ? AND grant_reason = ? LIMIT 1`, + `SELECT 1 FROM user_provider_default_grants WHERE user_id = $1 AND provider_type = $2 AND grant_reason = $3 LIMIT 1`, userID, strings.TrimSpace(providerType), strings.TrimSpace(grantReason),