-- name: AppUploaderCreate :one
INSERT INTO app_uploader_files (uid, file_crypto, expire, max_visits) VALUES ($1, $2, $3, $4) RETURNING id;

-- name: AppUploaderGet :one
SELECT * FROM app_uploader_files WHERE file_crypto = $1 LIMIT 1;

-- name: AppUploaderAccessCreate :exec
INSERT INTO app_uploader_files_access (file_id, uid, ip_address, agent) VALUES ($1, $2, $3, $4);

-- name: AppUploaderAccessCount :one
SELECT COUNT(*) AS file_accessors FROM app_uploader_files_access WHERE file_id = $1;

