-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aab4fa1
commit a5bbe02
Showing
8 changed files
with
107 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import dbConnect from "../../../../lib/dbConnect"; | ||
import { TeamModel } from "../../../../model/Team"; | ||
|
||
export async function GET() { | ||
await dbConnect(); | ||
|
||
try { | ||
const teams = await TeamModel.find(); | ||
return new Response(JSON.stringify({ success: true, teams }), { status: 200 }); | ||
} catch (error) { | ||
console.error('Error fetching teams:', error); | ||
return new Response(JSON.stringify({ success: false, message: 'Error fetching teams' }), { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
import { z } from 'zod'; | ||
|
||
export const teamSchema = z.object({ | ||
teamname: z.string(), | ||
game: z.string(), | ||
role: z.string(), | ||
rank: z.string(), | ||
server: z.string(), | ||
language: z.string(), | ||
players: z.string(), | ||
requests: z.string(), | ||
|
||
}); | ||
teamname: z.string().min(4, { message: 'Team name must be at least 4 characters long' }), | ||
game: z.string().min(4, { message: 'Game name must be at least 4 characters long' }), | ||
role: z.string().min(4, { message: 'Role must be at least 4 characters long' }), | ||
rank: z.string().min(4, { message: 'Rank must be at least 4 characters long' }), | ||
server: z.string().min(4, { message: 'Server must be at least 4 characters long' }), | ||
language: z.string().min(4, { message: 'Language must be at least 4 characters long' }), | ||
players: z.string().min(4, { message: 'Players field must be at least 4 characters long' }), | ||
requests: z.string().min(4, { message: 'Requests field must be at least 4 characters long' }), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.