diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-05-31 18:46:04 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-31 18:46:04 +0100 |
| commit | 9695bba2e993b48ae333da622fa459dbaacb9349 (patch) | |
| tree | c6bffbcdd73151671343f27012e82bea5a05ab6b /packages/trpc/lib | |
| parent | b218118b84291de4a9c1cd400dc58afab7054b78 (diff) | |
| download | karakeep-9695bba2e993b48ae333da622fa459dbaacb9349.tar.zst | |
feat: Generate RSS feeds from lists (#1507)
* refactor: Move bookmark utils from shared-react to shared
* Expose RSS feeds for lists
* Add e2e tests
* Slightly improve the look of the share dialog
* allow specifying a limit in the rss endpoint
Diffstat (limited to 'packages/trpc/lib')
| -rw-r--r-- | packages/trpc/lib/impersonate.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/packages/trpc/lib/impersonate.ts b/packages/trpc/lib/impersonate.ts new file mode 100644 index 00000000..f44a2c70 --- /dev/null +++ b/packages/trpc/lib/impersonate.ts @@ -0,0 +1,30 @@ +import { eq } from "drizzle-orm"; + +import { db } from "@karakeep/db"; +import { users } from "@karakeep/db/schema"; + +import { AuthedContext } from ".."; + +export async function buildImpersonatingAuthedContext( + userId: string, +): Promise<AuthedContext> { + const user = await db.query.users.findFirst({ + where: eq(users.id, userId), + }); + if (!user) { + throw new Error("User not found"); + } + + return { + user: { + id: user.id, + name: user.name, + email: user.email, + role: user.role, + }, + db, + req: { + ip: null, + }, + }; +} |
