diff --git a/src/scripts/sync-user.ts b/src/scripts/sync-user.ts index 6a987c3..b31f6ad 100644 --- a/src/scripts/sync-user.ts +++ b/src/scripts/sync-user.ts @@ -1,5 +1,5 @@ import { sequelize } from '../modules/sequelize.ts'; -import { User, UserInit } from '../models/user.ts'; +import { User, UserInit, UserServices, Org, OrgInit } from '@kevisual/code-center-module/models'; // User.sync({ alter: true, logging: true }).then(() => { // console.log('sync user done'); @@ -12,8 +12,11 @@ import { User, UserInit } from '../models/user.ts'; // } // } export const main = async () => { - - await UserInit(null, null, { + await UserInit(sequelize, null, { + alter: true, + logging: false, + }); + await OrgInit(sequelize, null, { alter: true, logging: false, }); @@ -23,4 +26,23 @@ export const main = async () => { } }; -main(); +// main(); +export const changeRootPassword = async () => { + await OrgInit(sequelize, null, { + alter: true, + logging: false, + }); + await UserInit(sequelize, null, { + alter: true, + logging: false, + }); + const user = await User.findOne({ where: { username: 'root' } }); + if (user) { + await user.createPassword('123456'); + await user.save(); + console.log('change root password done'); + process.exit(0); + } +}; + +changeRootPassword(); diff --git a/submodules/pay-center-code b/submodules/pay-center-code index b6bb10c..6309a57 160000 --- a/submodules/pay-center-code +++ b/submodules/pay-center-code @@ -1 +1 @@ -Subproject commit b6bb10caca26961a31757591ad20f92a1ef95894 +Subproject commit 6309a577f73fd27ab284270f56a7f83c5d8e4569