added drizzle dependency files
This commit is contained in:
parent
d4535402c9
commit
b886ea46b4
@ -32,5 +32,8 @@
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3",
|
||||
"typescript": "^5"
|
||||
},
|
||||
"prisma": {
|
||||
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
|
||||
}
|
||||
}
|
||||
|
||||
51
Websites/jefes-nextjs/prisma/seed.ts
Normal file
51
Websites/jefes-nextjs/prisma/seed.ts
Normal file
@ -0,0 +1,51 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
const prisma = new PrismaClient();
|
||||
async function main() {
|
||||
const alice = await prisma.user.upsert({
|
||||
where: { email: "alice@prisma.io" },
|
||||
update: {},
|
||||
create: {
|
||||
email: "alice@prisma.io",
|
||||
name: "Alice",
|
||||
posts: {
|
||||
create: {
|
||||
title: "Check out Prisma with Next.js",
|
||||
content: "https://www.prisma.io/nextjs",
|
||||
published: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const bob = await prisma.user.upsert({
|
||||
where: { email: "bob@prisma.io" },
|
||||
update: {},
|
||||
create: {
|
||||
email: "bob@prisma.io",
|
||||
name: "Bob",
|
||||
posts: {
|
||||
create: [
|
||||
{
|
||||
title: "Follow Prisma on Twitter",
|
||||
content: "https://twitter.com/prisma",
|
||||
published: true,
|
||||
},
|
||||
{
|
||||
title: "Follow Nexus on Twitter",
|
||||
content: "https://twitter.com/nexusgql",
|
||||
published: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log({ alice, bob });
|
||||
}
|
||||
main()
|
||||
.then(async () => {
|
||||
await prisma.$disconnect();
|
||||
})
|
||||
.catch(async (e) => {
|
||||
console.error(e);
|
||||
await prisma.$disconnect();
|
||||
process.exit(1);
|
||||
});
|
||||
@ -1,9 +1,13 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
UserGroupIcon,
|
||||
HomeIcon,
|
||||
DocumentDuplicateIcon,
|
||||
} from '@heroicons/react/24/outline';
|
||||
import clsx from 'clsx';
|
||||
import Link from 'next/link';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
// Map of links to display in the side navigation.
|
||||
// Depending on the size of the application, this would be stored in a database.
|
||||
@ -18,21 +22,26 @@ const links = [
|
||||
];
|
||||
|
||||
export default function NavLinks() {
|
||||
const pathname = usePathname();
|
||||
|
||||
return (
|
||||
<>
|
||||
{links.map((link) => {
|
||||
const LinkIcon = link.icon;
|
||||
return (
|
||||
<a
|
||||
<Link
|
||||
key={link.name}
|
||||
href={link.href}
|
||||
className={clsx(
|
||||
'flex h-[48px] grow items-center justify-center gap-2 rounded-md bg-gray-50 p-3 text-sm font-medium hover:bg-sky-100 hover:text-blue-600 md:flex-none md:justify-start md:p-2 md:px-3',
|
||||
{
|
||||
'bg-sky-100 text-blue-600': pathname === link.href,
|
||||
},
|
||||
)}
|
||||
>
|
||||
<LinkIcon className="w-6" />
|
||||
<p className="hidden md:block">{link.name}</p>
|
||||
</a>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
|
||||
Binary file not shown.
@ -8,29 +8,35 @@
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@tailwindcss/forms": "^0.5.6",
|
||||
"@types/node": "20.5.7",
|
||||
"@types/node": "^20.8.9",
|
||||
"@vercel/postgres": "^0.5.0",
|
||||
"autoprefixer": "10.4.15",
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"drizzle-orm": "^0.28.6",
|
||||
"lucide-react": "^0.290.0",
|
||||
"next": "^14.0.0",
|
||||
"postcss": "8.4.31",
|
||||
"postgres": "^3.4.2",
|
||||
"prisma": "^5.5.2",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"shadcn-ui": "latest",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
"tailwindcss": "3.3.3",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"typescript": "5.2.2",
|
||||
"zod": "^3.22.2"
|
||||
"typescript": "^5.2.2",
|
||||
"zod": "^3.22.2",
|
||||
"dotenv":"16.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bcrypt": "^5.0.1",
|
||||
"@types/react": "18.2.21",
|
||||
"@types/react-dom": "18.2.14",
|
||||
"dotenv": "^16.3.1",
|
||||
"prettier": "^3.0.3"
|
||||
"drizzle-kit": "^0.19.13",
|
||||
"prettier": "^3.0.3",
|
||||
"ts-node": "^10.9.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
|
||||
11
Websites/nextjs-dashboard/prisma/schema.prisma
Normal file
11
Websites/nextjs-dashboard/prisma/schema.prisma
Normal file
@ -0,0 +1,11 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
21
Websites/nextjs-dashboard/schema.ts
Normal file
21
Websites/nextjs-dashboard/schema.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { integer, serial, text, pgTable } from 'drizzle-orm/pg-core';
|
||||
import { relations } from 'drizzle-orm';
|
||||
|
||||
export const users = pgTable('users', {
|
||||
id: serial('id').primaryKey(),
|
||||
name: text('name').notNull(),
|
||||
});
|
||||
|
||||
export const usersRelations = relations(users, ({ many }) => ({
|
||||
posts: many(posts),
|
||||
}));
|
||||
|
||||
export const posts = pgTable('posts', {
|
||||
id: serial('id').primaryKey(),
|
||||
content: text('content').notNull(),
|
||||
authorId: integer('author_id').notNull(),
|
||||
});
|
||||
|
||||
export const postsRelations = relations(posts, ({ one }) => ({
|
||||
author: one(users, { fields: [posts.authorId], references: [users.id] }),
|
||||
}));
|
||||
Loading…
Reference in New Issue
Block a user