feat: 初始化项目用户初始化修改
This commit is contained in:
@@ -176,19 +176,18 @@ export const initializeUser = async () => {
|
||||
console.info('[User count]', w.count);
|
||||
const password = '2e8a305521bba54f49638ed25e46adf3'; //123456
|
||||
const salt = '123';
|
||||
const users = [{ username: 'admin' }, { username: 'user' }, { username: 'root' }];
|
||||
if (w.count < 1) {
|
||||
const newUsers = await User.bulkCreate(
|
||||
users.map((user) => {
|
||||
return {
|
||||
...user,
|
||||
password,
|
||||
needChangePassword: true,
|
||||
salt,
|
||||
};
|
||||
}),
|
||||
);
|
||||
console.info('[create new Users]', newUsers);
|
||||
const root = await User.create({
|
||||
username: 'root',
|
||||
password: password,
|
||||
needChangePassword: true,
|
||||
type: 'user',
|
||||
description: '系统管理员',
|
||||
salt,
|
||||
});
|
||||
const org = await User.createOrg('admin', root.id, '管理员');
|
||||
console.info(' new Users name', root.username, org.username);
|
||||
console.info('new Users id', root.id, org.id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user