diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/layout.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/layout.tsx index 5aeb6fb2..347a9548 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/layout.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/layout.tsx @@ -13,14 +13,14 @@ import SideEffects from './side-effects'; interface AppLayoutProps { children: React.ReactNode; params: { - organizationId: string; + organizationSlug: string; projectId: string; }; } export default async function AppLayout({ children, - params: { organizationId, projectId }, + params: { organizationSlug: organizationId, projectId }, }: AppLayoutProps) { const [organizations, projects, dashboards] = await Promise.all([ getCurrentOrganizations(), diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/invites/index.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/invites/index.tsx index 9484d973..e9448c3f 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/invites/index.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/invites/index.tsx @@ -6,10 +6,10 @@ import { getInvites, getProjectsByOrganizationId } from '@openpanel/db'; import CreateInvite from './create-invite'; interface Props { - organizationId: string; + organizationSlug: string; } -const InvitesServer = async ({ organizationId }: Props) => { +const InvitesServer = async ({ organizationSlug: organizationId }: Props) => { const [invites, projects] = await Promise.all([ getInvites(organizationId), getProjectsByOrganizationId(organizationId), diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/members/index.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/members/index.tsx index 971809b0..18e21f48 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/members/index.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/members/index.tsx @@ -3,10 +3,10 @@ import { MembersTable } from '@/components/settings/members'; import { getMembers, getProjectsByOrganizationId } from '@openpanel/db'; interface Props { - organizationId: string; + organizationSlug: string; } -const MembersServer = async ({ organizationId }: Props) => { +const MembersServer = async ({ organizationSlug: organizationId }: Props) => { const [members, projects] = await Promise.all([ getMembers(organizationId), getProjectsByOrganizationId(organizationId), diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/page.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/page.tsx index 696113d4..6050dd79 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/organization/page.tsx @@ -14,13 +14,13 @@ import MembersServer from './members'; interface PageProps { params: { - organizationId: string; + organizationSlug: string; }; searchParams: Record; } export default async function Page({ - params: { organizationId }, + params: { organizationSlug: organizationId }, searchParams, }: PageProps) { const tab = parseAsStringEnum(['org', 'members', 'invites']) diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/projects/page.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/projects/page.tsx index 6d8cfc1b..9013b553 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/projects/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/[projectId]/settings/projects/page.tsx @@ -9,11 +9,13 @@ import ListProjects from './list-projects'; interface PageProps { params: { - organizationId: string; + organizationSlug: string; }; } -export default async function Page({ params: { organizationId } }: PageProps) { +export default async function Page({ + params: { organizationSlug: organizationId }, +}: PageProps) { const [projects, clients] = await Promise.all([ getProjectsByOrganizationId(organizationId), getClientsByOrganizationId(organizationId), diff --git a/apps/dashboard/src/app/(app)/[organizationSlug]/page.tsx b/apps/dashboard/src/app/(app)/[organizationSlug]/page.tsx index ab2cb501..f4019257 100644 --- a/apps/dashboard/src/app/(app)/[organizationSlug]/page.tsx +++ b/apps/dashboard/src/app/(app)/[organizationSlug]/page.tsx @@ -8,17 +8,20 @@ import { getCurrentOrganizations, getCurrentProjects } from '@openpanel/db'; interface PageProps { params: { - organizationId: string; + organizationSlug: string; }; } -export default async function Page({ params: { organizationId } }: PageProps) { +export default async function Page({ + params: { organizationSlug: organizationId }, +}: PageProps) { const [organizations, projects] = await Promise.all([ getCurrentOrganizations(), getCurrentProjects(organizationId), ]); const organization = organizations.find((org) => org.id === organizationId); + console.log(organizations, organizationId, projects); if (!organization) { return ( diff --git a/packages/db/prisma/migrations/20241120131305_remove_org_slug/migration.sql b/packages/db/prisma/migrations/20241120131305_remove_org_slug/migration.sql new file mode 100644 index 00000000..c4f48310 --- /dev/null +++ b/packages/db/prisma/migrations/20241120131305_remove_org_slug/migration.sql @@ -0,0 +1,64 @@ +/* + Warnings: + + - You are about to drop the column `organizationSlug` on the `clients` table. All the data in the column will be lost. + - You are about to drop the column `organizationSlug` on the `dashboards` table. All the data in the column will be lost. + - You are about to drop the column `organizationSlug` on the `project_access` table. All the data in the column will be lost. + - You are about to drop the column `organizationSlug` on the `projects` table. All the data in the column will be lost. + - You are about to drop the column `organizationSlug` on the `shares` table. All the data in the column will be lost. + - Made the column `organizationId` on table `clients` required. This step will fail if there are existing NULL values in that column. + - Made the column `organizationId` on table `dashboards` required. This step will fail if there are existing NULL values in that column. + - Made the column `organizationId` on table `project_access` required. This step will fail if there are existing NULL values in that column. + - Made the column `organizationId` on table `projects` required. This step will fail if there are existing NULL values in that column. + - Made the column `organizationId` on table `shares` required. This step will fail if there are existing NULL values in that column. + +*/ +-- DropForeignKey +ALTER TABLE "clients" DROP CONSTRAINT "clients_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "dashboards" DROP CONSTRAINT "dashboards_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "project_access" DROP CONSTRAINT "project_access_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "projects" DROP CONSTRAINT "projects_organizationId_fkey"; + +-- DropForeignKey +ALTER TABLE "shares" DROP CONSTRAINT "shares_organizationId_fkey"; + +-- AlterTable +ALTER TABLE "clients" DROP COLUMN "organizationSlug", +ALTER COLUMN "organizationId" SET NOT NULL; + +-- AlterTable +ALTER TABLE "dashboards" DROP COLUMN "organizationSlug", +ALTER COLUMN "organizationId" SET NOT NULL; + +-- AlterTable +ALTER TABLE "project_access" DROP COLUMN "organizationSlug", +ALTER COLUMN "organizationId" SET NOT NULL; + +-- AlterTable +ALTER TABLE "projects" DROP COLUMN "organizationSlug", +ALTER COLUMN "organizationId" SET NOT NULL; + +-- AlterTable +ALTER TABLE "shares" DROP COLUMN "organizationSlug", +ALTER COLUMN "organizationId" SET NOT NULL; + +-- AddForeignKey +ALTER TABLE "projects" ADD CONSTRAINT "projects_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "organizations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "project_access" ADD CONSTRAINT "project_access_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "organizations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "clients" ADD CONSTRAINT "clients_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "organizations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "dashboards" ADD CONSTRAINT "dashboards_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "organizations"("id") ON DELETE RESTRICT ON UPDATE CASCADE; + +-- AddForeignKey +ALTER TABLE "shares" ADD CONSTRAINT "shares_organizationId_fkey" FOREIGN KEY ("organizationId") REFERENCES "organizations"("id") ON DELETE RESTRICT ON UPDATE CASCADE;