Skip to content

Instantly share code, notes, and snippets.

@medkhelifi
Last active October 22, 2021 20:41
Show Gist options
  • Save medkhelifi/2e38f0fa7e894f50639b9539d0e35c42 to your computer and use it in GitHub Desktop.
Save medkhelifi/2e38f0fa7e894f50639b9539d0e35c42 to your computer and use it in GitHub Desktop.
// Creer un utilisateur administrateur
User.findOrCreate({
where: {username:"admin", },
defaults: {
username: "admin",
email: "admin@gmail.com",
password: bcrypt.hashSync("admin", 4),
},
}).then((users) => {
users[0].setRoles([2]).then(() => {
({
message: "L'administrateur a été enregistré avec succès !",
});
});
})
.catch((err) => {
({ message: err.message });
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment