fix: consistent sorting in optimized views

This commit is contained in:
Cory Dransfeldt 2024-11-26 09:19:07 -08:00
parent 1bdb4da519
commit e39bd90911
No known key found for this signature in database
7 changed files with 25 additions and 20 deletions

8
package-lock.json generated
View file

@ -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": {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"
},