Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
71 lines
1.8 KiB
SQL
71 lines
1.8 KiB
SQL
-- name: ListInputFeeds :many
|
|
SELECT * FROM input_feeds
|
|
WHERE company_id = $1
|
|
ORDER BY created_at DESC;
|
|
|
|
-- name: GetInputFeed :one
|
|
SELECT * FROM input_feeds
|
|
WHERE id = $1 AND company_id = $2
|
|
LIMIT 1;
|
|
|
|
-- name: CreateInputFeed :one
|
|
INSERT INTO input_feeds (company_id, name, url, feed_type, status, sync_interval_minutes, options)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
|
RETURNING *;
|
|
|
|
-- name: UpdateInputFeed :one
|
|
UPDATE input_feeds
|
|
SET name = COALESCE($3, name),
|
|
url = COALESCE($4, url),
|
|
status = COALESCE($5, status),
|
|
sync_interval_minutes = COALESCE($6, sync_interval_minutes),
|
|
options = COALESCE($7, options),
|
|
updated_at = now()
|
|
WHERE id = $1 AND company_id = $2
|
|
RETURNING *;
|
|
|
|
-- name: DeleteInputFeed :exec
|
|
DELETE FROM input_feeds WHERE id = $1 AND company_id = $2;
|
|
|
|
-- name: CreateFeedSyncJob :one
|
|
INSERT INTO feed_sync_jobs (feed_id, company_id, status, started_at)
|
|
VALUES ($1, $2, $3, now())
|
|
RETURNING *;
|
|
|
|
-- name: UpdateFeedSyncJob :one
|
|
UPDATE feed_sync_jobs
|
|
SET status = $2, products_synced = $3, error = $4, completed_at = $5, updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING *;
|
|
|
|
-- name: ListExportFeeds :many
|
|
SELECT * FROM export_feeds
|
|
WHERE company_id = $1
|
|
ORDER BY created_at DESC;
|
|
|
|
-- name: GetExportFeed :one
|
|
SELECT * FROM export_feeds
|
|
WHERE id = $1 AND company_id = $2
|
|
LIMIT 1;
|
|
|
|
-- name: GetExportFeedByToken :one
|
|
SELECT * FROM export_feeds
|
|
WHERE public_token = $1 AND is_active = true
|
|
LIMIT 1;
|
|
|
|
-- name: CreateExportFeed :one
|
|
INSERT INTO export_feeds (company_id, name, source_feed_id, format, template, filters)
|
|
VALUES ($1, $2, $3, $4, $5, $6)
|
|
RETURNING *;
|
|
|
|
-- name: GetFeedMapping :one
|
|
SELECT * FROM feed_mappings
|
|
WHERE feed_id = $1 AND company_id = $2 AND is_active = true
|
|
ORDER BY version DESC
|
|
LIMIT 1;
|
|
|
|
-- name: UpsertFeedMapping :one
|
|
INSERT INTO feed_mappings (feed_id, company_id, version, mappings, is_active)
|
|
VALUES ($1, $2, $3, $4, true)
|
|
RETURNING *;
|