This repository was archived by the owner on Jun 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { createUserSeed } from "./seed" ;
2
+
1
3
export default {
2
4
/**
3
5
* An asynchronous register function that runs before
@@ -15,7 +17,6 @@ export default {
15
17
* run jobs, or perform some special logic.
16
18
*/
17
19
async bootstrap ( { strapi } ) {
18
- // First, find the role by its name
19
20
const user = {
20
21
"username" : "dummyUser" ,
21
22
@@ -32,7 +33,7 @@ export default {
32
33
try {
33
34
const count = await strapi . entityService . count ( "plugin::users-permissions.user" )
34
35
if ( count === 0 ) {
35
- await strapi . entityService . create ( "plugin::users-permissions.user" , { data : user } )
36
+ createUserSeed ( strapi , 10 )
36
37
console . log ( "SUCCESS: Created user on bootstrap" )
37
38
}
38
39
else {
Original file line number Diff line number Diff line change
1
+ export async function createUserSeed ( strapi , amountOfUsers : number ) {
2
+ console . log ( "Function called" )
3
+
4
+ for ( let i = 0 ; i < amountOfUsers ; i ++ ) {
5
+ const user = {
6
+ "username" : `dummyUser${ i } ` ,
7
+ "email" : `dummyUser${ i } @example.com` ,
8
+ "provider" : "local" ,
9
+ "password" : "dummyPassword" ,
10
+ "resetPasswordToken" : null ,
11
+ "confirmationToken" : null ,
12
+ "confirmed" : true ,
13
+ "blocked" : false ,
14
+ "role" : 1 ,
15
+ "old_pw_hash" : null ,
16
+ "migrated_pw" : false
17
+ }
18
+ await strapi . entityService . create ( "plugin::users-permissions.user" , { data : user } )
19
+ }
20
+ }
You can’t perform that action at this time.
0 commit comments