aboutsummaryrefslogtreecommitdiffstats
path: root/packages/trpc
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-04-18 10:01:45 +0100
committerMohamedBassem <me@mbassem.com>2024-04-18 10:01:45 +0100
commitdeba31ee010f785a9739fd4df8a64a3056c9593d (patch)
tree647499476af517b045a784591e0f8538551f69a4 /packages/trpc
parent81fc4c45269fcd2b9cb9b6a001f8208f6b2b04a3 (diff)
downloadkarakeep-deba31ee010f785a9739fd4df8a64a3056c9593d.tar.zst
refactor: Move the shared types to the shared package
Diffstat (limited to '')
-rw-r--r--packages/shared/types/bookmarks.ts (renamed from packages/trpc/types/bookmarks.ts)0
-rw-r--r--packages/shared/types/lists.ts (renamed from packages/trpc/types/lists.ts)1
-rw-r--r--packages/shared/types/tags.ts (renamed from packages/trpc/types/tags.ts)0
-rw-r--r--packages/shared/types/uploads.ts (renamed from packages/trpc/types/uploads.ts)0
-rw-r--r--packages/shared/types/users.ts (renamed from packages/trpc/types/users.ts)0
-rw-r--r--packages/trpc/routers/bookmarks.ts15
-rw-r--r--packages/trpc/routers/lists.ts2
-rw-r--r--packages/trpc/routers/tags.ts4
-rw-r--r--packages/trpc/routers/users.ts2
9 files changed, 14 insertions, 10 deletions
diff --git a/packages/trpc/types/bookmarks.ts b/packages/shared/types/bookmarks.ts
index 2cf8152b..2cf8152b 100644
--- a/packages/trpc/types/bookmarks.ts
+++ b/packages/shared/types/bookmarks.ts
diff --git a/packages/trpc/types/lists.ts b/packages/shared/types/lists.ts
index 4b0ccaca..e9d7eca0 100644
--- a/packages/trpc/types/lists.ts
+++ b/packages/shared/types/lists.ts
@@ -4,6 +4,7 @@ export const zBookmarkListSchema = z.object({
id: z.string(),
name: z.string(),
icon: z.string(),
+ parentId: z.string().nullable(),
});
export const zBookmarkListWithBookmarksSchema = zBookmarkListSchema.merge(
diff --git a/packages/trpc/types/tags.ts b/packages/shared/types/tags.ts
index c9fe2a93..c9fe2a93 100644
--- a/packages/trpc/types/tags.ts
+++ b/packages/shared/types/tags.ts
diff --git a/packages/trpc/types/uploads.ts b/packages/shared/types/uploads.ts
index b53b86d5..b53b86d5 100644
--- a/packages/trpc/types/uploads.ts
+++ b/packages/shared/types/uploads.ts
diff --git a/packages/trpc/types/users.ts b/packages/shared/types/users.ts
index 3026337a..3026337a 100644
--- a/packages/trpc/types/users.ts
+++ b/packages/shared/types/users.ts
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts
index a447235b..0383d3f2 100644
--- a/packages/trpc/routers/bookmarks.ts
+++ b/packages/trpc/routers/bookmarks.ts
@@ -3,6 +3,11 @@ import { and, desc, eq, exists, inArray, lte, or } from "drizzle-orm";
import invariant from "tiny-invariant";
import { z } from "zod";
+import type {
+ ZBookmark,
+ ZBookmarkContent,
+} from "@hoarder/shared/types/bookmarks";
+import type { ZBookmarkTags } from "@hoarder/shared/types/tags";
import { db as DONT_USE_db } from "@hoarder/db";
import {
bookmarkAssets,
@@ -20,11 +25,6 @@ import {
SearchIndexingQueue,
} from "@hoarder/shared/queues";
import { getSearchIdxClient } from "@hoarder/shared/search";
-
-import type { Context } from "../index";
-import type { ZBookmark, ZBookmarkContent } from "../types/bookmarks";
-import type { ZBookmarkTags } from "../types/tags";
-import { authedProcedure, router } from "../index";
import {
DEFAULT_NUM_BOOKMARKS_PER_PAGE,
zBareBookmarkSchema,
@@ -33,7 +33,10 @@ import {
zGetBookmarksResponseSchema,
zNewBookmarkRequestSchema,
zUpdateBookmarksRequestSchema,
-} from "../types/bookmarks";
+} from "@hoarder/shared/types/bookmarks";
+
+import type { Context } from "../index";
+import { authedProcedure, router } from "../index";
export const ensureBookmarkOwnership = experimental_trpcMiddleware<{
ctx: Context;
diff --git a/packages/trpc/routers/lists.ts b/packages/trpc/routers/lists.ts
index fb6d8637..74b4f737 100644
--- a/packages/trpc/routers/lists.ts
+++ b/packages/trpc/routers/lists.ts
@@ -4,10 +4,10 @@ import { z } from "zod";
import { SqliteError } from "@hoarder/db";
import { bookmarkLists, bookmarksInLists } from "@hoarder/db/schema";
+import { zBookmarkListSchema } from "@hoarder/shared/types/lists";
import type { Context } from "../index";
import { authedProcedure, router } from "../index";
-import { zBookmarkListSchema } from "../types/lists";
import { ensureBookmarkOwnership } from "./bookmarks";
export const ensureListOwnership = experimental_trpcMiddleware<{
diff --git a/packages/trpc/routers/tags.ts b/packages/trpc/routers/tags.ts
index 53b72a23..ed4ac7d2 100644
--- a/packages/trpc/routers/tags.ts
+++ b/packages/trpc/routers/tags.ts
@@ -2,12 +2,12 @@ import { experimental_trpcMiddleware, TRPCError } from "@trpc/server";
import { and, count, eq } from "drizzle-orm";
import { z } from "zod";
+import type { ZAttachedByEnum } from "@hoarder/shared/types/tags";
import { bookmarkTags, tagsOnBookmarks } from "@hoarder/db/schema";
+import { zGetTagResponseSchema } from "@hoarder/shared/types/tags";
import type { Context } from "../index";
-import type { ZAttachedByEnum } from "../types/tags";
import { authedProcedure, router } from "../index";
-import { zGetTagResponseSchema } from "../types/tags";
function conditionFromInput(
input: { tagName: string } | { tagId: string },
diff --git a/packages/trpc/routers/users.ts b/packages/trpc/routers/users.ts
index e7f0a59d..51f9429e 100644
--- a/packages/trpc/routers/users.ts
+++ b/packages/trpc/routers/users.ts
@@ -7,6 +7,7 @@ import { SqliteError } from "@hoarder/db";
import { users } from "@hoarder/db/schema";
import { deleteUserAssets } from "@hoarder/shared/assetdb";
import serverConfig from "@hoarder/shared/config";
+import { zSignUpSchema } from "@hoarder/shared/types/users";
import { hashPassword, validatePassword } from "../auth";
import {
@@ -15,7 +16,6 @@ import {
publicProcedure,
router,
} from "../index";
-import { zSignUpSchema } from "../types/users";
export const usersAppRouter = router({
create: publicProcedure