Added lanes (first try)
All checks were successful
pipeline / build-and-push-images (push) Successful in 24s
pipeline / deploy (push) Successful in 7s

This commit is contained in:
2024-11-27 20:59:03 +01:00
parent cca1909eb6
commit 43968e4cf1
22 changed files with 173 additions and 24 deletions

View File

@@ -0,0 +1,23 @@
import {connectToDatabase, fetchLatestPatch} from '../utils/mongo'
async function champions(client, patch) {
const database = client.db("champions");
const collection = database.collection(patch);
const data = await collection.find().toArray()
data.map((x) => {
delete x.runes
delete x.builds
})
return data
}
export default defineEventHandler(async (event) => {
const client = await connectToDatabase();
const latestPatch = await fetchLatestPatch(client);
const data = await champions(client, latestPatch);
await client.close()
return data
})