diff --git a/package.json b/package.json index 5eccf814..854bf815 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "license": "MIT", "dashboard": { "repo": "mx-space/admin-next", - "version": "3.11.5" + "version": "3.11.6" }, "husky": { "hooks": { diff --git a/src/modules/note/note.service.ts b/src/modules/note/note.service.ts index 9f953bae..b46d7b18 100644 --- a/src/modules/note/note.service.ts +++ b/src/modules/note/note.service.ts @@ -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)]) }) } diff --git a/src/utils/crud.util.ts b/src/utils/crud.util.ts index 21ee24a6..56763f7a 100644 --- a/src/utils/crud.util.ts +++ b/src/utils/crud.util.ts @@ -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('/')