-- name: GetJobs :many
SELECT id,
	   startedTs,
	   completedTs,
	   targetSiteName,
	   auctionsFound,
	   errors
	FROM runner.scrapejob
	ORDER BY startedTs DESC;

-- name: GetJobByID :one
SELECT id,
	   startedTs,
	   completedTs,
	   targetSiteName,
	   auctionsFound,
	   errors
	FROM runner.scrapejob
	WHERE id = $1;

-- name: CreateScrapeJob :one
INSERT INTO runner.scrapejob (
		targetSiteName
	) VALUES (
		$1
	) RETURNING *;


-- name: CompleteScrapeJob :exec
UPDATE runner.scrapejob SET
	completedTs = $2,
	auctionsFound = $3,
	errors = $4
WHERE id = $1;
