File tree Expand file tree Collapse file tree 4 files changed +200
-126
lines changed
Expand file tree Collapse file tree 4 files changed +200
-126
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { adminDb } from "@/lib/firebase-admin";
22
33export async function GET (
44 request : Request ,
5- { params } : { params : Promise < { id : string } > }
5+ { params } : { params : Promise < { id : string } > } ,
66) {
77 try {
88 const { id } = await params ;
@@ -24,7 +24,7 @@ export async function GET(
2424 if ( ! cacheDoc . exists ) {
2525 return Response . json (
2626 { error : "Report not found" , id : id . toLowerCase ( ) } ,
27- { status : 404 }
27+ { status : 404 } ,
2828 ) ;
2929 }
3030
@@ -42,7 +42,7 @@ export async function GET(
4242 error : "Internal server error" ,
4343 details : error instanceof Error ? error . message : "Unknown error" ,
4444 } ,
45- { status : 500 }
45+ { status : 500 } ,
4646 ) ;
4747 }
4848}
Original file line number Diff line number Diff line change @@ -8,17 +8,20 @@ export async function POST(request: Request) {
88 if ( ! userId || ! entityName ) {
99 return Response . json (
1010 { error : "userId and entityName are required" } ,
11- { status : 400 }
11+ { status : 400 } ,
1212 ) ;
1313 }
1414
1515 // Get the cached report from the cache collection
16- const cacheDoc = await adminDb . collection ( "cache" ) . doc ( entityName . toLowerCase ( ) ) . get ( ) ;
16+ const cacheDoc = await adminDb
17+ . collection ( "cache" )
18+ . doc ( entityName . toLowerCase ( ) )
19+ . get ( ) ;
1720
1821 if ( ! cacheDoc . exists ) {
1922 return Response . json (
2023 { error : "Report not found in cache" } ,
21- { status : 404 }
24+ { status : 404 } ,
2225 ) ;
2326 }
2427
@@ -37,7 +40,7 @@ export async function POST(request: Request) {
3740 vendor : cacheData ?. report ?. vendor || null ,
3841 } ) ,
3942 } ,
40- { merge : true }
43+ { merge : true } ,
4144 ) ;
4245
4346 return Response . json ( {
@@ -51,7 +54,7 @@ export async function POST(request: Request) {
5154 error : "Internal server error" ,
5255 details : error instanceof Error ? error . message : "Unknown error" ,
5356 } ,
54- { status : 500 }
57+ { status : 500 } ,
5558 ) ;
5659 }
5760}
@@ -94,7 +97,7 @@ export async function GET(request: Request) {
9497 }
9598
9699 return access ;
97- } )
100+ } ) ,
98101 ) ;
99102
100103 return Response . json ( {
@@ -107,7 +110,7 @@ export async function GET(request: Request) {
107110 error : "Internal server error" ,
108111 details : error instanceof Error ? error . message : "Unknown error" ,
109112 } ,
110- { status : 500 }
113+ { status : 500 } ,
111114 ) ;
112115 }
113116}
You can’t perform that action at this time.
0 commit comments