Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 30565f7

Browse files
committed
fix(cms): Move seed creation into index.ts
1 parent 710e8c3 commit 30565f7

File tree

2 files changed

+18
-22
lines changed

2 files changed

+18
-22
lines changed

cms/src/index.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { createUserSeed } from "./seed";
2-
31
export default {
42
/**
53
* An asynchronous register function that runs before
@@ -17,17 +15,33 @@ export default {
1715
* run jobs, or perform some special logic.
1816
*/
1917
async bootstrap({ strapi }) {
18+
const amountOfUsers = 10;
2019
try {
2120
const count = await strapi.entityService.count("plugin::users-permissions.user");
2221
if (count === 0) {
23-
createUserSeed(strapi, 10);
22+
for (let i = 0; i < amountOfUsers; i++) {
23+
const user = {
24+
username: `dummyUser${i}`,
25+
email: `dummyUser${i}@example.com`,
26+
provider: "local",
27+
password: "dummyPassword",
28+
resetPasswordToken: null,
29+
confirmationToken: null,
30+
confirmed: true,
31+
blocked: false,
32+
role: 1,
33+
old_pw_hash: null,
34+
migrated_pw: false,
35+
};
36+
await strapi.entityService.create("plugin::users-permissions.user", {data: user});
37+
}
2438
console.log("SUCCESS: Created user on bootstrap");
2539
} else {
2640
console.log("INFO: User have already been created on bootstrap");
2741
}
2842
} catch (err) {
2943
console.log("ERROR: Could not create user on bootstrap");
30-
console.log(err.details);
44+
console.log(err)
3145
}
3246
},
3347
};

cms/src/seed.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)