How to use the feathers-hooks-common.populate function in feathers-hooks-common

To help you get started, we’ve selected a few feathers-hooks-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Human-Connection / API / server / services / users / users.hooks.js View on Github external
removeAllRelatedUserData()
    ]
  },

  after: {
    all: [
      cleanupBasicData
    ],
    find: [
      when(isModerator(),
        populate({ schema: userSettingsSchema })
      ),
      when(isSingleItem(),
        populate({ schema: badgesSchema }),
        populate({ schema: candosSchema }),
        populate({ schema: userSettingsSchema })
      ),
      thumbnails(thumbnailOptions),
      cleanupPersonalData
    ],
    get: [
      populate({ schema: badgesSchema }),
      populate({ schema: candosSchema }),
      populate({ schema: userSettingsSchema }),
      thumbnails(thumbnailOptions),
      // remove personal data if its not the current authenticated user
      iff(isOwnEntry(false),
        cleanupPersonalData
      ),
      iff(isOwnEntry(),
        populate({ schema: userSettingsPrivateSchema })
      )
github Human-Connection / API / server / services / organizations / organizations.hooks.js View on Github external
isVerified(),
      stashBefore(),
      restrictToOwnerOrModerator({ isEnabled: true })
    ]
  },

  after: {
    all: [
      xss({ fields: xssFields }),
      populate({ schema: reviewerSchema })
      // populate({ schema: userSchema }),
      // populate({ schema: followerSchema })
    ],
    find: [
      when(isSingleItem(),
        populate({schema: categoriesSchema})
      ),
      thumbnails(thumbnailOptions)
    ],
    get: [
      populate({schema: categoriesSchema}),
      thumbnails(thumbnailOptions)
    ],
    create: [
      thumbnails(thumbnailOptions)
    ],
    update: [
      thumbnails(thumbnailOptions)
    ],
    patch: [],
    remove: []
  },
github Human-Connection / API / server / services / users / users.hooks.js View on Github external
populate({ schema: userSettingsSchema })
      ),
      thumbnails(thumbnailOptions),
      cleanupPersonalData
    ],
    get: [
      populate({ schema: badgesSchema }),
      populate({ schema: candosSchema }),
      populate({ schema: userSettingsSchema }),
      thumbnails(thumbnailOptions),
      // remove personal data if its not the current authenticated user
      iff(isOwnEntry(false),
        cleanupPersonalData
      ),
      iff(isOwnEntry(),
        populate({ schema: userSettingsPrivateSchema })
      )
    ],
    create: [
      when(isProvider('external'),
        sendVerificationEmail()
      ),
      when(isProvider('external'),
        removeVerification()
      ),
      thumbnails(thumbnailOptions),
      inviteCode.after
    ],
    update: [
      thumbnails(thumbnailOptions)
    ],
    patch: [],
github Human-Connection / API / server / services / users / users.hooks.js View on Github external
saveRemoteImages(['avatar', 'coverImg'])
    ],
    remove: [
      ...restrict,
      disableMultiItemChange(),
      removeAllRelatedUserData()
    ]
  },

  after: {
    all: [
      cleanupBasicData
    ],
    find: [
      when(isModerator(),
        populate({ schema: userSettingsSchema })
      ),
      when(isSingleItem(),
        populate({ schema: badgesSchema }),
        populate({ schema: candosSchema }),
        populate({ schema: userSettingsSchema })
      ),
      thumbnails(thumbnailOptions),
      cleanupPersonalData
    ],
    get: [
      populate({ schema: badgesSchema }),
      populate({ schema: candosSchema }),
      populate({ schema: userSettingsSchema }),
      thumbnails(thumbnailOptions),
      // remove personal data if its not the current authenticated user
      iff(isOwnEntry(false),
github Human-Connection / API / server / services / users / users.hooks.js View on Github external
disableMultiItemChange(),
      removeAllRelatedUserData()
    ]
  },

  after: {
    all: [
      cleanupBasicData
    ],
    find: [
      when(isModerator(),
        populate({ schema: userSettingsSchema })
      ),
      when(isSingleItem(),
        populate({ schema: badgesSchema }),
        populate({ schema: candosSchema }),
        populate({ schema: userSettingsSchema })
      ),
      thumbnails(thumbnailOptions),
      cleanupPersonalData
    ],
    get: [
      populate({ schema: badgesSchema }),
      populate({ schema: candosSchema }),
      populate({ schema: userSettingsSchema }),
      thumbnails(thumbnailOptions),
      // remove personal data if its not the current authenticated user
      iff(isOwnEntry(false),
        cleanupPersonalData
      ),
      iff(isOwnEntry(),
        populate({ schema: userSettingsPrivateSchema })
github kieusonlam / vue-feathers-wepack / src / services / post / hooks / index.js View on Github external
'use strict';

const process = require('./process');

const globalHooks = require('../../../hooks');
const hooks = require('feathers-hooks-common');
const auth = require('feathers-authentication').hooks;

const populateAuthor = hooks.populate({
  schema: {
    include: [{
      service: 'users',
      nameAs: 'authorInfo',
      parentField: 'author',
      childField: '_id'
    }]
  }
});

exports.before = {
  all: [],
  find: [],
  get: [],
  create: [
    auth.verifyToken(),
github phoomparin / FlipED / src / services / authentication.js View on Github external
this.service("authentication").before({
    create: [
      auth.hooks.authenticate(["jwt", "local"])
    ]
  })

  this.service("authManagement").before({
    create: [
      hooks.iff(
        isAction("passwordChange", "identityChange"),
        auth.hooks.authenticate(["jwt", "local"])
      ),
      hooks.iff(
        isAction("resendVerifySignup", "passwordChange", "identityChange"),
        hooks.populate({
          include: {
            service: "users"
          }
        })
      )
    ]
  })
}