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 +18
-22
lines changed Expand file tree Collapse file tree 2 files changed +18
-22
lines changed Original file line number Diff line number Diff line change 1
- import { createUserSeed } from "./seed" ;
2
-
3
1
export default {
4
2
/**
5
3
* An asynchronous register function that runs before
@@ -17,17 +15,33 @@ export default {
17
15
* run jobs, or perform some special logic.
18
16
*/
19
17
async bootstrap ( { strapi } ) {
18
+ const amountOfUsers = 10 ;
20
19
try {
21
20
const count = await strapi . entityService . count ( "plugin::users-permissions.user" ) ;
22
21
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
+ }
24
38
console . log ( "SUCCESS: Created user on bootstrap" ) ;
25
39
} else {
26
40
console . log ( "INFO: User have already been created on bootstrap" ) ;
27
41
}
28
42
} catch ( err ) {
29
43
console . log ( "ERROR: Could not create user on bootstrap" ) ;
30
- console . log ( err . details ) ;
44
+ console . log ( err )
31
45
}
32
46
} ,
33
47
} ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments