first refactor

This commit is contained in:
Boki 2026-10-20 12:39:38 -04:00
parent 1f5dac28c7
commit 588f666943
84 changed files with 996 additions and 1062 deletions

View file

@ -1,5 +1,5 @@
import type { Logger } from '@stock-bot/logger';
import type { OptionalUnlessRequiredId } from 'mongodb';
import type { Document, OptionalUnlessRequiredId } from 'mongodb';
import { Collection, Db, MongoClient } from 'mongodb';
import type {
ConnectionEvents,
@ -328,7 +328,7 @@ export class MongoDBClient {
/**
* Get a typed collection
*/
getCollection<T extends DocumentBase>(name: string, database?: string): Collection<T> {
getCollection<T extends Document = Document>(name: string, database?: string): Collection<T> {
const db = this.getDatabase(database);
return db.collection<T>(name);
}
@ -337,8 +337,8 @@ export class MongoDBClient {
* Get a collection (interface compatibility method)
* This method provides compatibility with the IMongoDBClient interface
*/
collection(name: string, database?: string): Collection<DocumentBase> {
return this.getCollection(name, database);
collection<T extends Document = Document>(name: string, database?: string): Collection<T> {
return this.getCollection<T>(name, database);
}
/**