fix: db seeding
This commit is contained in:
parent
0df362a891
commit
0990b9c3fd
File diff suppressed because it is too large
Load Diff
74
package.json
74
package.json
|
@ -1,43 +1,43 @@
|
|||
{
|
||||
"name": "web3.news",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "ts-node-esm prisma/seed.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"name": "web3.news",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"prisma": {
|
||||
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@heroicons/react": "^2.0.18",
|
||||
"@radix-ui/react-icons": "^1.3.0",
|
||||
"@prisma/client": "^5.6.0",
|
||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||
"@radix-ui/react-select": "^2.0.0",
|
||||
"clsx": "^2.0.0",
|
||||
"date-fns": "^2.30.0",
|
||||
"next": "14.0.2",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"next": "14.0.2",
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"tailwind-merge": "^2.0.0",
|
||||
"swr": "^2.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^8.3.1",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.0.2",
|
||||
"postcss": "^8",
|
||||
"prisma": "^5.6.0",
|
||||
"tailwindcss": "^3.3.0",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5"
|
||||
}
|
||||
"swr": "^2.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@faker-js/faker": "^8.3.1",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"autoprefixer": "^10.0.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.0.2",
|
||||
"postcss": "^8",
|
||||
"prisma": "^5.6.0",
|
||||
"tailwindcss": "^3.3.0",
|
||||
"tailwindcss-animate": "^1.0.7",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ const Feed = ({
|
|||
revalidateOnReconnect: false,
|
||||
shouldRetryOnError: false,
|
||||
fallbackData:
|
||||
currentPage === 0 ? { data: initialData, current: 0 } : undefined, // Use initialData only for the first page
|
||||
currentPage === 0 ? { data: initialData, current: 0, next: 5 } : undefined, // Use initialData only for the first page
|
||||
},
|
||||
);
|
||||
|
||||
|
|
|
@ -39,32 +39,32 @@ export async function fetchFeedData({
|
|||
}
|
||||
}
|
||||
|
||||
// const articles = await prisma.article.findMany({
|
||||
// ...query,
|
||||
// skip: current,
|
||||
// take: next,
|
||||
// });
|
||||
const articles = await prisma.article.findMany({
|
||||
...query,
|
||||
skip: current,
|
||||
take: next,
|
||||
});
|
||||
|
||||
const articles: Article[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: "Mock Article 1",
|
||||
slug: "This is a mock article.",
|
||||
siteKey: "asdas",
|
||||
url: "asdasd",
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "Mock Article 2",
|
||||
slug: "This is a mock article.",
|
||||
siteKey: "asdas",
|
||||
url: "asdasd",
|
||||
createdAt: new Date(),
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
];
|
||||
// const articles: Article[] = [
|
||||
// {
|
||||
// id: 1,
|
||||
// title: "Mock Article 1",
|
||||
// slug: "This is a mock article.",
|
||||
// siteKey: "asdas",
|
||||
// url: "asdasd",
|
||||
// createdAt: new Date(),
|
||||
// updatedAt: new Date(),
|
||||
// },
|
||||
// {
|
||||
// id: 2,
|
||||
// title: "Mock Article 2",
|
||||
// slug: "This is a mock article.",
|
||||
// siteKey: "asdas",
|
||||
// url: "asdasd",
|
||||
// createdAt: new Date(),
|
||||
// updatedAt: new Date(),
|
||||
// },
|
||||
// ];
|
||||
|
||||
const nextPointer = articles.length >= limit ? next + limit : null;
|
||||
|
||||
|
|
Loading…
Reference in New Issue