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 +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -14,5 +14,34 @@ export default {
14
14
* This gives you an opportunity to set up your data model,
15
15
* run jobs, or perform some special logic.
16
16
*/
17
- bootstrap ( /*{ strapi }*/ ) { } ,
17
+ async bootstrap ( { strapi } ) {
18
+ // First, find the role by its name
19
+ const user = {
20
+ "username" : "dummyUser" ,
21
+
22
+ "provider" : "local" ,
23
+ "password" : "dummyPassword" ,
24
+ "resetPasswordToken" : null ,
25
+ "confirmationToken" : null ,
26
+ "confirmed" : true ,
27
+ "blocked" : false ,
28
+ "role" : 1 ,
29
+ "old_pw_hash" : null ,
30
+ "migrated_pw" : false
31
+ }
32
+ try {
33
+ const count = await strapi . entityService . count ( "plugin::users-permissions.user" )
34
+ if ( count === 0 ) {
35
+ await strapi . entityService . create ( "plugin::users-permissions.user" , { data : user } )
36
+ console . log ( "SUCCESS: Created user on bootstrap" )
37
+ }
38
+ else {
39
+ console . log ( "INFO: User have already been created on bootstrap" )
40
+ }
41
+ }
42
+ catch ( err ) {
43
+ console . log ( "ERROR: Could not create user on bootstrap" )
44
+ console . log ( err . details )
45
+ }
46
+ }
18
47
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"extends" : " @strapi/typescript-utils/tsconfigs/server" ,
3
3
"compilerOptions" : {
4
+ "lib" : [" ES2015" , " dom" ],
4
5
"outDir" : " dist" ,
5
6
"rootDir" : " ."
6
7
},
You can’t perform that action at this time.
0 commit comments