Make the launcher latest endpoint use the db
This commit is contained in:
@@ -29,7 +29,7 @@ const app = new Elysia()
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
app.get("/launcher/versions", () => launcherVersionsHandler(db))
|
app.get("/launcher/versions", () => launcherVersionsHandler(db))
|
||||||
app.get("/launcher/latest", launcherLatestHandler)
|
app.get("/launcher/latest", () => launcherLatestHandler(db))
|
||||||
app.get("/launcher/loader/latest", launcherLoaderLatestHandler)
|
app.get("/launcher/loader/latest", launcherLoaderLatestHandler)
|
||||||
app.get("/launcher/loader/update-data", () => launcherLoaderUpdateDataHandler(db))
|
app.get("/launcher/loader/update-data", () => launcherLoaderUpdateDataHandler(db))
|
||||||
app.all("*", () => jsonResponse({ message: "No endpoint found (are you using the correct request method?)" }, 404))
|
app.all("*", () => jsonResponse({ message: "No endpoint found (are you using the correct request method?)" }, 404))
|
||||||
|
|||||||
@@ -1,3 +1,16 @@
|
|||||||
export async function handler() {
|
import { MySql2Database } from "drizzle-orm/mysql2"
|
||||||
return "1.1.0"
|
import { launcherUpdates } from "../../lib/tables"
|
||||||
|
import { eq } from "drizzle-orm"
|
||||||
|
|
||||||
|
export async function handler(db: MySql2Database) {
|
||||||
|
const version = await db.select({
|
||||||
|
id: launcherUpdates.id
|
||||||
|
})
|
||||||
|
.from(launcherUpdates)
|
||||||
|
.where(eq(launcherUpdates.hidden, false))
|
||||||
|
.orderBy(launcherUpdates.place)
|
||||||
|
.limit(1)
|
||||||
|
.execute()
|
||||||
|
|
||||||
|
return version[0].id
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user