ADD: Seeder and User Seeder
ADD: Chalk package
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
const User = require('./userModel')
|
||||
const chalk = require('chalk')
|
||||
const runSeeder = async () => {
|
||||
const users = [
|
||||
{
|
||||
_id: '66ddb52302f30f105de39e61',
|
||||
name: 'main admin',
|
||||
email: 'superadmin@chayamarket.ir',
|
||||
password: '$2a$10$pabxmRjm6klipAC6vBvgI.J.GJpnG//L1MeNcdbtxuYQRYHLI/I3O',
|
||||
phoneNumber: '+989123456789',
|
||||
favorites: [],
|
||||
isVerified: false,
|
||||
isCompleted: false,
|
||||
shippingAddress: [],
|
||||
bankAccount: [],
|
||||
role: '66a2da5b9b989a8909948848',
|
||||
},
|
||||
]
|
||||
|
||||
await User.deleteMany({})
|
||||
console.log(chalk.red('Deleted all user records.'))
|
||||
|
||||
await User.insertMany(users, null)
|
||||
console.log(chalk.green.bold(`USER: Created ${users.length} user(s)`))
|
||||
}
|
||||
|
||||
module.exports = { runSeeder }
|
||||
Reference in New Issue
Block a user