@@ -156,7 +156,8 @@ export class NoteController {
|
||||
@Put('/:id')
|
||||
@Auth()
|
||||
async modify(@Body() body: NoteModel, @Param() params: MongoIdDto) {
|
||||
return await this.noteService.updateById(params.id, body)
|
||||
await this.noteService.updateById(params.id, body)
|
||||
return this.noteService.findOneByIdOrNid(params.id)
|
||||
}
|
||||
|
||||
@Patch('/:id')
|
||||
|
||||
@@ -48,12 +48,11 @@ export class PageService {
|
||||
this.imageService.saveImageDimensionsFromMarkdownText(
|
||||
doc.text,
|
||||
res.images,
|
||||
(images) => {
|
||||
async (images) => {
|
||||
res.images = images
|
||||
return res.save().then(() => {
|
||||
this.eventManager.broadcast(BusinessEvents.PAGE_UPDATE, res, {
|
||||
scope: EventScope.TO_SYSTEM,
|
||||
})
|
||||
await res.save()
|
||||
this.eventManager.broadcast(BusinessEvents.PAGE_UPDATE, res, {
|
||||
scope: EventScope.TO_SYSTEM,
|
||||
})
|
||||
},
|
||||
)
|
||||
|
||||
@@ -82,11 +82,13 @@ export class PostService {
|
||||
})
|
||||
|
||||
const doc = newPost.toJSON()
|
||||
const cloned = { ...doc }
|
||||
|
||||
// 双向关联
|
||||
await this.relatedEachOther(doc, relatedIds)
|
||||
|
||||
scheduleManager.schedule(async () => {
|
||||
const doc = cloned
|
||||
await Promise.all([
|
||||
this.imageService.saveImageDimensionsFromMarkdownText(
|
||||
doc.text,
|
||||
|
||||
@@ -38,8 +38,9 @@ export class ImageService implements OnModuleInit {
|
||||
const result = [] as ImageModel[]
|
||||
|
||||
const oldImagesMap = new Map(
|
||||
(originImages ?? []).map((image) => [image.src, image]),
|
||||
(originImages ?? []).map((image) => [image.src, { ...image }]),
|
||||
)
|
||||
|
||||
const task = [] as Promise<ImageModel>[]
|
||||
for (const src of newImages) {
|
||||
const originImage = oldImagesMap.get(src)
|
||||
|
||||
Reference in New Issue
Block a user