Skip to content

Commit

Permalink
feat: read route
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon-Harad committed Dec 1, 2024
1 parent a76b60d commit b5d1325
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/server-assets/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,7 @@ export async function insertTeamMatch(match: TeamMatch): Promise<boolean> {
return false;
}
}

export async function select(matchkey : string, teamkey : string) {
return await db.query('SELECT * FROM TeamMatches WHERE match_key = $1 AND team_key = $2', [matchkey, teamkey])
}
7 changes: 7 additions & 0 deletions src/routes/api/read/[matchkey]/[teamkey]/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { json } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { select } from '$lib/server-assets/database';

export const GET: RequestHandler = async ( params : any ) => {
return json(await select(params.matchkey, params.teamkey));
};

0 comments on commit b5d1325

Please sign in to comment.