fix(lint): auto-fix curly brace errors across admin routes
Some checks failed
build-and-release / build (push) Failing after 43s

All 22 ESLint curly errors resolved via eslint --fix.
Files: coupon, department, designation, employees/index,
external-dashboard-management/index, external-roles, index,
pricing, roles/index, support, users/index, test/setup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tracewebstudio Dev 2026-08-13 21:49:08 +02:00
parent 6b8d4894fd
commit 2ea364f73f
12 changed files with 38 additions and 54 deletions

View file

@ -101,9 +101,9 @@ export default function CouponPage() {
let r = coupons(); let r = coupons();
const q = search().toLowerCase(); const q = search().toLowerCase();
if (q) if (q)
r = r.filter( {r = r.filter(
(c) => c.code.toLowerCase().includes(q) || (c.title || "").toLowerCase().includes(q) (c) => c.code.toLowerCase().includes(q) || (c.title || "").toLowerCase().includes(q)
); );}
if (statusFilter() === "active") r = r.filter((c) => c.is_active); if (statusFilter() === "active") r = r.filter((c) => c.is_active);
if (statusFilter() === "inactive") r = r.filter((c) => !c.is_active); if (statusFilter() === "inactive") r = r.filter((c) => !c.is_active);
const sorted = [...r]; const sorted = [...r];

View file

@ -164,9 +164,9 @@ export default function DepartmentManagementPage() {
sorted.sort((a, b) => { sorted.sort((a, b) => {
if (mode === "name_desc") return b.name.localeCompare(a.name); if (mode === "name_desc") return b.name.localeCompare(a.name);
if (mode === "employees_desc") if (mode === "employees_desc")
return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0); {return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0);}
if (mode === "employees_asc") if (mode === "employees_asc")
return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0); {return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0);}
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
}); });
r = sorted; r = sorted;
@ -646,7 +646,7 @@ export default function DepartmentManagementPage() {
} }
); );
if (!res.ok) if (!res.ok)
throw new Error(`Request failed (${res.status})`); {throw new Error(`Request failed (${res.status})`);}
} catch (err: any) { } catch (err: any) {
setError(err?.message || "Failed to update status."); setError(err?.message || "Failed to update status.");
} finally { } finally {

View file

@ -247,9 +247,9 @@ export default function DesignationManagementPage() {
sorted.sort((a, b) => { sorted.sort((a, b) => {
if (mode === "name_desc") return b.name.localeCompare(a.name); if (mode === "name_desc") return b.name.localeCompare(a.name);
if (mode === "employees_desc") if (mode === "employees_desc")
return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0); {return Number(b.totalEmployees || 0) - Number(a.totalEmployees || 0);}
if (mode === "employees_asc") if (mode === "employees_asc")
return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0); {return Number(a.totalEmployees || 0) - Number(b.totalEmployees || 0);}
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
}); });
r = sorted; r = sorted;
@ -801,7 +801,7 @@ export default function DesignationManagementPage() {
} }
); );
if (!res.ok) if (!res.ok)
throw new Error(`Request failed (${res.status})`); {throw new Error(`Request failed (${res.status})`);}
} catch (err: any) { } catch (err: any) {
setError(err?.message || "Failed to update status."); setError(err?.message || "Failed to update status.");
} finally { } finally {

View file

@ -843,7 +843,7 @@ export default function EmployeeManagementPage() {
type="button" type="button"
onClick={async () => { onClick={async () => {
if (!confirm(`Are you sure you want to delete ${row.name}?`)) if (!confirm(`Are you sure you want to delete ${row.name}?`))
return; {return;}
setOpenMenuId(null); setOpenMenuId(null);
try { try {
const accessToken = const accessToken =

View file

@ -278,7 +278,7 @@ function rolePreviewPath(roleKey: string): string {
const key = String(roleKey || "").toUpperCase(); const key = String(roleKey || "").toUpperCase();
if (key.includes("COMPANY")) return "/employers/dashboard"; if (key.includes("COMPANY")) return "/employers/dashboard";
if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER")) if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER"))
return "/users/customer/dashboard"; {return "/users/customer/dashboard";}
if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) return "/users/candidate/dashboard"; if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) return "/users/candidate/dashboard";
if (key.includes("PHOTOGRAPHER")) return "/users/photographer/dashboard"; if (key.includes("PHOTOGRAPHER")) return "/users/photographer/dashboard";
if (key.includes("MAKEUP")) return "/users/makeup/dashboard"; if (key.includes("MAKEUP")) return "/users/makeup/dashboard";
@ -286,7 +286,7 @@ function rolePreviewPath(roleKey: string): string {
if (key.includes("DEVELOPER")) return "/users/developers/dashboard"; if (key.includes("DEVELOPER")) return "/users/developers/dashboard";
if (key.includes("VIDEO")) return "/users/video-editors/dashboard"; if (key.includes("VIDEO")) return "/users/video-editors/dashboard";
if (key.includes("UGC") || (key.includes("CONTENT") && key.includes("CREATOR"))) if (key.includes("UGC") || (key.includes("CONTENT") && key.includes("CREATOR")))
return "/users/ugc-content-creators/dashboard"; {return "/users/ugc-content-creators/dashboard";}
if (key.includes("FITNESS")) return "/users/fitness-trainers/dashboard"; if (key.includes("FITNESS")) return "/users/fitness-trainers/dashboard";
if (key.includes("GRAPHIC")) return "/users/graphic-designers/dashboard"; if (key.includes("GRAPHIC")) return "/users/graphic-designers/dashboard";
if (key.includes("SOCIAL")) return "/users/social-media-managers/dashboard"; if (key.includes("SOCIAL")) return "/users/social-media-managers/dashboard";
@ -432,7 +432,7 @@ export default function ExternalDashboardManagementPage() {
const key = role.key.toUpperCase(); const key = role.key.toUpperCase();
if (key.includes("COMPANY")) map[role.id] = "COMPANY"; if (key.includes("COMPANY")) map[role.id] = "COMPANY";
else if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER")) else if (key.includes("CUSTOMER") || key.includes("SERVICE_SEEKER"))
map[role.id] = "CUSTOMER"; {map[role.id] = "CUSTOMER";}
else if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) map[role.id] = "JOB_SEEKER"; else if (key.includes("JOB_SEEKER") || key.includes("JOBSEEKER")) map[role.id] = "JOB_SEEKER";
else map[role.id] = "PROFESSIONAL"; else map[role.id] = "PROFESSIONAL";
} }
@ -590,9 +590,7 @@ export default function ExternalDashboardManagementPage() {
setRoles( setRoles(
roleRows roleRows
.filter((r: any) => { .filter((r: any) => r?.status === "ACTIVE" || r?.status === "INACTIVE")
return r?.status === "ACTIVE" || r?.status === "INACTIVE";
})
.map((r: any) => ({ .map((r: any) => ({
id: String(r?.id || ""), id: String(r?.id || ""),
key: String(r?.code || r?.key || "").toUpperCase(), key: String(r?.code || r?.key || "").toUpperCase(),

View file

@ -220,18 +220,14 @@ export default function ExternalRoleManagementPage() {
} }
}; };
const getPermission = (moduleKey: string): RolePermission | undefined => { const getPermission = (moduleKey: string): RolePermission | undefined => rolePermissions().find((p) => p.module_key === moduleKey);
return rolePermissions().find((p) => p.module_key === moduleKey);
};
const hasAnyPermission = (moduleKey: string) => { const hasAnyPermission = (moduleKey: string) => {
const p = getPermission(moduleKey); const p = getPermission(moduleKey);
return p && (p.can_view || p.can_list || p.can_create || p.can_update || p.can_delete); return p && (p.can_view || p.can_list || p.can_create || p.can_update || p.can_delete);
}; };
const permissionKeyFor = (moduleKey: string, action: string) => { const permissionKeyFor = (moduleKey: string, action: string) => `${moduleKey}_${action.toLowerCase()}`;
return `${moduleKey}_${action.toLowerCase()}`;
};
const isAllSelectedForAction = (action: PermissionAction) => { const isAllSelectedForAction = (action: PermissionAction) => {
const actionKey = action.toLowerCase(); const actionKey = action.toLowerCase();

View file

@ -283,13 +283,13 @@ export default function AdminHomePage() {
if (key === "chart_leads_trend") { if (key === "chart_leads_trend") {
const data = m?.trend_series; const data = m?.trend_series;
if (data && data.length > 0) if (data && data.length > 0)
return { state: "live", statusLabel: "Live Data", data: { trend_series: data } }; {return { state: "live", statusLabel: "Live Data", data: { trend_series: data } };}
return { state: "empty", statusLabel: "No Data" }; return { state: "empty", statusLabel: "No Data" };
} }
if (key === "chart_revenue_overview") { if (key === "chart_revenue_overview") {
const data = m?.rev_series; const data = m?.rev_series;
if (data && data.length > 0) if (data && data.length > 0)
return { state: "live", statusLabel: "Live Data", data: { rev_series: data } }; {return { state: "live", statusLabel: "Live Data", data: { rev_series: data } };}
return { state: "empty", statusLabel: "No Data" }; return { state: "empty", statusLabel: "No Data" };
} }
const meta = WIDGET_META[key]; const meta = WIDGET_META[key];

View file

@ -272,12 +272,12 @@ export default function PricingPage() {
let r = packages() ?? []; let r = packages() ?? [];
const q = search().toLowerCase(); const q = search().toLowerCase();
if (q) if (q)
r = r.filter( {r = r.filter(
(p) => (p) =>
p.name.toLowerCase().includes(q) || p.name.toLowerCase().includes(q) ||
p.package_type.toLowerCase().includes(q) || p.package_type.toLowerCase().includes(q) ||
(p.applicable_roles ?? []).some((rl) => rl.toLowerCase().includes(q)), (p.applicable_roles ?? []).some((rl) => rl.toLowerCase().includes(q)),
); );}
if (typeFilter() !== 'all') r = r.filter((p) => p.package_type === typeFilter()); if (typeFilter() !== 'all') r = r.filter((p) => p.package_type === typeFilter());
if (statusFilter() === 'active') r = r.filter((p) => p.is_active); if (statusFilter() === 'active') r = r.filter((p) => p.is_active);
if (statusFilter() === 'inactive') r = r.filter((p) => !p.is_active); if (statusFilter() === 'inactive') r = r.filter((p) => !p.is_active);
@ -411,9 +411,7 @@ export default function PricingPage() {
}); });
}; };
const getTypeLabel = (type: string) => { const getTypeLabel = (type: string) => PACKAGE_TYPES.find((t) => t.value === type)?.label || type;
return PACKAGE_TYPES.find((t) => t.value === type)?.label || type;
};
return ( return (
<div class="w-full space-y-6 pb-8"> <div class="w-full space-y-6 pb-8">

View file

@ -281,9 +281,9 @@ export default function RoleManagementPage() {
sorted.sort((a, b) => { sorted.sort((a, b) => {
if (sortBy() === "name_desc") return b.name.localeCompare(a.name); if (sortBy() === "name_desc") return b.name.localeCompare(a.name);
if (sortBy() === "users_desc") if (sortBy() === "users_desc")
return Number(b.usersAssigned || 0) - Number(a.usersAssigned || 0); {return Number(b.usersAssigned || 0) - Number(a.usersAssigned || 0);}
if (sortBy() === "users_asc") if (sortBy() === "users_asc")
return Number(a.usersAssigned || 0) - Number(b.usersAssigned || 0); {return Number(a.usersAssigned || 0) - Number(b.usersAssigned || 0);}
return a.name.localeCompare(b.name); return a.name.localeCompare(b.name);
}); });
return sorted; return sorted;

View file

@ -182,9 +182,9 @@ export default function SupportPage() {
const sorted = [...all]; const sorted = [...all];
sorted.sort((a, b) => { sorted.sort((a, b) => {
if (sortBy() === "oldest") if (sortBy() === "oldest")
return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime(); {return new Date(a.createdAt || 0).getTime() - new Date(b.createdAt || 0).getTime();}
if (sortBy() === "priority") if (sortBy() === "priority")
return (priorityRank[b.priority] || 0) - (priorityRank[a.priority] || 0); {return (priorityRank[b.priority] || 0) - (priorityRank[a.priority] || 0);}
return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime(); return new Date(b.createdAt || 0).getTime() - new Date(a.createdAt || 0).getTime();
}); });
return sorted; return sorted;

View file

@ -193,20 +193,20 @@ export default function UsersManagementPage() {
if (listTab() === "no_role") list = list.filter((u) => u.registeredRoles.length === 0); if (listTab() === "no_role") list = list.filter((u) => u.registeredRoles.length === 0);
if (listTab() === "registered") list = list.filter((u) => u.registeredRoles.length > 0); if (listTab() === "registered") list = list.filter((u) => u.registeredRoles.length > 0);
if (listTab() === "pending") if (listTab() === "pending")
list = list.filter( {list = list.filter(
(u) => (u) =>
u.registeredRoles.some((r) => r.status === "PENDING") || u.registeredRoles.some((r) => r.status === "PENDING") ||
u.verificationStatus === "PENDING" || u.verificationStatus === "PENDING" ||
u.verificationStatus === "IN_REVIEW" u.verificationStatus === "IN_REVIEW"
); );}
if (listTab() === "approved") list = list.filter((u) => u.verificationStatus === "VERIFIED"); if (listTab() === "approved") list = list.filter((u) => u.verificationStatus === "VERIFIED");
if (listTab() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED"); if (listTab() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED");
if (statusFilter() === "active") list = list.filter((u) => u.accountStatus === "ACTIVE"); if (statusFilter() === "active") list = list.filter((u) => u.accountStatus === "ACTIVE");
if (statusFilter() === "pending") if (statusFilter() === "pending")
list = list.filter( {list = list.filter(
(u) => u.verificationStatus === "PENDING" || u.verificationStatus === "IN_REVIEW" (u) => u.verificationStatus === "PENDING" || u.verificationStatus === "IN_REVIEW"
); );}
if (statusFilter() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED"); if (statusFilter() === "suspended") list = list.filter((u) => u.accountStatus === "SUSPENDED");
if (statusFilter() === "blocked") list = list.filter((u) => u.accountStatus === "BLOCKED"); if (statusFilter() === "blocked") list = list.filter((u) => u.accountStatus === "BLOCKED");
@ -290,7 +290,7 @@ export default function UsersManagementPage() {
prev.map((r) => (r.id === user.id ? { ...r, accountStatus: nextStatus as any } : r)) prev.map((r) => (r.id === user.id ? { ...r, accountStatus: nextStatus as any } : r))
); );
if (selectedUser()?.id === user.id) if (selectedUser()?.id === user.id)
setSelectedUser({ ...user, accountStatus: nextStatus as any }); {setSelectedUser({ ...user, accountStatus: nextStatus as any });}
try { try {
const r = await fetch(`/api/admin/users/${user.id}/status`, { const r = await fetch(`/api/admin/users/${user.id}/status`, {
@ -310,7 +310,7 @@ export default function UsersManagementPage() {
prev.map((r) => (r.id === user.id ? { ...r, accountStatus: previousStatus } : r)) prev.map((r) => (r.id === user.id ? { ...r, accountStatus: previousStatus } : r))
); );
if (selectedUser()?.id === user.id) if (selectedUser()?.id === user.id)
setSelectedUser({ ...user, accountStatus: previousStatus }); {setSelectedUser({ ...user, accountStatus: previousStatus });}
setActionError(`Failed to update status for ${user.name}. Please try again.`); setActionError(`Failed to update status for ${user.name}. Please try again.`);
} }
}; };

View file

@ -5,26 +5,18 @@ import { http, HttpResponse } from 'msw';
// Mock API responses globally for frontend tests // Mock API responses globally for frontend tests
const server = setupServer( const server = setupServer(
http.get('/api/admin/companies', () => { http.get('/api/admin/companies', () => HttpResponse.json([
return HttpResponse.json([
{ id: '1', company_name: 'Test Co', status: 'ACTIVE' } { id: '1', company_name: 'Test Co', status: 'ACTIVE' }
]); ])),
}), http.get('/api/admin/users', () => HttpResponse.json([
http.get('/api/admin/users', () => {
return HttpResponse.json([
{ id: '1', full_name: 'Admin User', email: 'admin@example.com', status: 'ACTIVE' } { id: '1', full_name: 'Admin User', email: 'admin@example.com', status: 'ACTIVE' }
]); ])),
}), http.get('/api/admin/jobs', () => HttpResponse.json([
http.get('/api/admin/jobs', () => {
return HttpResponse.json([
{ id: '1', title: 'Developer', status: 'OPEN' } { id: '1', title: 'Developer', status: 'OPEN' }
]); ])),
}), http.get('/api/admin/leads', () => HttpResponse.json([
http.get('/api/admin/leads', () => {
return HttpResponse.json([
{ id: '1', title: 'Need a developer', status: 'PENDING' } { id: '1', title: 'Need a developer', status: 'PENDING' }
]); ]))
})
); );
beforeAll(() => server.listen()); beforeAll(() => server.listen());