Shows/service: search regex in title AND description

This commit is contained in:
Toast 2025-02-02 18:08:53 +01:00
parent 46232de7f0
commit 7a29130234

View file

@ -34,7 +34,10 @@ export class ShowsService {
async search(name: string) { async search(name: string) {
const regex = new RegExp(name, 'i'); const regex = new RegExp(name, 'i');
return this.showModel.find({ title: { $regex: regex } }); const filter = {
$or: [{ title: { $regex: regex } }, { description: { $regex: regex } }],
};
return this.showModel.find(filter);
} }
async update(id: string, dto: ShowDto): Promise<any> { async update(id: string, dto: ShowDto): Promise<any> {