refactor: migrate messageStore to drizzle-orm
- Replace all raw SQL queries in messageStore.ts with Drizzle ORM queries - Remove DatabaseAdapter dependency from messageStore functions - Update all function signatures to be async and remove db parameter - Functions now use getDatabase() internally for database access - Update all call sites in messageCapture.ts, attachmentUploader.ts, aiAnalyzer.ts, webserver.ts, and index.ts - All functions remain backward compatible in behavior - TypeScript typecheck passes with no errors - All tests pass (11 passed)
This commit is contained in:
@@ -122,7 +122,6 @@ export async function downloadDiscordAttachment(url: string): Promise<Buffer> {
|
||||
}
|
||||
|
||||
export async function processAttachmentUpload(
|
||||
db: SqliteDatabase,
|
||||
attachmentId: string,
|
||||
discordUrl: string,
|
||||
filename: string,
|
||||
@@ -141,14 +140,14 @@ export async function processAttachmentUpload(
|
||||
|
||||
const result = await uploadAttachmentToPicser(buffer, filename);
|
||||
|
||||
updateAttachmentAsUploaded(db, attachmentId, result.url, Date.now());
|
||||
await updateAttachmentAsUploaded(attachmentId, result.url, Date.now());
|
||||
logger.info(
|
||||
{ attachmentId, uploadedUrl: result.url },
|
||||
"Attachment upload completed",
|
||||
);
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : String(error);
|
||||
updateAttachmentAsFailedUpload(db, attachmentId, errorMsg);
|
||||
await updateAttachmentAsFailedUpload(attachmentId, errorMsg);
|
||||
logger.error({ attachmentId, error: errorMsg }, "Attachment upload failed");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user