diff --git a/package.json b/package.json index f781e68..6990463 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "dev": "cross-env NODE_ENV=development nodemon --delay 2.5 -e js,cjs,mjs --exec node dist/app.mjs", "test": "tsx test/**/*.ts", "dev:watch": "cross-env NODE_ENV=development concurrently -n \"Watch,Dev\" -c \"green,blue\" \"npm run watch\" \"sleep 1 && npm run dev\" ", - "build": "rimraf dist && rollup -c rollup.config.mjs" + "build": "rimraf dist && rollup -c rollup.config.mjs", + "ssl": "ssh -L 5432:172.21.32.9:5432 sky" }, "files": [ "dist", diff --git a/src/scripts/user-change-pwd.ts b/src/scripts/user-change-pwd.ts new file mode 100644 index 0000000..3db64c4 --- /dev/null +++ b/src/scripts/user-change-pwd.ts @@ -0,0 +1,46 @@ +import '../modules/init.ts'; +import { User, UserInit } from '../models/user.ts'; +import { Org, OrgInit } from '../models/org.ts'; +import { useContextKey } from '@kevisual/use-config/context'; +const sequelize = useContextKey('sequelize'); + +export const main = async () => { + // await UserInit(null ,null, { + // alter: true, + // }); + await UserInit(); + await OrgInit(); + + const user = await User.findOne({ + where: { + username: 'root', + }, + }); + if (!user) { + process.exit(0); + return; + } + await user.createPassword('silkyai2025'); + await user.save(); + + process.exit(0); +}; +// main(); + +export const changeDemo = async () => { + await UserInit(); + await OrgInit(); + + const user = await User.findOne({ + where: { + username: 'demo', + }, + }); + if (!user) { + process.exit(0); + } + await user.createPassword('123456'); + await user.save(); + process.exit(0); +}; +// changeDemo(); \ No newline at end of file