fix(scripts): use mysql.js registry in create-user instead of deleted barrel
This commit is contained in:
+1
-24
@@ -116,32 +116,9 @@ const createUser = async () => {
|
|||||||
await sequelize.authenticate();
|
await sequelize.authenticate();
|
||||||
console.log('✅ Connexion établie\n');
|
console.log('✅ Connexion établie\n');
|
||||||
|
|
||||||
// Initialize all models by calling their functions
|
const DB = require('../src/database/mysql');
|
||||||
const rawDB = require('../src/database/models/mysql');
|
|
||||||
|
|
||||||
// Call each model function to initialize it
|
|
||||||
rawDB.User();
|
|
||||||
rawDB.Role();
|
|
||||||
rawDB.Article();
|
|
||||||
rawDB.Tag();
|
|
||||||
rawDB.TagList();
|
|
||||||
rawDB.UserRoleXref();
|
|
||||||
rawDB.Follower();
|
|
||||||
rawDB.Favorite();
|
|
||||||
rawDB.Comment();
|
|
||||||
rawDB.Brand();
|
|
||||||
rawDB.Category();
|
|
||||||
rawDB.Packaging();
|
|
||||||
rawDB.Product();
|
|
||||||
rawDB.ProductCategoryXref();
|
|
||||||
rawDB.ProductTagXref();
|
|
||||||
|
|
||||||
// Also initialize relationships
|
|
||||||
require('../src/database/relationships')();
|
require('../src/database/relationships')();
|
||||||
|
|
||||||
// Get the initialized models from sequelize
|
|
||||||
const DB = sequelize.models;
|
|
||||||
|
|
||||||
// Hash password with same algorithm as UserService
|
// Hash password with same algorithm as UserService
|
||||||
const { salt, hash } = hashPassword(password);
|
const { salt, hash } = hashPassword(password);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user