adding organization feature.

This commit is contained in:
killian-larcher
2024-12-12 13:31:11 +01:00
parent 5bd24574c3
commit afb936bc5b
29 changed files with 363 additions and 93 deletions
@@ -32,10 +32,13 @@ export default async function RoutePage(props: PageParams<{
const availableDatabases = await prisma.database.findMany({
where: {
OR: [
{ projectId: null },
{ projectId: project.id },
{projectId: null},
{projectId: project.id},
],
},
include: {
agent: {}
},
orderBy: {
createdAt: 'desc',
},
@@ -50,7 +53,8 @@ export default async function RoutePage(props: PageParams<{
</PageTitle>
</PageHeader>
<PageContent>
<ProjectForm organization={organization} databases={availableDatabases} defaultValues={project} projectId={project.id}/>
<ProjectForm organization={organization} databases={availableDatabases} defaultValues={project}
projectId={project.id}/>
</PageContent>
</Page>
)
@@ -10,6 +10,9 @@ export default async function RoutePage(props: PageParams<{}>) {
where: {
projectId: null
},
include: {
agent: {}
},
orderBy: {
createdAt: 'desc',
},
+12 -1
View File
@@ -5,17 +5,28 @@ import {Button} from "@/components/ui/button";
import Link from 'next/link'
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {ProjectCard} from "@/components/wrappers/Dashboard/Projects/ProjectCard/ProjectCard";
import {requiredCurrentUser} from "@/auth/current-user";
export default async function RoutePage(props: PageParams<{}>) {
// const {searchParams} = props
// const organizationId = searchParams?.organizationId || "default";
const user = await requiredCurrentUser()
const projects = await prisma.project.findMany({
where: {
organization: {
slug: "default",
// id: organizationId,
users: {
some: {
userId: user.id
},
},
}
},
include:{
include: {
databases: {}
}
})