feat: comprehensive dashboard refactor and performance stabilization
All checks were successful
Build and Deploy / build-and-push (push) Successful in 3m33s
All checks were successful
Build and Deploy / build-and-push (push) Successful in 3m33s
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user