feat: scope workspace routes by organization slug

This commit is contained in:
2026-07-02 20:11:57 -07:00
parent fae97a7046
commit 3ab0e3e034
48 changed files with 565 additions and 96 deletions

View File

@@ -27,6 +27,7 @@ import type {
PublicAccount,
Session,
} from "@/modules/core/types";
import { RESERVED_WORKSPACE_SLUGS } from "@/modules/shared/lib/workspace-routing";
const SESSION_COOKIE = "teatea_session";
const SESSION_MAX_AGE_SECONDS = 60 * 60 * 24 * 7;
@@ -154,7 +155,8 @@ function createSlug(name: string): string {
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-|-$/g, "");
return base.length > 0 ? base : `org-${Date.now()}`;
const slug = base.length > 0 ? base : `org-${Date.now()}`;
return RESERVED_WORKSPACE_SLUGS.has(slug) ? `org-${slug}` : slug;
}
export async function setSessionCookie(sessionId: string): Promise<void> {