SQL refactoring
This commit is contained in:
parent
b334066f8f
commit
68f767b28d
2 changed files with 34 additions and 102 deletions
|
@ -40,22 +40,26 @@ export const updateStreamer = {
|
|||
// Request-related queries
|
||||
export const getRequests = {
|
||||
name: "getRequests",
|
||||
text: "SELECT * FROM get_requests() LIMIT $1"
|
||||
text: "SELECT * FROM requests_vw \
|
||||
JOIN states ON requests_vw.state = states.state \
|
||||
WHERE active LIMIT $1"
|
||||
}
|
||||
|
||||
export const getRequestsVoted = {
|
||||
name: "getRequestsVoted",
|
||||
text: "SELECT * FROM get_requests_voted($2) LIMIT $1"
|
||||
text: "SELECT * FROM get_requests_voted($2) \
|
||||
JOIN states ON get_requests_voted.state = states.state \
|
||||
WHERE active LIMIT $1"
|
||||
}
|
||||
|
||||
export const getAllRequests = {
|
||||
name: "getAllRequests",
|
||||
text: "SELECT * FROM get_requests_all() LIMIT $1"
|
||||
text: "SELECT * FROM requests_vw() LIMIT $1"
|
||||
}
|
||||
|
||||
export const getAllRequestsVoted = {
|
||||
name: "getAllRequestsVoted",
|
||||
text: "SELECT * FROM get_requests_all_voted($2) LIMIT $1"
|
||||
text: "SELECT * FROM get_requests_voted($2) LIMIT $1"
|
||||
}
|
||||
|
||||
export const checkRequestExists = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue