diff options
author | mat <github@matdoes.dev> | 2021-12-29 21:01:17 -0600 |
---|---|---|
committer | mat <github@matdoes.dev> | 2021-12-29 21:01:17 -0600 |
commit | a2d83b37a1a0b1d6c22ffc2899c734e44115625d (patch) | |
tree | dff9ee3161b4e157b51c5ae1ebf9aca9400c14f6 /src/database.ts | |
parent | 1be7b86cce10fceed1ff3d8df376cb9422154503 (diff) | |
download | skyblock-api-a2d83b37a1a0b1d6c22ffc2899c734e44115625d.tar.gz skyblock-api-a2d83b37a1a0b1d6c22ffc2899c734e44115625d.tar.bz2 skyblock-api-a2d83b37a1a0b1d6c22ffc2899c734e44115625d.zip |
fix all typescript errors with mongodb
Diffstat (limited to 'src/database.ts')
-rw-r--r-- | src/database.ts | 10 |
1 files changed, 5 insertions, 5 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 }) } |