api-seed-mixins
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -85,3 +85,22 @@ 'use strict' | ||
ctx.instance.active = true | ||
invite.updateAttribute('used', true, () => {}) | ||
invite.updateAttributes({ invitedUserId: ctx.instance.id, used: true }) | ||
if (!invite.admin && Model.app.models.Referral) { | ||
Model.app.models.Referral.count( | ||
{ | ||
referrerUserId: invite.userId, | ||
referredUserId: ctx.instance.id | ||
}, | ||
(err, count) => { | ||
if (err) return console.error(err) | ||
if (count === 0) { | ||
Model.app.models.Referral.create({ | ||
referrerUserId: invite.userId, | ||
referredUserId: ctx.instance.id | ||
}) | ||
} | ||
} | ||
) | ||
} | ||
} | ||
@@ -107,3 +126,3 @@ | ||
invitedUserId: uid, | ||
user: true | ||
used: true | ||
} | ||
@@ -129,16 +148,24 @@ }, | ||
} else { | ||
invite.used = true | ||
invite.invitedUserId = user.id | ||
invite.save(err => { | ||
if (err) { | ||
fn(err) | ||
} else { | ||
user.active = true | ||
user.save(err => { | ||
if (err) { | ||
fn(err) | ||
} else { | ||
fn() | ||
invite.updateAttributes({ invitedUserId: user.id, used: true }, err => { | ||
if (err) return fn(err) | ||
user.updateAttributes({ active: true }, fn) | ||
if (!invite.admin && Model.app.models.Referral) { | ||
Model.app.models.Referral.count( | ||
{ | ||
referrerUserId: invite.userId, | ||
referredUserId: user.id | ||
}, | ||
(err, count) => { | ||
if (err) return console.error(err) | ||
if (count === 0) { | ||
Model.app.models.Referral.create({ | ||
referrerUserId: invite.userId, | ||
referredUserId: user.id | ||
}) | ||
} | ||
} | ||
}) | ||
) | ||
} | ||
@@ -145,0 +172,0 @@ }) |
@@ -81,3 +81,3 @@ 'use strict' | ||
var params = { | ||
Bucket: opts.Bucket || options.Bucket || app.get('s3Bucket'), | ||
Bucket: options.Bucket || app.get('s3Bucket'), | ||
Key: s3File.key | ||
@@ -84,0 +84,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"name":"api-seed-mixins","version":"0.2.1","description":"Mixins used in api-seed","main":"mixins","scripts":{"test":"jest","test:watch":"jest --watch","ci":"jest --runInBand --coverage && npm run lint","lint":"eslint --ignore-path .gitignore .","commit":"git-cz","precommit":"lint-staged","semantic-release":"semantic-release pre && npm publish && semantic-release post","prettier":"prettier --write \"./**/*.{js,json}\""},"jest":{"testEnvironment":"node","testMatch":["<rootDir>/spec/**/?(*.)(spec|test).js?(x)"]},"lint-staged":{"*.{js,json}":["prettier --write","git add"]},"repository":{"type":"git","url":"https://github.com/JonnyBGod/api-seed-mixins.git"},"author":"João Ribeiro <jonnybgod@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/JonnyBGod/api-seed-mixins/issues"},"homepage":"https://github.com/JonnyBGod/api-seed-mixins#readme","devDependencies":{"commitizen":"^2.9.6","coveralls":"^3.0.0","cz-conventional-changelog":"^2.1.0","eslint":"^4.11.0","eslint-config-prettier":"^2.8.0","eslint-plugin-jest":"^21.3.2","eslint-plugin-prettier":"^2.3.1","husky":"^0.14.3","jest":"^21.2.1","lint-staged":"^5.0.0","prettier":"^1.8.2","semantic-release":"^8.2.0","supertest":"^3.0.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"aws-sdk":"^2.154.0","loopback-include-through-mixin":"^1.0.5","qrcode":"^1.0.0","slugify":"^1.2.4","speakeasy":"^2.0.0"}} | ||
{"name":"api-seed-mixins","version":"0.2.2","description":"Mixins used in api-seed","main":"mixins","scripts":{"test":"jest","test:watch":"jest --watch","ci":"jest --runInBand --coverage && npm run lint","lint":"eslint --ignore-path .gitignore .","commit":"git-cz","precommit":"lint-staged","semantic-release":"semantic-release pre && npm publish && semantic-release post","prettier":"prettier --write \"./**/*.{js,json}\""},"jest":{"testEnvironment":"node","testMatch":["<rootDir>/spec/**/?(*.)(spec|test).js?(x)"]},"lint-staged":{"*.{js,json}":["prettier --write","git add"]},"repository":{"type":"git","url":"https://github.com/JonnyBGod/api-seed-mixins.git"},"author":"João Ribeiro <jonnybgod@gmail.com>","license":"MIT","bugs":{"url":"https://github.com/JonnyBGod/api-seed-mixins/issues"},"homepage":"https://github.com/JonnyBGod/api-seed-mixins#readme","devDependencies":{"commitizen":"^2.9.6","coveralls":"^3.0.0","cz-conventional-changelog":"^2.1.0","eslint":"^4.11.0","eslint-config-prettier":"^2.8.0","eslint-plugin-jest":"^21.3.2","eslint-plugin-prettier":"^2.3.1","husky":"^0.14.3","jest":"^21.2.1","lint-staged":"^5.0.0","prettier":"^1.8.2","semantic-release":"^8.2.0","supertest":"^3.0.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"dependencies":{"aws-sdk":"^2.154.0","loopback-include-through-mixin":"^1.0.5","qrcode":"^1.0.0","slugify":"^1.2.4","speakeasy":"^2.0.0"}} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51471
1747