example/example-usage.js
async function signup (username, password, options = {}) {
    let { email = null, profile = {}, roles = [] } = options
    let user = await User.create({ username, email })
    user.sign = await UserSign.create({ user, password })
    user.profile = await UserProfile.create({ user, profile })
    user.roles = await UserRole.createBulk(roles.map((code) => ({ user, code })))
    await user.save()
    return user
  }
async function signup (username, password, options = {}) {
    let { email = null, profile = {}, roles = [] } = options
    let user = await User.create({ username, email })
    user.sign = await UserSign.create({ user, password })
    user.profile = await UserProfile.create({ user, profile })
    user.roles = await UserRole.createBulk(roles.map((code) => ({ user, code })))
    await user.save()
    return user
  }
async function signup ( username , password , options = { } ) { let { email = null , profile = { } , roles = [ ] } = options let user = await User . create ( { username , email } ) user . sign = await UserSign . create ( { user , password } ) user . profile = await UserProfile . create ( { user , profile } ) user . roles = await UserRole . createBulk ( roles . map ( ( code ) => ( { user , code } ) ) ) await user . save ( ) return user }
Signup an user
Signup an user