feat: harden content workflows and staging smoke tests
CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions
CI — Test & Build / 🐳 Docker integration & API E2E (push) Blocked by required conditions
CI — Test & Build / 🌐 Staging Playwright smoke (push) Waiting to run
CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions
CI — Test & Build / 🐳 Docker integration & API E2E (push) Blocked by required conditions
CI — Test & Build / 🌐 Staging Playwright smoke (push) Waiting to run
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { MongoClient, Db } from 'mongodb'
|
||||
import { MongoClient, Db, Collection, Document } from 'mongodb'
|
||||
|
||||
if (!process.env.MONGODB_URI) {
|
||||
throw new Error('Please add MONGODB_URI to your environment variables')
|
||||
@@ -37,9 +37,9 @@ export async function getDb(): Promise<Db> {
|
||||
return client.db(process.env.MONGODB_DB || 'mozdit')
|
||||
}
|
||||
|
||||
export async function getCollection(collectionName: string) {
|
||||
export async function getCollection<T extends Document = Document>(collectionName: string): Promise<Collection<T>> {
|
||||
const db = await getDb()
|
||||
return db.collection(collectionName)
|
||||
return db.collection<T>(collectionName)
|
||||
}
|
||||
|
||||
// Health check for MongoDB connection
|
||||
@@ -52,4 +52,4 @@ export async function checkMongoConnection(): Promise<boolean> {
|
||||
console.error('MongoDB connection check failed:', error)
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user