aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.ts10
-rw-r--r--src/hypixel.ts5
2 files changed, 8 insertions, 7 deletions
diff --git a/src/database.ts b/src/database.ts
index 46822b3..8a384b1 100644
--- a/src/database.ts
+++ b/src/database.ts
@@ -6,7 +6,7 @@ import { categorizeStat, getStatUnit } from './cleaners/skyblock/stats.js'
import { CleanFullProfile } from './cleaners/skyblock/profile.js'
import { slayerLevels } from './cleaners/skyblock/slayers.js'
import { CleanMember } from './cleaners/skyblock/member.js'
-import { Collection, Db, MongoClient } from 'mongodb'
+import { Collection, Db, Filter, MongoClient, WithId } from 'mongodb'
import { CleanPlayer } from './cleaners/player.js'
import * as cached from './hypixelCached.js'
import * as constants from './constants.js'
@@ -785,15 +785,15 @@ export async function createSession(refreshToken: string, userData: discord.Disc
return sessionId
}
-export async function fetchSession(sessionId: string): Promise<SessionSchema | null> {
- return await sessionsCollection?.findOne({ _id: sessionId })
+export async function fetchSession(sessionId: string): Promise<WithId<SessionSchema> | null> {
+ return await sessionsCollection?.findOne({ _id: sessionId as any } )
}
-export async function fetchAccount(minecraftUuid: string): Promise<AccountSchema | null> {
+export async function fetchAccount(minecraftUuid: string): Promise<WithId<AccountSchema> | null> {
return await accountsCollection?.findOne({ minecraftUuid })
}
-export async function fetchAccountFromDiscord(discordId: string): Promise<AccountSchema | null> {
+export async function fetchAccountFromDiscord(discordId: string): Promise<WithId<AccountSchema> | null> {
return await accountsCollection?.findOne({ discordId })
}
diff --git a/src/hypixel.ts b/src/hypixel.ts
index 8811624..dd9d91d 100644
--- a/src/hypixel.ts
+++ b/src/hypixel.ts
@@ -22,6 +22,7 @@ import { cleanSkyblockProfilesResponse } from './cleaners/skyblock/profiles.js'
import { CleanPlayer, cleanPlayerResponse } from './cleaners/player.js'
import * as cached from './hypixelCached.js'
import { debug } from './index.js'
+import { WithId } from 'mongodb'
export type Included = 'profiles' | 'player' | 'stats' | 'inventories' | undefined
@@ -131,7 +132,7 @@ export async function fetchUser({ user, uuid, username }: UserAny, included: Inc
}
}
}
- let websiteAccount: AccountSchema | null = null
+ let websiteAccount: WithId<AccountSchema> | null = null
if (websiteAccountPromise)
websiteAccount = await websiteAccountPromise
@@ -185,7 +186,7 @@ export async function fetchMemberProfile(user: string, profile: string, customiz
cleanProfile.members = simpleMembers
- let websiteAccount: AccountSchema | null = null
+ let websiteAccount: WithId<AccountSchema> | null = null
if (websiteAccountPromise)
websiteAccount = await websiteAccountPromise