diff --git a/db/90-views.sql b/db/90-views.sql index 327112b..68a01dc 100644 --- a/db/90-views.sql +++ b/db/90-views.sql @@ -2,13 +2,14 @@ CREATE OR REPLACE FUNCTION get_requests() RETURNS TABLE ( url varchar, requester varchar, + imageUrl varchar, state varchar, score int, reqTimestamp timestamptz ) LANGUAGE SQL AS $$ - SELECT url,displayName AS requester,state,score,reqTimestamp FROM requests + SELECT url,displayName AS requester,imageUrl,state,score,reqTimestamp FROM requests JOIN scores USING (url) JOIN users ON requests.requester = users.userid WHERE state IN (SELECT state FROM states WHERE active) @@ -19,13 +20,14 @@ CREATE OR REPLACE FUNCTION get_requests_all() RETURNS TABLE ( url varchar, requester varchar, + imageUrl varchar, state varchar, score int, reqTimestamp timestamptz ) LANGUAGE SQL AS $$ - SELECT url,displayName AS requester,state,score,reqTimestamp FROM requests + SELECT url,displayName AS requester,imageUrl,state,score,reqTimestamp FROM requests JOIN scores USING (url) JOIN users ON requests.requester = users.userid ORDER BY score DESC, reqTimestamp ASC; @@ -35,6 +37,7 @@ CREATE OR REPLACE FUNCTION get_requests_voted(votinguserid int) RETURNS TABLE ( url varchar, requester varchar, + imageUrl varchar, state varchar, score int, reqTimestamp timestamptz, @@ -42,7 +45,7 @@ CREATE OR REPLACE FUNCTION get_requests_voted(votinguserid int) ) LANGUAGE SQL AS $$ - SELECT url,displayName AS requester,state,score,reqTimestamp, + SELECT url,displayName AS requester,imageUrl,state,score,reqTimestamp, (CASE WHEN votes.userid IS NULL THEN FALSE ELSE TRUE END) AS voted FROM requests JOIN scores USING (url) @@ -56,6 +59,7 @@ CREATE OR REPLACE FUNCTION get_requests_all_voted(votinguserid int) RETURNS TABLE ( url varchar, requester varchar, + imageUrl varchar, state varchar, score int, reqTimestamp timestamptz, @@ -63,7 +67,7 @@ CREATE OR REPLACE FUNCTION get_requests_all_voted(votinguserid int) ) LANGUAGE SQL AS $$ - SELECT url,displayName AS requester,state,score,reqTimestamp, + SELECT url,displayName AS requester,imageUrl,state,score,reqTimestamp, (CASE WHEN votes.userid IS NULL THEN FALSE ELSE TRUE END) AS voted FROM requests JOIN scores USING (url) diff --git a/public/main.js b/public/main.js index 67081da..41d6259 100644 --- a/public/main.js +++ b/public/main.js @@ -19,8 +19,9 @@ function buildTable(requests,allRequests) { if (window.loggedIn) requestsDivHTML += `