feat(api): user-scoped activities CRUD with shared auth helper
This commit is contained in:
8
apps/api/src/lib/require-user.ts
Normal file
8
apps/api/src/lib/require-user.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import type { Context } from 'hono';
|
||||
import { auth } from '../auth';
|
||||
|
||||
export async function getSessionUser(c: Context): Promise<{ id: string } | null> {
|
||||
const session = await auth.api.getSession({ headers: c.req.raw.headers });
|
||||
if (!session) return null;
|
||||
return { id: session.user.id };
|
||||
}
|
||||
Reference in New Issue
Block a user