소스 검색

fix(api): update cintas summary ordering to sort by weekId descending

Changed the ordering of cintas summaries from ascending week to descending weekId in both the existing summary retrieval and newly generated summary endpoints. This ensures the most recent weeks appear first in the response.

Also added import ID display to the cintas calendar summary page for better debugging and tracking purposes.
vtugulan 6 달 전
부모
커밋
7adba1d7a7
2개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      app/api/imports/[id]/summary/route.ts
  2. 3 0
      app/cintas-calendar-summary/page.tsx

+ 2 - 2
app/api/imports/[id]/summary/route.ts

@@ -108,7 +108,7 @@ export async function POST(
             // Return existing summary
             const cintasSummaries = await prisma.cintasSummary.findMany({
                 where: { importId },
-                orderBy: { week: 'asc' }
+                orderBy: { weekId: 'desc' }
             });
 
             return NextResponse.json({
@@ -133,7 +133,7 @@ export async function POST(
         // Fetch the newly generated summary
         const cintasSummaries = await prisma.cintasSummary.findMany({
             where: { importId },
-            orderBy: { week: 'asc' }
+            orderBy: { weekId: 'desc' }
         });
 
         return NextResponse.json({

+ 3 - 0
app/cintas-calendar-summary/page.tsx

@@ -316,6 +316,9 @@ export default function CintasCalendarSummaryPage() {
             </CardHeader>
             <CardContent>
               <div className="space-y-4">
+                <p className="text-sm text-muted-foreground">
+                  Import ID: {importRecord?.id}
+                </p>
                 <Button
                   onClick={handleGenerateSummary}
                   disabled={isProcessing}