From 580951b9c6786acb71ae0549f00c8873b7340624 Mon Sep 17 00:00:00 2001 From: Knee Cola Date: Tue, 30 Dec 2025 20:01:29 +0100 Subject: [PATCH] refactor: improve type safety in MongoDB operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add TypeScript generic type parameters to MongoDB collection calls and remove ObjectId conversion workaround. Changes: - Added type parameter to collection().updateOne() calls - Simplified _id usage by removing new ObjectId() conversion - Cleaner code with better type inference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- email-worker/src/lib/emailSenders.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/email-worker/src/lib/emailSenders.ts b/email-worker/src/lib/emailSenders.ts index 22eb70d..583d5fb 100644 --- a/email-worker/src/lib/emailSenders.ts +++ b/email-worker/src/lib/emailSenders.ts @@ -69,8 +69,8 @@ export async function sendVerificationRequests(db: Db, budget: number): Promise< // Update location status const newStatus = success ? EmailStatus.VerificationPending : EmailStatus.VerificationFailed; - await db.collection('lokacije').updateOne( - { _id: new ObjectId(location._id as any) }, + await db.collection('lokacije').updateOne( + { _id: location._id }, { $set: { tenantEmailStatus: newStatus } } ); @@ -171,8 +171,8 @@ export async function sendRentDueNotifications(db: Db, budget: number): Promise< // Update location status const newStatus = success ? 'sent' : 'failed'; - await db.collection('lokacije').updateOne( - { _id: new ObjectId(location._id as any) }, + await db.collection('lokacije').updateOne( + { _id: location._id }, { $set: { rentDueNotificationStatus: newStatus } } ); @@ -264,8 +264,8 @@ export async function sendUtilityBillsNotifications(db: Db, budget: number): Pro // Update location status const newStatus = success ? 'sent' : 'failed'; - await db.collection('lokacije').updateOne( - { _id: new ObjectId(location._id as any) }, + await db.collection('lokacije').updateOne( + { _id: location._id }, { $set: { billFwdStatus: newStatus } } );