* added NoteService and related endpoints && tests * removed snapshots * corrected error in service * removed snapshot * added the ability to note down author using a string * updated model for note * refactored to access logged in user * added other user id option * removed snapshot * updated according to feedback * removed snapshots * reintroduced snapshots * updated to snake case * removed try catch from use-db
18 lines
447 B
JavaScript
18 lines
447 B
JavaScript
const Scrypt = require("scrypt-kdf")
|
|
const { User } = require("@medusajs/medusa")
|
|
|
|
module.exports = async (connection, data = {}) => {
|
|
const manager = connection.manager
|
|
|
|
const buf = await Scrypt.kdf("secret_password", { logN: 1, r: 1, p: 1 })
|
|
const password_hash = buf.toString("base64")
|
|
|
|
await manager.insert(User, {
|
|
id: "admin_user",
|
|
email: "admin@medusa.js",
|
|
api_token: "test_token",
|
|
password_hash,
|
|
...data,
|
|
})
|
|
}
|