import { editActor, getActorByPin } from "@stealth-developers/db"; import Elysia, { t } from "elysia"; export const syncRoutes = new Elysia({ prefix: "/sync" }).post( "/verify", async ({ body, set }) => { const user = await getActorByPin(body.pin); if (!user) { set.status = 404; return { error: "Pin not found" }; } const expiryDate = new Date(user.pinExpiresIn!); if (expiryDate < new Date()) { set.status = 401; return { error: "Pin expired" }; } await editActor(user.id, { robloxId: body.roblox_user_id, pin: null, pinExpiresIn: null, }); return { success: true }; }, { body: t.Object({ pin: t.String(), roblox_user_id: t.String(), }), }, );