-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8b758db
commit 9382bcb
Showing
7 changed files
with
72 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import prisma from "@/db"; | ||
import { Table } from "@radix-ui/themes"; | ||
|
||
export default function Home() { | ||
export default async function Home() { | ||
const users = await prisma.user.findMany(); | ||
return ( | ||
<Table.Root> | ||
<Table.Header> | ||
|
@@ -12,23 +14,13 @@ export default function Home() { | |
</Table.Header> | ||
|
||
<Table.Body> | ||
<Table.Row> | ||
<Table.RowHeaderCell>Danilo Sousa</Table.RowHeaderCell> | ||
<Table.Cell>[email protected]</Table.Cell> | ||
<Table.Cell>Developer</Table.Cell> | ||
</Table.Row> | ||
|
||
<Table.Row> | ||
<Table.RowHeaderCell>Zahra Ambessa</Table.RowHeaderCell> | ||
<Table.Cell>[email protected]</Table.Cell> | ||
<Table.Cell>Admin</Table.Cell> | ||
</Table.Row> | ||
|
||
<Table.Row> | ||
<Table.RowHeaderCell>Jasper Eriksson</Table.RowHeaderCell> | ||
<Table.Cell>[email protected]</Table.Cell> | ||
<Table.Cell>Developer</Table.Cell> | ||
</Table.Row> | ||
{users.map((user) => ( | ||
<Table.Row key={user.id}> | ||
<Table.RowHeaderCell>{user.name}</Table.RowHeaderCell> | ||
<Table.Cell>{user.email}</Table.Cell> | ||
<Table.Cell>{user.group}</Table.Cell> | ||
</Table.Row> | ||
))} | ||
</Table.Body> | ||
</Table.Root> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { PrismaClient } from '@prisma/client' | ||
|
||
const prismaClientSingleton = () => { | ||
return new PrismaClient() | ||
} | ||
|
||
declare const globalThis: { | ||
prismaGlobal: ReturnType<typeof prismaClientSingleton>; | ||
} & typeof global; | ||
|
||
const prisma = globalThis.prismaGlobal ?? prismaClientSingleton() | ||
|
||
export default prisma | ||
|
||
if (process.env.NODE_ENV !== 'production') globalThis.prismaGlobal = prisma |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- CreateTable | ||
CREATE TABLE "User" ( | ||
"id" TEXT NOT NULL, | ||
"email" TEXT NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"group" TEXT NOT NULL, | ||
|
||
CONSTRAINT "User_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateIndex | ||
CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters