api data transformation

This commit is contained in:
Owen Rees
2023-06-20 08:55:56 +02:00
parent f1ef7cd3f2
commit 5aaa1deeff
3 changed files with 5 additions and 3 deletions
+5 -1
View File
@@ -15,7 +15,11 @@ export async function GET() {
const client = await clientPromise;
const db = client.db("tournamentsFranceDB");
const data = await dateOrderingFrance(db);
const results = await dateOrderingFrance(db);
const data = results.map(({ _id, __v, ...rest }) => ({
id: _id,
...rest,
}));
return new Response(JSON.stringify(data), { status: 200, headers });
} catch (error) {