Exclude self_booked/denied/cancelled from professional services list

findByProfessional had no status filter, so blocked slots (self_booked)
and historical cancelled/denied services appeared in the active view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-12 19:54:08 -05:00
co-authored by Claude Sonnet 4.6
parent c720911172
commit 7d481b3451
+1 -1
View File
@@ -195,7 +195,7 @@ export class ServicesService {
async findByProfessional(userId: string, page = 1, limit = 20) {
const prof = await this.prisma.professionals.findUnique({ where: { user_id: userId } });
if (!prof) throw new NotFoundException('No eres un profesional');
const where = { professional_id: prof.id };
const where = { professional_id: prof.id, status: { notIn: ['self_booked', 'denied', 'cancelled'] as const } };
const skip = (page - 1) * limit;
const [data, total] = await Promise.all([
this.prisma.services.findMany({