aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package-lock.json2
-rw-r--r--package.json2
-rw-r--r--src/database.ts10
-rw-r--r--src/hypixel.ts5
4 files changed, 10 insertions, 9 deletions
diff --git a/package-lock.json b/package-lock.json
index a4c52a3..3f28275 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12,7 +12,7 @@
"express": "^4.17.2",
"express-rate-limit": "^5.5.1",
"lru-cache": "^6.0.0",
- "mongodb": "^4.1.4",
+ "mongodb": "^4.2.2",
"node-cache": "^5.1.2",
"node-fetch": "github:tekwiz/node-fetch#fix/chunked-encoding-keepalive",
"prismarine-nbt": "github:PrismarineJS/prismarine-nbt",
diff --git a/package.json b/package.json
index a1bc515..0b1b997 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"express": "^4.17.2",
"express-rate-limit": "^5.5.1",
"lru-cache": "^6.0.0",
- "mongodb": "^4.1.4",
+ "mongodb": "^4.2.2",
"node-cache": "^5.1.2",
"node-fetch": "github:tekwiz/node-fetch#fix/chunked-encoding-keepalive",
"prismarine-nbt": "github:PrismarineJS/prismarine-nbt",
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