From e39bd909119433899b225c3a95ae854ab6483670 Mon Sep 17 00:00:00 2001 From: Cory Dransfeldt Date: Tue, 26 Nov 2024 09:19:07 -0800 Subject: [PATCH] fix: consistent sorting in optimized views --- package-lock.json | 8 ++++---- queries/views/content/posts.psql | 8 ++++---- queries/views/media/books.psql | 14 +++++++++----- queries/views/media/music/artists.psql | 2 +- queries/views/media/music/genres.psql | 3 ++- queries/views/media/shows.psql | 4 ++-- src/utils/data/static/sitemapData.json | 6 +++--- 7 files changed, 25 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5a024d0..5d7763d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7936,16 +7936,16 @@ } }, "node_modules/vitefu": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.3.tgz", - "integrity": "sha512-iKKfOMBHob2WxEJbqbJjHAkmYgvFDPhuqrO82om83S8RLk+17FtyMBfcyeH8GqD0ihShtkMW/zzJgiA51hCNCQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.4.tgz", + "integrity": "sha512-y6zEE3PQf6uu/Mt6DTJ9ih+kyJLr4XcSgHR2zUkM8SWDhuixEJxfJ6CZGMHh1Ec3vPLoEA0IHU5oWzVqw8ulow==", "license": "MIT", "workspaces": [ "tests/deps/*", "tests/projects/*" ], "peerDependencies": { - "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0-beta.0" + "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" }, "peerDependenciesMeta": { "vite": { diff --git a/queries/views/content/posts.psql b/queries/views/content/posts.psql index 8be324c..5d3ab1f 100644 --- a/queries/views/content/posts.psql +++ b/queries/views/content/posts.psql @@ -70,7 +70,7 @@ WHERE pt.posts_id = p.id) AS tags, ( SELECT - json_agg(json_build_object('name', g.name, 'url', g.slug)) + json_agg(json_build_object('name', g.name, 'url', g.slug) ORDER BY g.name ASC) FROM posts_genres gp LEFT JOIN genres g ON gp.genres_id = g.id @@ -78,7 +78,7 @@ WHERE gp.posts_id = p.id) AS genres, ( SELECT - json_agg(json_build_object('name', a.name_string, 'url', a.slug, 'country', a.country, 'total_plays', a.total_plays)) + json_agg(json_build_object('name', a.name_string, 'url', a.slug, 'country', a.country, 'total_plays', a.total_plays) ORDER BY a.name_string ASC) FROM posts_artists pa LEFT JOIN artists a ON pa.artists_id = a.id @@ -87,7 +87,7 @@ WHERE ( SELECT json_agg(json_build_object('title', b.title, 'author', b.author, 'url', b.slug) - ORDER BY b.title) + ORDER BY b.title ASC) FROM posts_books pbk LEFT JOIN books b ON pbk.books_id = b.id @@ -104,7 +104,7 @@ WHERE pm.posts_id = p.id) AS movies, ( SELECT - json_agg(json_build_object('title', s.title, 'year', s.year, 'url', s.slug)) + json_agg(json_build_object('title', s.title, 'year', s.year, 'url', s.slug) ORDER BY s.year DESC) FROM posts_shows ps LEFT JOIN shows s ON ps.shows_id = s.id diff --git a/queries/views/media/books.psql b/queries/views/media/books.psql index cf2c396..42fca89 100644 --- a/queries/views/media/books.psql +++ b/queries/views/media/books.psql @@ -23,7 +23,8 @@ SELECT bt.books_id = b.id) AS tags, ( SELECT - json_agg(json_build_object('name', a.name_string, 'url', a.slug, 'country', a.country, 'total_plays', a.total_plays)) + json_agg(json_build_object('name', a.name_string, 'url', a.slug, 'country', a.country, 'total_plays', a.total_plays) + ORDER BY a.name_string ASC) FROM books_artists ba LEFT JOIN artists a ON ba.artists_id = a.id @@ -31,7 +32,8 @@ WHERE ba.books_id = b.id) AS artists, ( SELECT - json_agg(json_build_object('title', m.title, 'year', m.year, 'url', m.slug)) + json_agg(json_build_object('title', m.title, 'year', m.year, 'url', m.slug) + ORDER BY m.year DESC) FROM movies_books mb LEFT JOIN movies m ON mb.movies_id = m.id @@ -39,7 +41,8 @@ WHERE mb.books_id = b.id) AS movies, ( SELECT - json_agg(json_build_object('name', g.name, 'url', g.slug)) + json_agg(json_build_object('name', g.name, 'url', g.slug) + ORDER BY g.name ASC) FROM genres_books gb LEFT JOIN genres g ON gb.genres_id = g.id @@ -47,7 +50,8 @@ WHERE gb.books_id = b.id) AS genres, ( SELECT - json_agg(json_build_object('title', s.title, 'year', s.year, 'url', s.slug)) + json_agg(json_build_object('title', s.title, 'year', s.year, 'url', s.slug) + ORDER BY s.year DESC) FROM shows_books sb LEFT JOIN shows s ON sb.shows_id = s.id @@ -65,7 +69,7 @@ WHERE ( SELECT json_agg(json_build_object('title', rb.title, 'author', rb.author, 'url', rb.slug) - ORDER BY rb.title) + ORDER BY rb.title DESC) FROM related_books rbk LEFT JOIN books rb ON rbk.related_books_id = rb.id diff --git a/queries/views/media/music/artists.psql b/queries/views/media/music/artists.psql index 64b45c5..0f1c6a6 100644 --- a/queries/views/media/music/artists.psql +++ b/queries/views/media/music/artists.psql @@ -39,7 +39,7 @@ SELECT ( SELECT json_agg(json_build_object('title', b.title, 'author', b.author, 'url', b.slug) - ORDER BY b.date_finished DESC) + ORDER BY b.title ASC) FROM books_artists ba LEFT JOIN books b ON ba.books_id = b.id diff --git a/queries/views/media/music/genres.psql b/queries/views/media/music/genres.psql index e841dd3..6503982 100644 --- a/queries/views/media/music/genres.psql +++ b/queries/views/media/music/genres.psql @@ -18,7 +18,8 @@ SELECT a.genres = g.id) AS artists, ( SELECT - json_agg(json_build_object('title', b.title, 'author', b.author, 'url', b.slug)) + json_agg(json_build_object('title', b.title, 'author', b.author, 'url', b.slug) + ORDER BY b.title ASC) FROM books b JOIN genres_books gb ON gb.books_id = b.id diff --git a/queries/views/media/shows.psql b/queries/views/media/shows.psql index b71c550..4af4a97 100644 --- a/queries/views/media/shows.psql +++ b/queries/views/media/shows.psql @@ -38,7 +38,7 @@ SELECT ( SELECT json_agg(json_build_object('title', b.title, 'author', b.author, 'url', b.slug) - ORDER BY b.title) + ORDER BY b.title ASC) FROM shows_books sb LEFT JOIN books b ON sb.books_id = b.id @@ -73,7 +73,7 @@ SELECT ( SELECT json_agg(json_build_object('name', a.name_string, 'url', a.slug, 'country', a.country, 'total_plays', a.total_plays) - ORDER BY a.name_string) + ORDER BY a.name_string ASC) FROM shows_artists sa LEFT JOIN artists a ON sa.artists_id = a.id diff --git a/src/utils/data/static/sitemapData.json b/src/utils/data/static/sitemapData.json index 075d6e3..54133da 100644 --- a/src/utils/data/static/sitemapData.json +++ b/src/utils/data/static/sitemapData.json @@ -3158,9 +3158,6 @@ { "loc": "https://coryd.dev/watching/movies/246741" }, - { - "loc": "https://coryd.dev/watching/movies/744857" - }, { "loc": "https://coryd.dev/watching/movies/22798" }, @@ -3182,6 +3179,9 @@ { "loc": "https://coryd.dev/watching/movies/22488" }, + { + "loc": "https://coryd.dev/watching/movies/744857" + }, { "loc": "https://coryd.dev/watching/movies/1216191" },