mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Merge pull request #13 from RooCodeInc/cte/require-org
This commit is contained in:
commit
5ca0844aec
3 changed files with 12 additions and 3 deletions
|
|
@ -6,11 +6,18 @@ import { cloudEventSchema } from '@/schemas';
|
|||
import { captureEvent } from '@/lib/server/analytics';
|
||||
|
||||
export async function POST(request: NextRequest) {
|
||||
const { userId } = await auth();
|
||||
const { userId, orgId } = await auth();
|
||||
|
||||
if (!userId) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Unauthorized request' },
|
||||
{ error: 'Unauthorized: User required' },
|
||||
{ status: 401 },
|
||||
);
|
||||
}
|
||||
|
||||
if (!orgId) {
|
||||
return NextResponse.json(
|
||||
{ error: 'Unauthorized: Organization required' },
|
||||
{ status: 401 },
|
||||
);
|
||||
}
|
||||
|
|
@ -29,7 +36,7 @@ export async function POST(request: NextRequest) {
|
|||
}
|
||||
|
||||
try {
|
||||
await captureEvent({ id, userId, timestamp, event: result.data });
|
||||
await captureEvent({ id, orgId, userId, timestamp, event: result.data });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ CREATE TABLE default.events
|
|||
(
|
||||
-- Shared
|
||||
`id` UUID,
|
||||
`orgId` String,
|
||||
`userId` String,
|
||||
`timestamp` Int32,
|
||||
`type` String,
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ const client = createClient({
|
|||
|
||||
type AnalyticsEvent = {
|
||||
id: string;
|
||||
orgId: string;
|
||||
userId: string;
|
||||
timestamp: number;
|
||||
event: CloudEvent;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue