mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-27 07:16:19 +09:00
feat: add media asset system, channel lifecycle refactor, and chat attachments (#54)
This commit is contained in:
+18
-6
@@ -1,18 +1,22 @@
|
||||
-- name: DeleteBotChannelConfig :exec
|
||||
DELETE FROM bot_channel_configs
|
||||
WHERE bot_id = $1 AND channel_type = $2;
|
||||
|
||||
-- name: GetBotChannelConfig :one
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, status, verified_at, created_at, updated_at
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at, created_at, updated_at
|
||||
FROM bot_channel_configs
|
||||
WHERE bot_id = $1 AND channel_type = $2
|
||||
LIMIT 1;
|
||||
|
||||
-- name: GetBotChannelConfigByExternalIdentity :one
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, status, verified_at, created_at, updated_at
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at, created_at, updated_at
|
||||
FROM bot_channel_configs
|
||||
WHERE channel_type = $1 AND external_identity = $2
|
||||
LIMIT 1;
|
||||
|
||||
-- name: UpsertBotChannelConfig :one
|
||||
INSERT INTO bot_channel_configs (
|
||||
bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, status, verified_at
|
||||
bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at
|
||||
)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
ON CONFLICT (bot_id, channel_type)
|
||||
@@ -22,13 +26,21 @@ DO UPDATE SET
|
||||
self_identity = EXCLUDED.self_identity,
|
||||
routing = EXCLUDED.routing,
|
||||
capabilities = EXCLUDED.capabilities,
|
||||
status = EXCLUDED.status,
|
||||
disabled = EXCLUDED.disabled,
|
||||
verified_at = EXCLUDED.verified_at,
|
||||
updated_at = now()
|
||||
RETURNING id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, status, verified_at, created_at, updated_at;
|
||||
RETURNING id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at, created_at, updated_at;
|
||||
|
||||
-- name: UpdateBotChannelConfigDisabled :one
|
||||
UPDATE bot_channel_configs
|
||||
SET
|
||||
disabled = $3,
|
||||
updated_at = now()
|
||||
WHERE bot_id = $1 AND channel_type = $2
|
||||
RETURNING id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at, created_at, updated_at;
|
||||
|
||||
-- name: ListBotChannelConfigsByType :many
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, status, verified_at, created_at, updated_at
|
||||
SELECT id, bot_id, channel_type, credentials, external_identity, self_identity, routing, capabilities, disabled, verified_at, created_at, updated_at
|
||||
FROM bot_channel_configs
|
||||
WHERE channel_type = $1
|
||||
ORDER BY created_at DESC;
|
||||
|
||||
Reference in New Issue
Block a user