Files
member-console/internal/integrations/discourse/store/queries/group_mappings.sql
T
cgalo5758 a94ff08336 Add Discourse integration
Deliver forum posting entitlements through managed group membership with
identity linkage, periodic reconciliation, webhook handling, and an
operator mapping surface.

Include fake and live test environments, setup documentation,
migrations,
and end-to-end coverage.
2026-07-20 19:49:34 -07:00

36 lines
1.0 KiB
SQL

-- name: CreateGroupMapping :one
INSERT INTO discourse.group_mappings (resource_key, group_name, discourse_group_id)
VALUES ($1, $2, $3)
RETURNING *;
-- name: GetGroupMappingByID :one
SELECT * FROM discourse.group_mappings
WHERE mapping_id = $1;
-- name: GetGroupMappingByGroupName :one
SELECT * FROM discourse.group_mappings
WHERE group_name = $1;
-- name: GetGroupMappingByDiscourseGroupID :one
SELECT * FROM discourse.group_mappings
WHERE discourse_group_id = $1;
-- name: ListGroupMappings :many
SELECT * FROM discourse.group_mappings
ORDER BY group_name ASC;
-- name: ListGroupMappingsByResourceKey :many
SELECT * FROM discourse.group_mappings
WHERE resource_key = $1
ORDER BY group_name ASC;
-- name: DeleteGroupMapping :execrows
DELETE FROM discourse.group_mappings
WHERE mapping_id = $1;
-- name: ListOwnedResourceKeys :many
-- The discourse-owned resource keys an operator can map (select options).
SELECT resource_key, display_name FROM core.resource_keys
WHERE provider = 'discourse'
ORDER BY resource_key ASC;