mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-05-07 19:26:09 +02:00
feat(forums): add new fields lastNewTopic & lastNewTopic in mode
This commit is contained in:
@@ -39,7 +39,8 @@ exports.create = function (req, res) {
|
||||
exports.list = function (req, res) {
|
||||
Forum.find()
|
||||
.sort('order -createdat')
|
||||
.populate('lastTopic')
|
||||
.populate('lastNewTopic')
|
||||
.populate('lastReplyTopic')
|
||||
.populate('moderators', 'username displayName profileImageURL uploaded downloaded')
|
||||
.exec(function (err, forums) {
|
||||
if (err) {
|
||||
@@ -163,7 +164,8 @@ exports.forumByID = function (req, res, next, id) {
|
||||
}
|
||||
|
||||
Forum.findById(id)
|
||||
.populate('lastTopic')
|
||||
.populate('lastNewTopic')
|
||||
.populate('lastReplyTopic')
|
||||
.populate('moderators', 'username displayName profileImageURL uploaded downloaded')
|
||||
.exec(function (err, forum) {
|
||||
if (err) {
|
||||
|
||||
@@ -52,7 +52,11 @@ var ForumSchema = new Schema({
|
||||
default: 0
|
||||
},
|
||||
|
||||
lastTopic: {
|
||||
lastNewTopic: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Topic'
|
||||
},
|
||||
lastReplyTopic: {
|
||||
type: Schema.Types.ObjectId,
|
||||
ref: 'Topic'
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user