Forráskód Böngészése

Ensuring cintas prior imports are only cintas install calendar layout.

vtugulan 1 hónapja
szülő
commit
26678d036a

+ 14 - 6
app/actions/imports.ts

@@ -48,14 +48,22 @@ export async function createImport(data: {
 }
 
 // Get all imports for the current user
-export async function getImports(userId?: string) {
+export async function getImports(userId?: string, layoutId?: number) {
   try {
+    const whereClause: any = {};
+
+    if (userId) {
+      whereClause.fileId = {
+        not: null,
+      };
+    }
+
+    if (typeof layoutId === 'number') {
+      whereClause.layoutId = layoutId;
+    }
+
     const imports = await prisma.import.findMany({
-      where: userId ? {
-        fileId: {
-          not: null,
-        },
-      } : {},
+      where: whereClause,
       include: {
         layout: true,
       },

+ 1 - 1
app/cintas-calendar-summary/page.tsx

@@ -67,7 +67,7 @@ export default function CintasCalendarSummaryPage() {
         return;
       }
 
-      const result = await getImports(user.id);
+      const result = await getImports(user.id, 2);
       if (result.success && result.data) {
         // Map the data to match our ImportRecord interface
         const mappedData = result.data.map((item: any) => ({

+ 3 - 0
app/components/layout-configurations/LayoutConfigurationDetail.tsx

@@ -81,6 +81,9 @@ export function LayoutConfigurationDetail({ configuration }: LayoutConfiguration
         </CardHeader>
         <CardContent>
           <div className="grid gap-4">
+            <div>
+              <span className="font-medium">ID:</span> {configuration.id}
+            </div>
             <div>
               <span className="font-medium">Name:</span> {configuration.name}
             </div>