- add: createPushSubscription :
'Subscribed to FreePlanet.app!', 'You can now receive Notification and Messages.'
This commit is contained in:
@@ -4,6 +4,8 @@ const Schema = mongoose.Schema;
|
||||
mongoose.Promise = global.Promise;
|
||||
mongoose.level = "F";
|
||||
|
||||
const { ObjectID } = require('mongodb');
|
||||
|
||||
// Resolving error Unknown modifier: $pushAll
|
||||
mongoose.plugin(schema => {
|
||||
schema.options.usePushEach = true
|
||||
@@ -13,6 +15,7 @@ mongoose.plugin(schema => {
|
||||
const SubscriberSchema = new Schema({
|
||||
endpoint: String,
|
||||
keys: Schema.Types.Mixed,
|
||||
userId: String,
|
||||
createDate: {
|
||||
type: Date,
|
||||
default: Date.now
|
||||
|
||||
@@ -67,7 +67,7 @@ TodoSchema.methods.toJSON = function () {
|
||||
var todo = this;
|
||||
var todoObject = todo.toObject();
|
||||
|
||||
console.log(todoObject);
|
||||
// console.log(todoObject);
|
||||
|
||||
return _.pick(todoObject, ['_id', 'userId', 'pos', 'category', 'descr', 'priority', 'completed', 'created_at', 'modify_at',
|
||||
'completed_at', 'expiring_at', 'enableExpiring', 'id_prev', 'id_next', 'progress', 'modified']);
|
||||
|
||||
@@ -82,7 +82,7 @@ UserSchema.methods.toJSON = function () {
|
||||
};
|
||||
|
||||
UserSchema.methods.generateAuthToken = function () {
|
||||
console.log("GENERA TOKEN : ");
|
||||
// console.log("GENERA TOKEN : ");
|
||||
var user = this;
|
||||
var access = 'auth';
|
||||
var token = jwt.sign({ _id: user._id.toHexString(), access }, process.env.SIGNCODE).toString();
|
||||
@@ -130,8 +130,8 @@ UserSchema.statics.findByCredentials = function (username, password) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
// Use bcrypt.compare to compare password and user.password
|
||||
console.log("pwd1 " + password);
|
||||
console.log("pwd2 " + pwd);
|
||||
// console.log("pwd1 " + password);
|
||||
// console.log("pwd2 " + pwd);
|
||||
bcrypt.compare(password, pwd, (err, res) => {
|
||||
if (res) {
|
||||
resolve(user);
|
||||
|
||||
Reference in New Issue
Block a user