-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d45d956
commit ee404b1
Showing
8 changed files
with
17 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,14 @@ import { UserModel } from './models/user'; | |
import { getEnforcer } from '../../rbac'; | ||
import logger from '../../config/logger'; | ||
|
||
const loggerCtx = { context: 'auth-plugin-bootstrap' }; | ||
const email = '[email protected]'; | ||
|
||
export const bootstrap = async () => { | ||
const userCount = await UserModel.countDocuments({}); | ||
if (userCount === 0) { | ||
const superuser = new UserModel({ | ||
email: '[email protected]', | ||
email: email, | ||
password: await bcrypt.hash('superpassword', 10), // Use a secure password | ||
name: 'Super User', | ||
role: 'superadmin', | ||
|
@@ -33,8 +36,8 @@ export const bootstrap = async () => { | |
} | ||
} | ||
|
||
logger.info('Superuser created with email: [email protected]'); | ||
logger.info(`Superuser created with email: ${email}`); | ||
} else { | ||
logger.info('Users already exist. No superuser created.'); | ||
logger.info('Users already exist. No superuser created.', loggerCtx); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,4 @@ export class ItemInput { | |
@Field(() => Float) | ||
@prop({ required: true }) | ||
public price!: number; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
let pluginList; | ||
export default pluginList = [ | ||
'auth-plugin', | ||
'cart-plugin', | ||
'discount-plugin', | ||
'sample-plugin' | ||
] | ||
export default pluginList = ['auth-plugin', 'cart-plugin', 'discount-plugin', 'sample-plugin']; |