Filtros Dinâmicos (Prisma)
async findAll(authorId?: number, date?: string) {
return this.prisma.post.findMany({
where: {
authorId: authorId ? Number(authorId) : undefined,
publishedAt: date
? { gte: new Date(date), lt: new Date(`${date}T23:59:59`) }
: undefined,
},
include: { author: true },
});
}