Update 10 files

This commit is contained in:
[dyad] committed 2026-08-02 12:33:19 +02:00
1 parent 28a3c6121a
commit 28680e396e
10 files changed
+46 -108

No files matched your search

@@ -8,16 +8,16 @@ import { checkModuleAccess } from "@/lib/compliance";
export async function GET(req: NextRequest) {
try {
const schoolId = req.nextUrl.searchParams.get("schoolId");
const module = req.nextUrl.searchParams.get("module");
const moduleName = req.nextUrl.searchParams.get("module");
if (!schoolId || !module) {
if (!schoolId || !moduleName) {
return NextResponse.json(
{ error: "Missing schoolId or module parameter" },
{ status: 400 }
);
}
const result = await checkModuleAccess(schoolId, module);
const result = await checkModuleAccess(schoolId, moduleName);
return NextResponse.json(result);
} catch (error) {
+2 -2
View File
@@ -6,8 +6,8 @@
@theme inline {
--color-background: var(--background);
--color-foreground: var(--foreground);
--font-sans: var(--font-geist-sans);
--font-mono: var(--font-geist-mono);
--font-sans: Arial, Helvetica, sans-serif;
--font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
--color-sidebar-ring: var(--sidebar-ring);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
+1 -14
View File
@@ -1,19 +1,8 @@
import type { Metadata, Viewport } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";
import { ThemeProvider } from "next-themes";
import { Toaster } from "@/components/ui/sonner";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "SchulOS — Free Competency & Grading Platform",
description: "Open-Source School Software for Competency-Based Assessment and Grading. Built with Next.js, TypeScript, and shadcn/ui.",
@@ -48,9 +37,7 @@ export default function RootLayout({
<head>
<link rel="apple-touch-icon" href="/icon-192.png" />
</head>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased bg-background text-foreground`}
>
<body className="antialiased bg-background text-foreground">
<ThemeProvider
attribute="class"
defaultTheme="light"
+3 -1
View File
@@ -107,7 +107,9 @@ export const serverError = (error: Error | string, path?: string) => {
/**
* Wrap handler with automatic error handling
*/
export const withErrorHandling = (handler: Function) => {
export const withErrorHandling = (
handler: (...args: any[]) => any
) => {
return async (...args: any[]) => {
try {
return await handler(...args);
+10 -16
View File
@@ -145,23 +145,17 @@ export function useApiQueries<T = any>(
queries: Array<{ url: string | null; key?: string }>,
options?: SWRConfiguration
) {
const results = queries.map((query) => {
const { data, error, isLoading, mutate } = useApiGet(query.url, options);
return {
key: query.key || query.url,
data,
error,
isLoading,
mutate,
};
});
const activeQueries = queries.filter((query) => query.url);
const cacheKey = activeQueries.map((query) => query.url).join("|") || null;
const { data: values, error, isLoading } = useSWR<T[]>(
cacheKey,
() => Promise.all(activeQueries.map((query) => apiFetcher(query.url!))),
options
);
const isLoading = results.some((r) => r.isLoading);
const error = results.find((r) => r.error);
const data = Object.fromEntries(results.map((r) => [r.key, r.data])) as Record<
string,
T | undefined
>;
const data = Object.fromEntries(
activeQueries.map((query, index) => [query.key || query.url, values?.[index]])
) as Record<string, T | undefined>;
return { data, error, isLoading };
}