Skip to content

Commit f78cda9

Browse files
committed
feat(ai): update AI settings to use organization-based access control
- Refactor AI-related schemas and services to use organizationId instead of adminId - Update AI router to check organization-level permissions - Modify AI settings creation and retrieval to work with organization context - Adjust server-side props and access checks for AI settings
1 parent 747c213 commit f78cda9

File tree

10 files changed

+5326
-64
lines changed

10 files changed

+5326
-64
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CREATE TABLE "ai" (
2+
"aiId" text PRIMARY KEY NOT NULL,
3+
"name" text NOT NULL,
4+
"apiUrl" text NOT NULL,
5+
"apiKey" text NOT NULL,
6+
"model" text NOT NULL,
7+
"isEnabled" boolean DEFAULT true NOT NULL,
8+
"organizationId" text NOT NULL,
9+
"createdAt" text NOT NULL
10+
);
11+
--> statement-breakpoint
12+
ALTER TABLE "ai" ADD CONSTRAINT "ai_organizationId_organization_id_fk" FOREIGN KEY ("organizationId") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;

0 commit comments

Comments
 (0)