summary refs log tree commit diff
diff options
context:
space:
mode:
authorxnacly <matteogropp@gmail.com>2020-12-31 11:55:08 +0100
committerxnacly <matteogropp@gmail.com>2020-12-31 11:55:08 +0100
commitabf416728ec671a013ff1eec5e656c0f2417af6d (patch)
tree2d6c4d1dd72a9c9ee3e3a99643f48270b7b2b3b3
parentUpdate README.md (diff)
downloadserver-abf416728ec671a013ff1eec5e656c0f2417af6d.tar.xz
updated crawler type and implemented it
-rw-r--r--src/routes/external.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/routes/external.ts b/src/routes/external.ts
index 14980b05..be680003 100644
--- a/src/routes/external.ts
+++ b/src/routes/external.ts
@@ -8,11 +8,12 @@ import { URL } from "url";
 const router = Router();
 
 type crawled = {
-	title: string;
-	type: string;
-	description: string;
-	url: string;
-	image_url: string;
+	id: string;
+	ogTitle: string;
+	ogType: string;
+	ogDescription: string;
+	ogUrl: string;
+	cachedImage: string;
 };
 
 const DEFAULT_FETCH_OPTIONS: any = {
@@ -59,7 +60,7 @@ router.post("/", bodyParser.json(), async (req, res) => {
 
 		await db.data.externals.push({ image: ImageResponseBuffer, id: ID, type: ImageType });
 
-		const new_cache_entry = { id: ID, ogTitle, ogDescription, cachedImage, ogUrl, ogType };
+		const new_cache_entry: crawled = { id: ID, ogTitle, ogDescription, cachedImage, ogUrl, ogType };
 		await db.data.crawler.push(new_cache_entry);
 
 		res.send(new_cache_entry);