refactor: improve type safety in MongoDB operations
Add TypeScript generic type parameters to MongoDB collection calls and remove ObjectId conversion workaround. Changes: - Added <BillingLocation> 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 <noreply@anthropic.com>
This commit is contained in:
@@ -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<BillingLocation>('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<BillingLocation>('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<BillingLocation>('lokacije').updateOne(
|
||||
{ _id: location._id },
|
||||
{ $set: { billFwdStatus: newStatus } }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user