Implement full discord OAuth api flow
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user