userOwnsAgent reports whether agentID exists and is owned by userID.
(ctx context.Context, agentID, userID string)
| 3451 | |
| 3452 | // userOwnsAgent reports whether agentID exists and is owned by userID. |
| 3453 | func (s *Store) userOwnsAgent(ctx context.Context, agentID, userID string) (bool, error) { |
| 3454 | var exists bool |
| 3455 | err := s.pool.QueryRow(ctx, |
| 3456 | `SELECT EXISTS(SELECT 1 FROM agent_identities WHERE id = $1 AND user_id = $2)`, |
| 3457 | agentID, userID, |
| 3458 | ).Scan(&exists) |
| 3459 | return exists, err |
| 3460 | } |
| 3461 | |
| 3462 | func (s *Store) ListAPIKeys(ctx context.Context, userID string) ([]APIKey, error) { |
| 3463 | rows, err := s.pool.Query(ctx, |
no test coverage detected