mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
Each verified: the generated dbgen method's only references were the .sql definition and dbgen output itself (no wrapper in db/*.go, no test, no script). ArchiveChannel, DeleteAttachment, FindExistingDMChannel, GetDefaultRole, GetMessagesByChannel, GetMessagesByChannelBeforeCursor, GetMessagesForAPIBeforeCursor, GetPinnedMessageRows, GetPlugin, GetPluginByName, InsertDMChannel, InsertDMOpenState, InsertDMParticipants, LinkAttachmentToMessage, SetChannelMixingThreshold, SetChannelVoiceMaxVideo, SetChannelVoiceQuality, UpdateVoiceSpeaking. dbgen regenerated with the pinned sqlc v1.30.0 (132 → 114 queries); sqlc-verify clean; db/service/ws suites green including -race. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
54 lines
1.8 KiB
SQL
54 lines
1.8 KiB
SQL
-- name: ListChannels :many
|
|
SELECT id, name, type, COALESCE(category, '') AS category, COALESCE(topic, '') AS topic,
|
|
position, slow_mode, archived, created_at,
|
|
COALESCE(voice_max_users, 0) AS voice_max_users,
|
|
voice_quality,
|
|
mixing_threshold,
|
|
COALESCE(voice_max_video, 0) AS voice_max_video
|
|
FROM channels ORDER BY position ASC, id ASC;
|
|
|
|
-- name: GetChannel :one
|
|
SELECT id, name, type, COALESCE(category, '') AS category, COALESCE(topic, '') AS topic,
|
|
position, slow_mode, archived, created_at,
|
|
COALESCE(voice_max_users, 0) AS voice_max_users,
|
|
voice_quality,
|
|
mixing_threshold,
|
|
COALESCE(voice_max_video, 0) AS voice_max_video
|
|
FROM channels WHERE id = ?;
|
|
|
|
-- name: CreateChannel :execresult
|
|
INSERT INTO channels (name, type, category, topic, position) VALUES (?, ?, ?, ?, ?);
|
|
|
|
-- name: UpdateChannel :exec
|
|
UPDATE channels SET name = ?, topic = ?, slow_mode = ? WHERE id = ?;
|
|
|
|
-- name: SetChannelSlowMode :exec
|
|
UPDATE channels SET slow_mode = ? WHERE id = ?;
|
|
|
|
-- name: SetChannelVoiceMaxUsers :exec
|
|
UPDATE channels SET voice_max_users = ? WHERE id = ?;
|
|
|
|
-- name: DeleteChannel :exec
|
|
DELETE FROM channels WHERE id = ?;
|
|
|
|
-- name: AdminUpdateChannel :exec
|
|
UPDATE channels
|
|
SET name = ?, topic = ?, slow_mode = ?, position = ?, archived = ?
|
|
WHERE id = ?;
|
|
|
|
-- name: UpsertChannelPermission :exec
|
|
INSERT INTO channel_overrides (channel_id, role_id, allow, deny)
|
|
VALUES (?, ?, ?, ?)
|
|
ON CONFLICT(channel_id, role_id) DO UPDATE SET
|
|
allow = excluded.allow,
|
|
deny = excluded.deny;
|
|
|
|
-- name: GetChannelPermission :one
|
|
SELECT allow, deny FROM channel_overrides WHERE channel_id = ? AND role_id = ?;
|
|
|
|
-- name: GetRoleChannelPermissions :many
|
|
SELECT channel_id, allow, deny FROM channel_overrides WHERE role_id = ?;
|
|
|
|
-- name: DeleteChannelPermission :exec
|
|
DELETE FROM channel_overrides WHERE channel_id = ? AND role_id = ?;
|