refactor: remove unused attendee detail components and provider

This commit is contained in:
Jose Selesan
2026-09-30 13:37:42 -03:00
parent 27bff32e76
commit 4e86096653
30 changed files with 1710 additions and 475 deletions

View File

@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, mock, vi } from 'bun:test';
import { RECENT_ATTENDANCE_LIMIT } from '@gruperly/shared';
import { Hono } from 'hono';
const db = {
@@ -463,6 +464,8 @@ describe('attendee incorporation & invite-token in groups', () => {
notes: null,
createdAt: new Date('2026-09-18T10:00:00.000Z'),
updatedAt: new Date('2026-09-18T10:00:00.000Z'),
attendances: [],
payments: [],
},
] as never);
prisma.attendee.count.mockResolvedValue(1);
@@ -474,11 +477,28 @@ describe('attendee incorporation & invite-token in groups', () => {
const data = await res.json();
expect(data.data.length).toBe(1);
expect(data.data[0].fullName).toBe('Ana García');
expect(data.data[0].recentAttendance).toEqual([]);
expect(data.data[0].payment).toBeNull();
expect(prisma.attendee.findMany).toHaveBeenCalledWith({
where: { groupId: 'group-1' },
skip: 0,
take: 10,
orderBy: { createdAt: 'desc' },
// El resumen de la fila se pide en la misma consulta: una petición por
// miembro sería N+1 sobre un listado de hasta 100.
include: {
attendances: {
orderBy: { classSession: { startsAt: 'desc' } },
take: RECENT_ATTENDANCE_LIMIT,
select: { status: true },
},
payments: {
where: { status: { not: 'CANCELLED' } },
orderBy: { dueDate: 'desc' },
take: 3,
select: { status: true, dueDate: true },
},
},
});
});
});