Revert "Fixed the remaining Manager runtime coupling."
This reverts commit bc45608023.
This commit is contained in:
11 files changed
+17
-161
No files matched your search
@@ -1,20 +1,3 @@
|
||||
/**
|
||||
* Business Auth.js is intentionally unavailable in the standalone Manager
|
||||
* deployment. Keeping this check before the dynamic import prevents a stale
|
||||
* SessionProvider or direct request from initialising Prisma there.
|
||||
*/
|
||||
function managerAuthDisabled() {
|
||||
return process.env.MANAGER_MODE === "true";
|
||||
}
|
||||
import { handlers } from "@/auth";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
||||
const { handlers } = await import("@/auth");
|
||||
return handlers.GET(request);
|
||||
}
|
||||
|
||||
export async function POST(request: Request) {
|
||||
if (managerAuthDisabled()) return new Response(null, { status: 404 });
|
||||
const { handlers } = await import("@/auth");
|
||||
return handlers.POST(request);
|
||||
}
|
||||
export const { GET, POST } = handlers;
|
||||
@@ -1,5 +1,10 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib/db/prisma";
|
||||
import { isInstalledForRequest } from "@/lib/installation/installation-state";
|
||||
import { secretsMatch } from "@/lib/security/secrets-match";
|
||||
import { expireOverdueRewards } from "@/services/loyalty/loyalty.service";
|
||||
import { getEmailProvider, getPushProvider } from "@/services/notifications/providers";
|
||||
import { processDueNotificationDeliveries } from "@/services/notifications/reminder-worker";
|
||||
|
||||
/**
|
||||
* The external trigger point for the background notification processor —
|
||||
@@ -25,8 +30,6 @@ import { secretsMatch } from "@/lib/security/secrets-match";
|
||||
* expected secret.
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
if (process.env.MANAGER_MODE === "true") return NextResponse.json({ error: "Not available on Manager." }, { status: 404 });
|
||||
|
||||
const secret = process.env.CRON_SECRET;
|
||||
if (!secret) {
|
||||
return NextResponse.json({ error: "CRON_SECRET is not configured on this deployment." }, { status: 503 });
|
||||
@@ -41,18 +44,10 @@ export async function POST(request: Request) {
|
||||
// src/lib/installation/installation-state.ts. A 200 with a no-op result
|
||||
// (not an error) so an external scheduler hitting this on a fixed
|
||||
// interval before day-one setup doesn't page anyone.
|
||||
const { isInstalledForRequest } = await import("@/lib/installation/installation-state");
|
||||
if (!(await isInstalledForRequest())) {
|
||||
return NextResponse.json({ skipped: "not_installed" });
|
||||
}
|
||||
|
||||
const [{ prisma }, { expireOverdueRewards }, { getEmailProvider, getPushProvider }, { processDueNotificationDeliveries }] = await Promise.all([
|
||||
import("@/lib/db/prisma"),
|
||||
import("@/services/loyalty/loyalty.service"),
|
||||
import("@/services/notifications/providers"),
|
||||
import("@/services/notifications/reminder-worker"),
|
||||
]);
|
||||
|
||||
const result = await processDueNotificationDeliveries(prisma, {
|
||||
emailProvider: getEmailProvider(),
|
||||
pushProvider: getPushProvider(),
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib/db/prisma";
|
||||
import { isInstalledForRequest } from "@/lib/installation/installation-state";
|
||||
import { secretsMatch } from "@/lib/security/secrets-match";
|
||||
import { syncGoogleReviewsForAllBusinesses } from "@/services/reviews/review-sync.service";
|
||||
|
||||
/**
|
||||
* External trigger for the Google Reviews sync — mirrors
|
||||
@@ -16,8 +19,6 @@ import { secretsMatch } from "@/lib/security/secrets-match";
|
||||
* never duplicates anything.
|
||||
*/
|
||||
export async function POST(request: Request) {
|
||||
if (process.env.MANAGER_MODE === "true") return NextResponse.json({ error: "Not available on Manager." }, { status: 404 });
|
||||
|
||||
const secret = process.env.CRON_SECRET;
|
||||
if (!secret) {
|
||||
return NextResponse.json({ error: "CRON_SECRET is not configured on this deployment." }, { status: 503 });
|
||||
@@ -28,15 +29,10 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ error: "Unauthorized." }, { status: 401 });
|
||||
}
|
||||
|
||||
const { isInstalledForRequest } = await import("@/lib/installation/installation-state");
|
||||
if (!(await isInstalledForRequest())) {
|
||||
return NextResponse.json({ skipped: "not_installed" });
|
||||
}
|
||||
|
||||
const [{ prisma }, { syncGoogleReviewsForAllBusinesses }] = await Promise.all([
|
||||
import("@/lib/db/prisma"),
|
||||
import("@/services/reviews/review-sync.service"),
|
||||
]);
|
||||
const results = await syncGoogleReviewsForAllBusinesses(prisma);
|
||||
return NextResponse.json({ results });
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { prisma } from "@/lib/db/prisma";
|
||||
import { getInstallationState } from "@/lib/installation/installation-state";
|
||||
|
||||
/**
|
||||
* Docker/orchestrator health check — deliberately never requires
|
||||
@@ -9,14 +11,6 @@ import { NextResponse } from "next/server";
|
||||
* trace — just enough for a health probe to act on.
|
||||
*/
|
||||
export async function GET() {
|
||||
if (process.env.MANAGER_MODE === "true") {
|
||||
return NextResponse.json({ status: "healthy", deployment: "manager" });
|
||||
}
|
||||
|
||||
const [{ prisma }, { getInstallationState }] = await Promise.all([
|
||||
import("@/lib/db/prisma"),
|
||||
import("@/lib/installation/installation-state"),
|
||||
]);
|
||||
try {
|
||||
await prisma.$queryRaw`SELECT 1`;
|
||||
} catch {
|
||||
|
||||
+2
-11
@@ -1,6 +1,6 @@
|
||||
import type { Metadata, Viewport } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import { ManagerProviders } from "@/components/manager-providers";
|
||||
import { Providers } from "@/components/providers";
|
||||
import "./globals.css";
|
||||
|
||||
const inter = Inter({
|
||||
@@ -86,17 +86,8 @@ export default function RootLayout({
|
||||
>
|
||||
Skip to main content
|
||||
</a>
|
||||
{process.env.MANAGER_MODE === "true" ? (
|
||||
<ManagerProviders>{children}</ManagerProviders>
|
||||
) : (
|
||||
<BusinessProviders>{children}</BusinessProviders>
|
||||
)}
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
async function BusinessProviders({ children }: { children: React.ReactNode }) {
|
||||
const { Providers } = await import("@/components/providers");
|
||||
return <Providers>{children}</Providers>;
|
||||
}
|
||||
+1
-15
@@ -1,4 +1,5 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
import { getBranding } from "@/lib/business/branding";
|
||||
|
||||
/**
|
||||
* Next.js's manifest file convention — auto-served at /manifest.webmanifest
|
||||
@@ -25,21 +26,6 @@ import type { MetadataRoute } from "next";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function manifest(): Promise<MetadataRoute.Manifest> {
|
||||
if (process.env.MANAGER_MODE === "true") {
|
||||
return {
|
||||
name: "NextChair Manager",
|
||||
short_name: "Manager",
|
||||
description: "Manage NextChair business deployments.",
|
||||
start_url: "/manager",
|
||||
scope: "/",
|
||||
display: "standalone",
|
||||
background_color: "#f4f6f4",
|
||||
theme_color: "#111b15",
|
||||
orientation: "portrait-primary",
|
||||
icons: [{ src: "/icons/icon-192.png", sizes: "192x192", type: "image/png" }],
|
||||
};
|
||||
}
|
||||
const { getBranding } = await import("@/lib/business/branding");
|
||||
const branding = await getBranding();
|
||||
return {
|
||||
name: branding.name,
|
||||
|
||||
Reference in new issue
Block a user