change endpoint to store cloudevent in events table
Some checks failed
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is failing

This commit is contained in:
2024-09-13 12:58:22 +10:00
parent 446cd30d8e
commit eecf227cd8
8 changed files with 270 additions and 53 deletions

View File

@@ -28,4 +28,26 @@ INSERT INTO "Updates" (
) VALUES(
?, ?, ?, ?, ?, ?, ?, ?
)
RETURNING *;
RETURNING *;
-- name: CreateEvent :one
INSERT INTO "Events" (
"CloudId", "Source", "EventTime", "ChainId", "VmId", "EventKey", "Datacenter", "ComputeResource", "UserName"
) VALUES(
?, ?, ?, ?, ?, ?, ?, ?, ?
)
RETURNING *;
-- name: ListEvents :many
SELECT * FROM "Events"
ORDER BY "EventTime";
-- name: ListUnprocessedEvents :many
SELECT * FROM "Events"
WHERE "Processed" = 0
ORDER BY "EventTime";
-- name: UpdateEventsProcessed :exec
UPDATE "Events"
SET "Processed" = 1
WHERE "Eid" = sqlc.arg('eid');