aboutsummaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-02-06 18:16:35 +0000
committerMohamedBassem <me@mbassem.com>2024-02-06 19:24:52 +0000
commitbaf48af5f0a4b88642edc18ae8b16e81260e1846 (patch)
tree1f9779ac76b21ba7504ec664f05064d1b4e9ff2a /web/lib
parente035c2fd1067a06d4774c64ae54548f664490f9d (diff)
downloadkarakeep-baf48af5f0a4b88642edc18ae8b16e81260e1846.tar.zst
Implement metadata fetching logic in the crawler
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/auth.ts2
-rw-r--r--web/lib/prisma.ts5
-rw-r--r--web/lib/types/api/links.ts19
3 files changed, 12 insertions, 14 deletions
diff --git a/web/lib/auth.ts b/web/lib/auth.ts
index 8b6527ec..cd6404de 100644
--- a/web/lib/auth.ts
+++ b/web/lib/auth.ts
@@ -2,7 +2,7 @@ import NextAuth, { NextAuthOptions } from "next-auth";
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import AuthentikProvider from "next-auth/providers/authentik";
import serverConfig from "@/lib/config";
-import prisma from "@/lib/prisma";
+import prisma from "@remember/db";
let providers = [];
diff --git a/web/lib/prisma.ts b/web/lib/prisma.ts
deleted file mode 100644
index b5bf6ce8..00000000
--- a/web/lib/prisma.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { PrismaClient } from "@prisma/client";
-
-const prisma = new PrismaClient();
-
-export default prisma;
diff --git a/web/lib/types/api/links.ts b/web/lib/types/api/links.ts
index 465fe133..48214f9a 100644
--- a/web/lib/types/api/links.ts
+++ b/web/lib/types/api/links.ts
@@ -1,6 +1,6 @@
import { z } from "zod";
-export const ZBookmarkedLink = z.object({
+export const zBookmarkedLinkSchema = z.object({
id: z.string(),
url: z.string().url(),
createdAt: z.coerce.date(),
@@ -8,18 +8,21 @@ export const ZBookmarkedLink = z.object({
details: z
.object({
title: z.string(),
- description: z.string(),
- imageUrl: z.string().url(),
+ description: z.string().optional(),
+ imageUrl: z.string().url().optional(),
+ favicon: z.string().url().optional(),
})
.nullish(),
});
-export type ZBookmarkedLink = z.infer<typeof ZBookmarkedLink>;
+export type ZBookmarkedLink = z.infer<typeof zBookmarkedLinkSchema>;
// POST /v1/links
-export const ZNewBookmarkedLinkRequest = ZBookmarkedLink.pick({ url: true });
+export const zNewBookmarkedLinkRequestSchema = zBookmarkedLinkSchema.pick({
+ url: true,
+});
// GET /v1/links
-export const ZGetLinksResponse = z.object({
- links: z.array(ZBookmarkedLink),
+export const zGetLinksResponseSchema = z.object({
+ links: z.array(zBookmarkedLinkSchema),
});
-export type ZGetLinksResponse = z.infer<typeof ZGetLinksResponse>;
+export type ZGetLinksResponse = z.infer<typeof zGetLinksResponseSchema>;