Files
Memoh/db/queries/bind.sql
T
BBQ ca5c6a1866 refactor(core): restructure conversation, channel and message domains
- Rename chat module to conversation with flow-based architecture
- Move channelidentities into channel/identities subpackage
- Add channel/route for routing logic
- Add message service with event hub
- Add MCP providers: container, directory, schedule
- Refactor Feishu/Telegram adapters with directory and stream support
- Add platform management page and channel badges in web UI
- Update database schema for conversations, messages and channel routes
- Add @memoh/shared package for cross-package type definitions
2026-02-12 15:34:40 +08:00

23 lines
935 B
SQL

-- name: CreateBindCode :one
INSERT INTO channel_identity_bind_codes (token, issued_by_user_id, channel_type, expires_at)
VALUES ($1, $2, $3, $4)
RETURNING id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at;
-- name: GetBindCode :one
SELECT id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at
FROM channel_identity_bind_codes
WHERE token = $1;
-- name: GetBindCodeForUpdate :one
SELECT id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at
FROM channel_identity_bind_codes
WHERE token = $1
FOR UPDATE;
-- name: MarkBindCodeUsed :one
UPDATE channel_identity_bind_codes
SET used_at = now(), used_by_channel_identity_id = $2
WHERE id = $1
AND used_at IS NULL
RETURNING id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at;