@pubsweet/model-user

6.0.18 • Public • Published

Consists of two parts, the User and the Identity model. The User model contains a very basic set of user-related features (email, username, password hash, password reset token), and is complemented by the Identity model, which contains information about local (e.g. secondary email) or external identities (e.g. ORCID OAuth information).

To use the User model, you have to include it in the component list, and then require it in your code:

const { User, Identity } = require('@pubsweet/models')

You can then use the model as any other PubSweet model, e.g.

const user = {
  username: input.username,
  email: input.email,
  password: input.password,
}

const identity = {
  type: 'local',
  aff: input.aff,
  name: input.name,
  isDefault: true,
}
user.defaultIdentity = identity

const savedUser = await new User(user).saveGraph()

Dependencies (5)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @pubsweet/model-user

    Weekly Downloads

    149

    Version

    6.0.18

    License

    MIT

    Unpacked Size

    29.5 kB

    Total Files

    13

    Last publish

    Collaborators

    • jure
    • shockandaudrey
    • diversemix
    • andrei.c9
    • yannisbarlas