Setup account creation through discord OAuth2

This commit is contained in:
Dominic Ferrando
2026-08-16 00:00:50 -04:00
parent d4a450ab3e
commit 8db1db2ec6
3 changed files with 102 additions and 3 deletions
+11 -1
View File
@@ -13,9 +13,19 @@ export class AccountsService {
: ["accounts.id", "=", id];
}
async create(discordId: string, email?: string, name?: string) {
await db.insertInto("accounts")
.values({
discord_id: discordId,
name: name ?? "",
email: email ?? null
})
.execute();
}
async get(id: string) {
return await (db).selectFrom("accounts")
.selectAll()
.select(["discord_id", "name", "email", "gender"])
.where(...AccountsService.idComparison(id))
.executeTakeFirst();
}