|
|
@ -133,8 +133,10 @@ class MessageService extends TcService {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
converseId: new Types.ObjectId(converseId),
|
|
|
|
converseId: new Types.ObjectId(converseId),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.sort({ _id: -1 })
|
|
|
|
.limit(num)
|
|
|
|
.limit(num)
|
|
|
|
.exec(),
|
|
|
|
.exec()
|
|
|
|
|
|
|
|
.then((arr) => arr.reverse()),
|
|
|
|
this.adapter.model
|
|
|
|
this.adapter.model
|
|
|
|
.find({
|
|
|
|
.find({
|
|
|
|
_id: {
|
|
|
|
_id: {
|
|
|
@ -142,10 +144,13 @@ class MessageService extends TcService {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
converseId: new Types.ObjectId(converseId),
|
|
|
|
converseId: new Types.ObjectId(converseId),
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.sort({ _id: 1 })
|
|
|
|
.limit(num)
|
|
|
|
.limit(num)
|
|
|
|
.exec(),
|
|
|
|
.exec(),
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log({ prev, next });
|
|
|
|
|
|
|
|
|
|
|
|
return this.transformDocuments(ctx, {}, [...prev, message, ...next]);
|
|
|
|
return this.transformDocuments(ctx, {}, [...prev, message, ...next]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|