Skip to content

Instantly share code, notes, and snippets.

@dallinbjohnson
dallinbjohnson / relaters.js
Created July 29, 2021 17:28
Relate hooks for mongoose cross service relationships.
/* eslint-disable no-unused-vars */
const {TransactionManager} = require('feathers-mongoose');
const beginTransaction = require('./beginTransaction');
const {FeathersError/*, GeneralError*/} = require('@feathersjs/errors');
class relateOtoError extends FeathersError {
constructor(message, data) {
super(message, 'relateOto', 520, 'relateOtoError', data);
}
}
@dallinbjohnson
dallinbjohnson / HookSystem.js
Created July 29, 2021 17:19
Javascript HookSystem manager.
const lget = require('lodash.get');
const lset = require('lodash.set');
const lunset = require('lodash.unset');
const lisPlainObject = require('lodash.isplainobject');
const lisNil = require('lodash.isnil');
const lflattenDeep = require('lodash.flattendeep');
const lmergeWith = require('lodash.mergewith');
Array.prototype.insert = function (index, ...value) {
this.splice(index, 0, ...value);
@dallinbjohnson
dallinbjohnson / makeFindPaginateMixin.js
Last active July 27, 2021 16:47
This is a wrapper around the makeFindMixin for feathers vuex to help with pagination and example of using the makeFindPaginateMixin in the quasar framework.
import {makeFindMixin} from 'feathers-vuex';
const $lcamelCase = require('lodash.camelcase');
const $lupperFirst = require('lodash.upperfirst');
const $lomitBy = require('lodash.omitby');
const $lisNil = require('lodash.isnil');
const $lget = require('lodash.get');
const $lset = require('lodash.set');
export default function makeFindPaginateMixin(