1+ // Copyright (c) Gridiron Survivor.
2+ // Licensed under the MIT License.
3+
14import { createClient } from '@/lib/supabase/server' ;
25import { NextResponse } from 'next/server' ;
36import { CreateGiftExchangeRequest } from '@/app/types/giftExchange' ;
47import { validateGroupExchangeDates } from '@/lib/utils' ;
58
6- // Get all gift exchanges for the current user
7- export async function GET ( ) {
9+ /**
10+ * Get all gift exchanges for the current user
11+ * @returns {Promise<NextResponse> } Promise that resolved to a Response object
12+ */
13+ export async function GET ( ) : Promise < NextResponse > {
814 try {
915 const supabase = await createClient ( ) ;
1016 const {
@@ -24,7 +30,7 @@ export async function GET() {
2430 }
2531 return NextResponse . json ( data ) ;
2632 } catch ( error ) {
27- console . log ( error ) ;
33+ console . error ( error ) ;
2834
2935 return NextResponse . json (
3036 { error : 'Internal server error' } ,
@@ -33,7 +39,12 @@ export async function GET() {
3339 }
3440}
3541
36- export async function POST ( req : Request ) {
42+ /**
43+ * Create a new gift exchange
44+ * @param {Request } req The request object
45+ * @returns {Promise<NextResponse> } Promise that resolved to a Response object
46+ */
47+ export async function POST ( req : Request ) : Promise < NextResponse > {
3748 try {
3849 const supabase = await createClient ( ) ;
3950 const {
@@ -77,7 +88,7 @@ export async function POST(req: Request) {
7788
7889 return NextResponse . json ( data ) ;
7990 } catch ( error ) {
80- console . log ( error ) ;
91+ console . error ( error ) ;
8192
8293 return NextResponse . json (
8394 { error : 'Internal server error' } ,
@@ -86,7 +97,12 @@ export async function POST(req: Request) {
8697 }
8798}
8899
89- export async function PATCH ( req : Request ) {
100+ /**
101+ * Update a gift exchange
102+ * @param {Request } req The request object
103+ * @returns {Promise<NextResponse> } Promise that resolved to a Response object
104+ */
105+ export async function PATCH ( req : Request ) : Promise < NextResponse > {
90106 try {
91107 const supabase = await createClient ( ) ;
92108 const {
@@ -132,7 +148,8 @@ export async function PATCH(req: Request) {
132148
133149 return NextResponse . json ( data ) ;
134150 } catch ( error ) {
135- console . log ( error ) ;
151+ console . error ( error ) ;
152+
136153 return NextResponse . json (
137154 { error : 'Internal server error' } ,
138155 { status : 500 } ,
0 commit comments