feat: add manual backfill button to admin

This commit is contained in:
2026-04-23 10:40:53 -04:00
parent 46984adda4
commit 02384022ab
2 changed files with 22 additions and 1 deletions
+21 -1
View File
@@ -121,6 +121,17 @@ export default function AdminPage() {
}
};
const backfillUser = async (userId: string) => {
toast.info("Scouring the barn for old eggs...");
try {
await adminApi.backfillUser(userId);
toast.success("Backfill complete!");
loadData();
} catch {
toast.error("Backfill failed");
}
};
const toggleAdmin = async (userId: string, isAdmin: boolean) => {
try {
await api.patch(`/admin/users/${userId}`, { isAdmin });
@@ -263,6 +274,15 @@ export default function AdminPage() {
</Button>
</div>
<Button
size="sm"
variant="outline"
className="h-10 rounded-full font-black border-2 border-foreground"
onClick={() => backfillUser(u.id)}
>
BACKFILL
</Button>
<div className="h-10 w-px bg-foreground/10 mx-1 hidden sm:block" />
<Button
@@ -426,7 +446,7 @@ export default function AdminPage() {
</div>
<div className="rounded-3xl border-4 border-foreground bg-card p-6 shadow-[6px_6px_0px_0px_rgba(0,0,0,1)]">
<div className="text-xs font-black uppercase tracking-widest text-muted-foreground mb-2 flex items-center gap-2">
<TrendingUp className="h-4 w-4" /> Requests
<TrendingUp className="h-3 w-3" /> Requests
</div>
<div className="text-4xl font-black">
{analytics?.requests.total || 0}
+1
View File
@@ -93,6 +93,7 @@ export const adminApi = {
getAllTransactions: (page = 1, limit = 50) =>
api.get(`/transactions/admin/all?page=${page}&limit=${limit}`),
getSystemStats: () => api.get("/transactions/admin/stats"),
backfillUser: (userId: string) => api.post(`/admin/users/${userId}/backfill`),
};
// Overseer API