File tree Expand file tree Collapse file tree 5 files changed +42
-0
lines changed
Expand file tree Collapse file tree 5 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,13 @@ export async function POST(
5353 ) ;
5454 }
5555
56+ if ( ! session . user . isAdmin ) {
57+ return NextResponse . json (
58+ { success : false , error : "Forbidden" } ,
59+ { status : 403 }
60+ ) ;
61+ }
62+
5663 const { id } = await params ;
5764
5865 // Parse request body for forceApprove flag
Original file line number Diff line number Diff line change @@ -68,6 +68,13 @@ export async function POST(
6868 ) ;
6969 }
7070
71+ if ( ! session . user . isAdmin ) {
72+ return NextResponse . json (
73+ { success : false , error : "Forbidden" } ,
74+ { status : 403 }
75+ ) ;
76+ }
77+
7178 const { id } = await params ;
7279 const body = await request . json ( ) . catch ( ( ) => ( { } ) ) ;
7380
Original file line number Diff line number Diff line change @@ -72,6 +72,13 @@ export async function POST(
7272 ) ;
7373 }
7474
75+ if ( ! session . user . isAdmin ) {
76+ return NextResponse . json (
77+ { success : false , error : "Forbidden" } ,
78+ { status : 403 }
79+ ) ;
80+ }
81+
7582 const { id } = await params ;
7683 const body = await request . json ( ) ;
7784
Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ export async function GET(
4141 ) ;
4242 }
4343
44+ if ( ! session . user . isAdmin ) {
45+ return NextResponse . json (
46+ { success : false , error : "Forbidden" } ,
47+ { status : 403 }
48+ ) ;
49+ }
50+
4451 const { id } = await params ;
4552 const sponsorAd = await sponsorAdService . getSponsorAdWithUser ( id ) ;
4653
@@ -103,6 +110,13 @@ export async function DELETE(
103110 ) ;
104111 }
105112
113+ if ( ! session . user . isAdmin ) {
114+ return NextResponse . json (
115+ { success : false , error : "Forbidden" } ,
116+ { status : 403 }
117+ ) ;
118+ }
119+
106120 const { id } = await params ;
107121
108122 await sponsorAdService . deleteSponsorAd ( id ) ;
Original file line number Diff line number Diff line change @@ -70,6 +70,13 @@ export async function GET(request: NextRequest) {
7070 ) ;
7171 }
7272
73+ if ( ! session . user . isAdmin ) {
74+ return NextResponse . json (
75+ { success : false , error : "Forbidden" } ,
76+ { status : 403 }
77+ ) ;
78+ }
79+
7380 const { searchParams } = new URL ( request . url ) ;
7481
7582 // Validate pagination parameters
You can’t perform that action at this time.
0 commit comments