Provide the clamav socket, correctly upsert file hashes
diff --git a/src/utils/database.ts b/src/utils/database.ts
index c5697f3..3fc2333 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -591,7 +591,7 @@
     nsfw?: boolean;
     malware?: boolean;
     bad_link?: boolean;
-    tags: string[];
+    tags?: string[];
 }
 
 export class ScanCache {
@@ -608,7 +608,27 @@
     async write(hash: string, type: "nsfw" | "malware" | "bad_link", data: boolean, tags?: string[]) {
         await this.scanCache.updateOne(
             { hash: hash },
-            { hash: hash, [type]: data, tags: tags ?? [], addedAt: new Date() },
+            {
+                $set: (() => {
+                    switch (type) {
+                        case "nsfw": {
+                            return { nsfw: data, addedAt: new Date() };
+                        }
+                        case "malware": {
+                            return { malware: data, addedAt: new Date() };
+                        }
+                        case "bad_link": {
+                            return { bad_link: data, tags: tags ?? [], addedAt: new Date() };
+                        }
+                        default: {
+                            throw new Error("Invalid type");
+                        }
+                    }
+                })()
+                // No you can't just do { [type]: data }, yes it's a typescript error, no I don't know how to fix it
+                // cleanly, yes it would be marginally more elegant, no it's not essential, yes I'd be happy to review
+                // PRs that did improve this snippet
+            },
             Object.assign({ upsert: true }, collectionOptions)
         );
     }