This commit is contained in:
AquaWolf
2025-03-15 21:06:30 +01:00
parent b734892c55
commit 5189bf768a
23 changed files with 890 additions and 102 deletions

View File

@@ -14,7 +14,7 @@
"typescript": "^5.0.0"
},
"dependencies": {
"@openauthjs/openauth": "^0.3.9",
"@openauthjs/openauth": "0.4.3",
"hono": "^4.6.15",
"hono-openapi": "^0.3.1",
"partysocket": "1.0.3"

View File

@@ -42,8 +42,10 @@ export module AccountApi {
}),
async (c) => {
const actor = assertActor("user");
const currentUser = await User.fromID(actor.properties.userID)
if (!currentUser) return c.json({ error: "This account does not exist, it may have been deleted" }, 404)
const [currentUser, teams] = await Promise.all([User.fromID(actor.properties.userID), User.teams()])
if (!currentUser) return c.json({ error: "This account does not exist; it may have been deleted" }, 404)
const { id, email, name, polarCustomerID, avatarUrl, discriminator } = currentUser
return c.json({
@@ -51,10 +53,10 @@ export module AccountApi {
id,
email,
name,
teams,
avatarUrl,
discriminator,
polarCustomerID,
teams: await User.teams(),
}
}, 200);
},