fix GetSetupKeyByID

This commit is contained in:
Maycon Santos
2025-06-26 13:54:04 +02:00
parent b85aad07d4
commit 5f5d597c59

View File

@@ -1901,8 +1901,7 @@ func (s *SqlStore) GetAccountSetupKeys(ctx context.Context, lockStrength Locking
func (s *SqlStore) GetSetupKeyByID(ctx context.Context, lockStrength LockingStrength, accountID, setupKeyID string) (*types.SetupKey, error) {
tx := s.getTXWithLockStrength(lockStrength)
var setupKey *types.SetupKey
result := tx.Clauses(clause.Locking{Strength: string(lockStrength)}).
First(&setupKey, accountAndIDQueryCondition, accountID, setupKeyID)
result := tx.First(&setupKey, accountAndIDQueryCondition, accountID, setupKeyID)
if err := result.Error; err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil, status.NewSetupKeyNotFoundError(setupKeyID)