Skip to content

Commit 8099bb5

Browse files
committed
more resources
1 parent 30f6241 commit 8099bb5

File tree

5 files changed

+83
-0
lines changed

5 files changed

+83
-0
lines changed

petsoft/resources/evento-model.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
model EventoEvent {
2+
id Int @id @default(autoincrement())
3+
name String
4+
slug String @unique
5+
city String
6+
location String
7+
date DateTime
8+
organizerName String
9+
imageUrl String
10+
description String
11+
createdAt DateTime @default(now())
12+
updatedAt DateTime @updatedAt
13+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const config = {
2+
matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"],
3+
};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export default function Page({
2+
searchParams,
3+
}: {
4+
searchParams: { [key: string]: string | string[] | undefined };
5+
})
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { Prisma, PrismaClient } from "@prisma/client";
2+
import bcrypt from "bcrypt";
3+
4+
const prisma = new PrismaClient();
5+
6+
const userData: Prisma.UserCreateInput = {
7+
email: "example@gmail.com",
8+
hashedPassword: "",
9+
pets: {
10+
create: [
11+
{
12+
name: "Benjamin",
13+
ownerName: "John Doe",
14+
imageUrl:
15+
"https://images.unsplash.com/photo-1517849845537-4d257902454a?auto=format&fit=crop&q=100&w=1935&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
16+
age: 2,
17+
notes:
18+
"Doesn't like to be touched on the belly. Plays well with other dogs.",
19+
},
20+
{
21+
name: "Richard",
22+
ownerName: "Josephine Dane",
23+
imageUrl:
24+
"https://images.unsplash.com/photo-1583337130417-3346a1be7dee?auto=format&fit=crop&q=100&w=1964&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
25+
age: 5,
26+
notes: "Needs medication twice a day.",
27+
},
28+
{
29+
name: "Anna",
30+
ownerName: "Frank Doe",
31+
imageUrl:
32+
"https://images.unsplash.com/photo-1537151625747-768eb6cf92b2?auto=format&fit=crop&q=100&w=1970&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
33+
age: 4,
34+
notes: "Allergic to chicken.",
35+
},
36+
],
37+
},
38+
};
39+
40+
async function main() {
41+
console.log(`Start seeding ...`);
42+
43+
const hashedPassword = await bcrypt.hash("example", 10);
44+
userData.hashedPassword = hashedPassword;
45+
46+
await prisma.user.create({
47+
data: userData,
48+
});
49+
50+
console.log(`Seeding finished.`);
51+
}
52+
53+
main()
54+
.then(async () => {
55+
await prisma.$disconnect();
56+
})
57+
.catch(async (e) => {
58+
console.error(e);
59+
await prisma.$disconnect();
60+
process.exit(1);
61+
});

petsoft/resources/seed-script.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"

0 commit comments

Comments
 (0)