This commit is contained in:
seb
2026-10-13 00:36:36 +02:00
parent 8a8aeaedd7
commit 4b2ca7ce0e
7 changed files with 97 additions and 0 deletions

View File

@@ -88,3 +88,26 @@ UPDATE mcp_token
SET revoked = 1
WHERE refresh_token = @refreshToken
`;
export const LIST_AUTHORIZATIONS_BY_USER = `
SELECT
c.id AS clientDbId,
c.client_id AS clientId,
c.client_name AS clientName,
c.scope,
c.created_at AS clientCreatedAt,
MAX(t.created_at) AS authorizedAt,
COUNT(t.id) AS tokenCount
FROM mcp_token t
JOIN mcp_client c ON t.client_id = c.client_id
WHERE t.google_auth_id = @googleAuthId AND t.revoked = 0
GROUP BY c.id, c.client_id, c.client_name, c.scope, c.created_at
ORDER BY MAX(t.created_at) DESC
`;
export const REVOKE_USER_AUTHORIZATIONS = `
UPDATE mcp_token
SET revoked = 1
WHERE google_auth_id = @googleAuthId AND client_id = @clientId
`;