Implement full discord OAuth api flow

This commit is contained in:
Dominic Ferrando
2026-08-16 01:51:12 -04:00
parent 8db1db2ec6
commit 17af2f3d1f
5 changed files with 70 additions and 41 deletions
+4 -3
View File
@@ -14,18 +14,19 @@ export class AccountsService {
}
async create(discordId: string, email?: string, name?: string) {
await db.insertInto("accounts")
return await db.insertInto("accounts")
.values({
discord_id: discordId,
name: name ?? "",
email: email ?? null
})
.execute();
.returning("id")
.executeTakeFirstOrThrow();
}
async get(id: string) {
return await (db).selectFrom("accounts")
.select(["discord_id", "name", "email", "gender"])
.select(["id", "discord_id", "name", "email", "gender"])
.where(...AccountsService.idComparison(id))
.executeTakeFirst();
}