fix: news frontend

This commit is contained in:
DecDuck
2025-03-10 12:05:10 +11:00
parent b6f52f660a
commit 1eede0f035
7 changed files with 53 additions and 62 deletions

View File

@ -45,23 +45,27 @@ class NewsManager {
return await prisma.article.findMany({
where: {
AND: [
{
tags: {
some: { OR: options.tags?.map((e) => ({ name: e })) ?? [] },
},
},
{
title: {
search: options.search
},
description: {
search: options.search
},
content: {
search: options.search
}
}
],
options.tags
? {
tags: {
some: { OR: options.tags?.map((e) => ({ name: e })) ?? [] },
},
}
: undefined,
options.search
? {
title: {
search: options.search,
},
description: {
search: options.search,
},
content: {
search: options.search,
},
}
: undefined,
].filter((e) => e !== undefined),
},
take: options?.take || 10,
skip: options?.skip || 0,
@ -75,6 +79,7 @@ class NewsManager {
displayName: true,
},
},
tags: true,
},
});
}
@ -89,6 +94,7 @@ class NewsManager {
displayName: true,
},
},
tags: true,
},
});
}