fix: universal curl sort on getAll

This commit is contained in:
Innei
2022-01-11 20:04:47 +08:00
parent 5bccc477be
commit ab6847e943
3 changed files with 3 additions and 9 deletions

View File

@@ -7,7 +7,7 @@
"license": "MIT",
"dashboard": {
"repo": "mx-space/admin-next",
"version": "3.11.5"
"version": "3.11.6"
},
"husky": {
"hooks": {

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@nestjs/common'
import { DocumentType } from '@typegoose/typegoose'
import { isDefined, isMongoId } from 'class-validator'
import { pick } from 'lodash'
import { FilterQuery } from 'mongoose'
import { InjectModel } from 'nestjs-typegoose'
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
@@ -128,12 +127,7 @@ export class NoteService {
})
process.nextTick(async () => {
await Promise.all([
this.webGateway.broadcast(
EventTypes.NOTE_DELETE,
pick(doc, ['_id', 'id', 'nid', 'created', 'modified']),
),
])
await Promise.all([this.webGateway.broadcast(EventTypes.NOTE_DELETE, id)])
})
}

View File

@@ -63,7 +63,7 @@ export function BaseCrudFactory<
@Get('/all')
async getAll() {
return await this._model.find({}).lean()
return await this._model.find({}).sort({ created: -1 }).lean()
}
@Post('/')