Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

refactor: remove admin authentication and update user retrieval in activity comments

Andrej Acevski4aea8d2c4c00
diff --git a/apps/api/src/activity/index.ts b/apps/api/src/activity/index.ts
index 4f9ae059a..6d96b1564 100644
--- a/apps/api/src/activity/index.ts
+++ b/apps/api/src/activity/index.ts
@@ -2,9 +2,8 @@ import { eq } from "drizzle-orm";
import { Hono } from "hono";
import { describeRoute, resolver, validator } from "hono-openapi";
import * as v from "valibot";
-import { auth } from "../auth";
import db from "../database";
-import { taskTable } from "../database/schema";
+import { taskTable, userTable } from "../database/schema";
import { publishEvent, subscribeToEvent } from "../events";
import { activitySchema } from "../schemas";
import { workspaceAccess } from "../utils/workspace-access-middleware";
@@ -100,7 +99,11 @@ const activity = new Hono<{
const { taskId, comment } = c.req.valid("json");
const userId = c.get("userId");
const newComment = await createComment(taskId, userId, comment);
- const user = await auth.api.getUser({ query: { id: userId } });
+
+ const [user] = await db
+ .select({ name: userTable.name })
+ .from(userTable)
+ .where(eq(userTable.id, userId));
const [task] = await db
.select({ projectId: taskTable.projectId })
diff --git a/apps/api/src/auth.ts b/apps/api/src/auth.ts
index 6811be88e..13bad8f1a 100644
--- a/apps/api/src/auth.ts
+++ b/apps/api/src/auth.ts
@@ -8,7 +8,6 @@ import { betterAuth } from "better-auth";
import { drizzleAdapter } from "better-auth/adapters/drizzle";
import { APIError } from "better-auth/api";
import {
- admin,
anonymous,
apiKey,
createAuthMiddleware,
@@ -241,7 +240,6 @@ export const auth = betterAuth({
],
}),
apiKey(),
- admin(),
],
session: {
cookieCache: {