From baf48af5f0a4b88642edc18ae8b16e81260e1846 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Tue, 6 Feb 2024 18:16:35 +0000 Subject: Implement metadata fetching logic in the crawler --- web/lib/auth.ts | 2 +- web/lib/prisma.ts | 5 ----- web/lib/types/api/links.ts | 19 +++++++++++-------- 3 files changed, 12 insertions(+), 14 deletions(-) delete mode 100644 web/lib/prisma.ts (limited to 'web/lib') 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; +export type ZBookmarkedLink = z.infer; // 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; +export type ZGetLinksResponse = z.infer; -- cgit v1.2.3-70-g09d2