fix: db seeding
This commit is contained in:
parent
0df362a891
commit
0990b9c3fd
|
@ -147,6 +147,22 @@
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@faker-js/faker": {
|
||||||
|
"version": "8.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.3.1.tgz",
|
||||||
|
"integrity": "sha512-FdgpFxY6V6rLZE9mmIBb9hM0xpfvQOSNOLnzolzKwsE1DH+gC7lEKV1p1IbR0lAYyvYd5a4u3qWJzowUkw1bIw==",
|
||||||
|
"dev": true,
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fakerjs"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"engines": {
|
||||||
|
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
||||||
|
"npm": ">=6.14.13"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@floating-ui/core": {
|
"node_modules/@floating-ui/core": {
|
||||||
"version": "1.5.0",
|
"version": "1.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.5.0.tgz",
|
||||||
|
@ -181,22 +197,6 @@
|
||||||
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.6.tgz",
|
"resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.1.6.tgz",
|
||||||
"integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A=="
|
"integrity": "sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A=="
|
||||||
},
|
},
|
||||||
"node_modules/@faker-js/faker": {
|
|
||||||
"version": "8.3.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@faker-js/faker/-/faker-8.3.1.tgz",
|
|
||||||
"integrity": "sha512-FdgpFxY6V6rLZE9mmIBb9hM0xpfvQOSNOLnzolzKwsE1DH+gC7lEKV1p1IbR0lAYyvYd5a4u3qWJzowUkw1bIw==",
|
|
||||||
"dev": true,
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/fakerjs"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"engines": {
|
|
||||||
"node": "^14.17.0 || ^16.13.0 || >=18.0.0",
|
|
||||||
"npm": ">=6.14.13"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@heroicons/react": {
|
"node_modules/@heroicons/react": {
|
||||||
"version": "2.0.18",
|
"version": "2.0.18",
|
||||||
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz",
|
"resolved": "https://registry.npmjs.org/@heroicons/react/-/react-2.0.18.tgz",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"prisma": {
|
"prisma": {
|
||||||
"seed": "ts-node-esm prisma/seed.ts"
|
"seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|
|
@ -39,7 +39,7 @@ const Feed = ({
|
||||||
revalidateOnReconnect: false,
|
revalidateOnReconnect: false,
|
||||||
shouldRetryOnError: false,
|
shouldRetryOnError: false,
|
||||||
fallbackData:
|
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({
|
const articles = await prisma.article.findMany({
|
||||||
// ...query,
|
...query,
|
||||||
// skip: current,
|
skip: current,
|
||||||
// take: next,
|
take: next,
|
||||||
// });
|
});
|
||||||
|
|
||||||
const articles: Article[] = [
|
// const articles: Article[] = [
|
||||||
{
|
// {
|
||||||
id: 1,
|
// id: 1,
|
||||||
title: "Mock Article 1",
|
// title: "Mock Article 1",
|
||||||
slug: "This is a mock article.",
|
// slug: "This is a mock article.",
|
||||||
siteKey: "asdas",
|
// siteKey: "asdas",
|
||||||
url: "asdasd",
|
// url: "asdasd",
|
||||||
createdAt: new Date(),
|
// createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
// updatedAt: new Date(),
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
id: 2,
|
// id: 2,
|
||||||
title: "Mock Article 2",
|
// title: "Mock Article 2",
|
||||||
slug: "This is a mock article.",
|
// slug: "This is a mock article.",
|
||||||
siteKey: "asdas",
|
// siteKey: "asdas",
|
||||||
url: "asdasd",
|
// url: "asdasd",
|
||||||
createdAt: new Date(),
|
// createdAt: new Date(),
|
||||||
updatedAt: new Date(),
|
// updatedAt: new Date(),
|
||||||
},
|
// },
|
||||||
];
|
// ];
|
||||||
|
|
||||||
const nextPointer = articles.length >= limit ? next + limit : null;
|
const nextPointer = articles.length >= limit ? next + limit : null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue