ordering
This commit is contained in:
@@ -40,7 +40,7 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button type="button"
|
<div
|
||||||
class="text-left h-full bg-card text-card-foreground flex flex-col gap-2 rounded-xl border shadow-sm max-w-sm overflow-hidden min-w-2xs" onclick={() => {claimCallback(item)}}>
|
class="text-left h-full bg-card text-card-foreground flex flex-col gap-2 rounded-xl border shadow-sm max-w-sm overflow-hidden min-w-2xs" onclick={() => {claimCallback(item)}}>
|
||||||
{#if item.image}
|
{#if item.image}
|
||||||
<img src="https://fbla26.marinodev.com/uploads/{item.id}.jpg" class="object-cover min-h-48 max-h-48"
|
<img src="https://fbla26.marinodev.com/uploads/{item.id}.jpg" class="object-cover min-h-48 max-h-48"
|
||||||
@@ -149,5 +149,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</button>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ export const load: PageServerLoad = async ({ url, locals }) => {
|
|||||||
WHERE im.thread_id = t.id
|
WHERE im.thread_id = t.id
|
||||||
) m ON TRUE
|
) m ON TRUE
|
||||||
${searchQuery ? sql`WHERE word_similarity(${searchQuery}, i.description) > 0.3` : sql``}
|
${searchQuery ? sql`WHERE word_similarity(${searchQuery}, i.description) > 0.3` : sql``}
|
||||||
GROUP BY i.id;
|
GROUP BY i.id
|
||||||
|
ORDER BY t.found_date DESC;
|
||||||
`;
|
`;
|
||||||
items.forEach((item) =>
|
items.forEach((item) =>
|
||||||
item.threads?.forEach((thread) => (thread.createdAt = new Date(thread.createdAt)))
|
item.threads?.forEach((thread) => (thread.createdAt = new Date(thread.createdAt)))
|
||||||
@@ -110,7 +111,7 @@ export const load: PageServerLoad = async ({ url, locals }) => {
|
|||||||
// Not logged in or fallback: simple item list (no threads)
|
// Not logged in or fallback: simple item list (no threads)
|
||||||
let items: Item[];
|
let items: Item[];
|
||||||
if (!searchQuery) {
|
if (!searchQuery) {
|
||||||
items = await sql`SELECT * FROM items;`;
|
items = await sql`SELECT * FROM items ORDER BY found_date DESC;`;
|
||||||
} else {
|
} else {
|
||||||
items = await sql`
|
items = await sql`
|
||||||
SELECT * FROM items
|
SELECT * FROM items
|
||||||
|
|||||||
Reference in New Issue
Block a user