Fix queries not working

This commit is contained in:
Geometrically
2021-01-25 13:00:04 -07:00
parent 140a8b6804
commit fcd548c313
3 changed files with 475 additions and 292 deletions

View File

@@ -420,7 +420,7 @@ impl Mod {
INNER JOIN side_types cs ON m.client_side = cs.id
INNER JOIN side_types ss ON m.server_side = ss.id
INNER JOIN licenses l ON m.license = l.id
WHERE m.id IN (SELECT * FROM UNNEST($1::bigint[]))
WHERE m.id = $1
GROUP BY m.id, s.id, cs.id, ss.id, l.id;
",
id as ModId,
@@ -506,13 +506,14 @@ impl Mod {
m.issues_url issues_url, m.source_url source_url, m.wiki_url wiki_url, m.discord_url discord_url, m.license_url license_url,
m.team_id team_id, m.client_side client_side, m.server_side server_side, m.license license, m.slug slug,
s.status status_name, cs.name client_side_type, ss.name server_side_type, l.short short, l.name license_name,
ARRAY_AGG( DISTINCT c.category) categories, ARRAY_AGG(DISTINCT v.id) versions, ARRAY_AGG(DISTINCT md.joining_platform_id || ', ' || md.url || ', ' || dp.short || ', ' || dp.name) donations
ARRAY_AGG( DISTINCT c.category) categories, ARRAY_AGG(DISTINCT v.id) versions,
ARRAY_AGG( DISTINCT md.joining_platform_id || ', ' || md.url || ', ' || dp.short || ', ' || dp.name) donations
FROM mods m
INNER JOIN mods_categories mc ON joining_mod_id = m.id
INNER JOIN categories c ON mc.joining_category_id = c.id
INNER JOIN versions v ON v.mod_id = m.id
INNER JOIN mods_donations md ON md.joining_mod_id = m.id
INNER JOIN donation_platforms dp ON md.joining_platform_id = dp.id
LEFT OUTER JOIN mods_donations md ON md.joining_mod_id = m.id
LEFT OUTER JOIN donation_platforms dp ON md.joining_platform_id = dp.id
INNER JOIN statuses s ON s.id = m.status
INNER JOIN side_types cs ON m.client_side = cs.id
INNER JOIN side_types ss ON m.server_side = ss.id

View File

@@ -557,7 +557,7 @@ impl Version {
rc.channel release_channel, v.featured featured,
ARRAY_AGG(gv.version ORDER BY gv.created) game_versions, ARRAY_AGG(DISTINCT l.loader) loaders,
ARRAY_AGG(DISTINCT f.id || ', ' || f.filename || ', ' || f.is_primary || ', ' || f.url) files,
ARRAY_AGG(DISTINCT h.hash || ', ' || h.algorithm || ', ' || h.file_id) hashes
ARRAY_AGG(DISTINCT h.algorithm || ', ' || encode(h.hash, 'escape') || ', ' || h.file_id) hashes
FROM versions v
INNER JOIN release_channels rc on v.release_channel = rc.id
INNER JOIN game_versions_versions gvv on v.id = gvv.joining_version_id
@@ -578,7 +578,7 @@ impl Version {
v.hashes.unwrap_or(vec![]).into_iter().for_each(|f| {
let hash : Vec<&str> = f.split(", ").collect();
hashes.push((FileId(hash[2].parse().unwrap_or(0)), hash[1].to_string(), hash[0].to_string().into_bytes()));
hashes.push((FileId(hash[2].parse().unwrap_or(0)), hash[0].to_string(), hash[1].to_string().into_bytes()));
});
QueryVersion {