Skip to content

Commit

Permalink
Filter out memes without text
Browse files Browse the repository at this point in the history
  • Loading branch information
sepal committed Nov 8, 2023
1 parent 5b31b01 commit a7cef55
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 2 deletions.
120 changes: 120 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/app/meme/[memeId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function EditMeme({
const { memeId } = params;
const meme = await getMeme(memeId);

if (!meme?.file?.url) {
if (!meme?.file?.url || !meme?.text) {
notFound();
}

Expand Down
10 changes: 9 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ export default async function Home({

const xata = getXataClient();
const memes = await xata.db.Memes.filter({
$exists: "file",
$all: [
{ $exists: "file" },
{ $exists: "text" },
{
$not: {
text: "",
},
},
],
})
.sort("xata.updatedAt", "desc")
.getPaginated({
Expand Down

0 comments on commit a7cef55

Please sign in to comment.