feat: comprehensive dashboard refactor and performance stabilization
All checks were successful
Build and Deploy / build-and-push (push) Successful in 3m33s

This commit is contained in:
Cauê Faleiros
2026-04-24 14:43:56 -03:00
parent 509ed4a0d9
commit be8f056434
40 changed files with 408 additions and 204 deletions

View File

@@ -993,7 +993,7 @@ apiRouter.get('/search', async (req, res) => {
// 3. Search Organizations (only for super_admin)
if (req.user.role === 'super_admin') {
const [orgs] = await pool.query('SELECT id, name, slug, status FROM tenants WHERE name LIKE ? OR slug LIKE ?', [queryStr, queryStr]);
const [orgs] = await pool.query('SELECT id, name, slug, status FROM tenants WHERE name LIKE ? OR slug LIKE ? LIMIT 5', [queryStr, queryStr]);
results.organizations = orgs;
}
@@ -1013,6 +1013,7 @@ apiRouter.get('/search', async (req, res) => {
attendancesQ += ' AND a.user_id = ?';
attendancesParams.push(req.user.id);
}
attendancesQ += ' LIMIT 10';
const [attendances] = await pool.query(attendancesQ, attendancesParams);
results.attendances = attendances;
@@ -1047,17 +1048,16 @@ apiRouter.get('/attendances', async (req, res) => {
params.push(teamId);
}
if (userId && userId !== 'all') {
if (userId && userId !== 'all') {
// check if it's a slug or id
if (userId.startsWith('u_')) {
q += ' AND a.user_id = ?';
params.push(userId);
if (userId.startsWith('u_') || userId.length === 36) {
q += ' AND a.user_id = ?';
params.push(userId);
} else {
q += ' AND u.slug = ?';
params.push(userId);
}
}
}
} }
if (funnelStage && funnelStage !== 'all') { q += ' AND a.funnel_stage = ?'; params.push(funnelStage); }
if (origin && origin !== 'all') { q += ' AND a.origin = ?'; params.push(origin); }