feat(admin-portal): cut babyboo portal down to Co-Lite login, users and roles
Removes every other screen, API route, component, test and the dependencies only they used. Cookie colite_admin, Co-Lite branding, BO_USERS/BO_ROLES modules only. The user form no longer loads branches, events or country scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
a8cdf33a24
commit
1071ddaa2a
1304 files changed
+216
-162492
No files matched your search
@@ -1,31 +0,0 @@
|
||||
import { describe, expect, it, vi, beforeEach } from "vitest";
|
||||
import { GET } from "./route";
|
||||
|
||||
vi.mock("@/app/lib/server/session", () => ({ getToken: vi.fn() }));
|
||||
vi.mock("@/app/lib/server/mobileApi", () => ({ callMobileApi: vi.fn() }));
|
||||
|
||||
import { getToken } from "@/app/lib/server/session";
|
||||
import { callMobileApi } from "@/app/lib/server/mobileApi";
|
||||
|
||||
describe("GET /api/notifications/unread-count", () => {
|
||||
beforeEach(() => vi.resetAllMocks());
|
||||
|
||||
it("returns 401 when there is no session", async () => {
|
||||
(getToken as ReturnType<typeof vi.fn>).mockResolvedValue(null);
|
||||
const res = await GET();
|
||||
expect(res.status).toBe(401);
|
||||
});
|
||||
|
||||
it("forwards the admin JWT to mobile-api and returns the count", async () => {
|
||||
(getToken as ReturnType<typeof vi.fn>).mockResolvedValue("jwt-token");
|
||||
(callMobileApi as ReturnType<typeof vi.fn>).mockResolvedValue({ ok: true, data: { count: 4 } });
|
||||
|
||||
const res = await GET();
|
||||
|
||||
expect(callMobileApi).toHaveBeenCalledWith("/api/admin/notifications/unread-count", {
|
||||
token: "jwt-token",
|
||||
});
|
||||
expect(res.status).toBe(200);
|
||||
expect(await res.json()).toEqual({ count: 4 });
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { callMobileApi } from "@/app/lib/server/mobileApi";
|
||||
import { getToken } from "@/app/lib/server/session";
|
||||
import { errorResponse, unauthorized } from "@/app/lib/server/apiRoute";
|
||||
|
||||
// GET -> /api/admin/notifications/unread-count. Forwards the admin JWT from the
|
||||
// bb_admin session cookie (Spec B §7.1).
|
||||
|
||||
export async function GET() {
|
||||
const token = await getToken();
|
||||
if (!token) return unauthorized();
|
||||
|
||||
const result = await callMobileApi<{ count: number }>("/api/admin/notifications/unread-count", { token });
|
||||
if (!result.ok) return errorResponse(result);
|
||||
return NextResponse.json(result.data);
|
||||
}
|
||||
Reference in new issue
Block a user