// User-related queries export const updateUser = { name: "updateUser", text: "INSERT INTO users (userid,displayName,imageUrl) VALUES ($1,$2,$3)\ ON CONFLICT (userid) DO UPDATE SET displayName = $2, imageUrl = $3" } export const checkBan = { name: "checkBan", text: "SELECT userid FROM bans WHERE userid = $1" } export const insertBan = { name: "insertBan", text: "INSERT INTO bans (userid) VALUES ($1)" } // Streamer-related queries export const getStreamerId = { name: "getStreamerId", text: "SELECT userid FROM streamer" } export const getStreamerIdToken = { name: "getStreamerIdToken", text: "SELECT userid,tokenpair FROM streamer" } export const getStreamerInfo = { name: "getStreamerInfo", text: "SELECT displayname,imageurl FROM streamer_user_vw" } export const updateStreamer = { name: "updateStreamer", text: "INSERT INTO streamer (userid,tokenPair) VALUES ($1,$2)\ ON CONFLICT (userid) DO UPDATE SET tokenPair = $2" } // Request-related queries export const getRequests = { name: "getRequests", text: "SELECT * FROM get_requests() LIMIT $1" } export const getRequestsVoted = { name: "getRequestsVoted", text: "SELECT * FROM get_requests_voted($2) LIMIT $1" } export const getAllRequests = { name: "getAllRequests", text: "SELECT * FROM get_requests_all() LIMIT $1" } export const getAllRequestsVoted = { name: "getAllRequestsVoted", text: "SELECT * FROM get_requests_all_voted($2) LIMIT $1" } export const checkRequestExists = { name: "checkRequestExists", text: "SELECT url FROM requests WHERE url = $1" } export const addRequest = { name: "addRequest", text: "CALL add_request($1,$2)" } export const checkValidState = { name: "checkValidState", text: "SELECT state FROM states WHERE state = $1" } export const updateRequestState = { name: "updateRequestState", text: "UPDATE requests SET state = $2 WHERE url = $1" } export const updateRequestScore = { name: "updateRequestScore", text: "UPDATE requests SET score = score + $2 WHERE url = $1" } export const deleteRequest = { name: "deleteRequest", text: "DELETE FROM requests WHERE url = $1" } export const checkVoteExists = { name: "checkVoteExists", text: "SELECT userid FROM votes WHERE requesturl = $1 AND userid = $2" }