- Removed cruising stuff
- Added support for user submitted profiles
This commit is contained in:
@@ -26,7 +26,8 @@ const ProfileSchema = new Mongoose.Schema({
|
||||
"tested": { type: Date },
|
||||
"tribe": [{ type: String, enum: ['twink','trans','poz','leather','geek','discreet','otter','bear','daddy','jock','clean-cut'] }]
|
||||
},
|
||||
"messages" : [ { type: Messages.schema } ]
|
||||
"messages": [ { type: Messages.schema } ],
|
||||
"submitted": { type: Boolean, default: false }
|
||||
});
|
||||
|
||||
ProfileSchema.pre('findOneAndUpdate', function (next) {
|
||||
@@ -162,6 +163,64 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
allSubmitted: (e) => {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
ProfileModel
|
||||
.find({ submitted: { $eq: true } })
|
||||
.sort({ order: 1 })
|
||||
.populate({
|
||||
path: 'messages',
|
||||
select: 'text image isUser timestamp',
|
||||
options: { sort: { timestamp: 1 } }
|
||||
})
|
||||
.exec((err, result) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
promise.then((result) => {
|
||||
e.emit('all', null, result);
|
||||
})
|
||||
.catch((err) => {
|
||||
e.emit('all', err, null);
|
||||
});
|
||||
},
|
||||
|
||||
allVerified: (e) => {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
ProfileModel
|
||||
.find({ submitted: { $in: [ null, false ] } })
|
||||
.sort({ order: 1 })
|
||||
.populate({
|
||||
path: 'messages',
|
||||
select: 'text image isUser timestamp',
|
||||
options: { sort: { timestamp: 1 } }
|
||||
})
|
||||
.exec((err, result) => {
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
resolve(result);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
promise.then((result) => {
|
||||
e.emit('all', null, result);
|
||||
})
|
||||
.catch((err) => {
|
||||
e.emit('all', err, null);
|
||||
});
|
||||
},
|
||||
|
||||
allMessages: (e, profileId) => {
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
ProfileModel
|
||||
|
||||
Reference in New Issue
Block a user