feat: move page
This commit is contained in:
@@ -109,10 +109,10 @@ module.exports = {
|
||||
* @param {Object} page Page to rename
|
||||
*/
|
||||
async renamed(page) {
|
||||
await this.index.deleteObject(page.sourceHash)
|
||||
await this.index.deleteObject(page.hash)
|
||||
await this.index.addObject({
|
||||
objectID: page.destinationHash,
|
||||
locale: page.localeCode,
|
||||
locale: page.destinationLocaleCode,
|
||||
path: page.destinationPath,
|
||||
title: page.title,
|
||||
description: page.description,
|
||||
|
@@ -255,7 +255,7 @@ module.exports = {
|
||||
documents: JSON.stringify([
|
||||
{
|
||||
type: 'delete',
|
||||
id: page.sourceHash
|
||||
id: page.hash
|
||||
}
|
||||
])
|
||||
}).promise()
|
||||
@@ -266,7 +266,7 @@ module.exports = {
|
||||
type: 'add',
|
||||
id: page.destinationHash,
|
||||
fields: {
|
||||
locale: page.localeCode,
|
||||
locale: page.destinationLocaleCode,
|
||||
path: page.destinationPath,
|
||||
title: page.title,
|
||||
description: page.description,
|
||||
|
@@ -191,13 +191,13 @@ module.exports = {
|
||||
await this.client.indexes.use(this.config.indexName).index([
|
||||
{
|
||||
'@search.action': 'delete',
|
||||
id: page.sourceHash
|
||||
id: page.hash
|
||||
}
|
||||
])
|
||||
await this.client.indexes.use(this.config.indexName).index([
|
||||
{
|
||||
id: page.destinationHash,
|
||||
locale: page.localeCode,
|
||||
locale: page.destinationLocaleCode,
|
||||
path: page.destinationPath,
|
||||
title: page.title,
|
||||
description: page.description,
|
||||
|
@@ -210,7 +210,7 @@ module.exports = {
|
||||
await this.client.delete({
|
||||
index: this.config.indexName,
|
||||
type: '_doc',
|
||||
id: page.sourceHash,
|
||||
id: page.hash,
|
||||
refresh: true
|
||||
})
|
||||
await this.client.index({
|
||||
@@ -219,7 +219,7 @@ module.exports = {
|
||||
id: page.destinationHash,
|
||||
body: {
|
||||
suggest: this.buildSuggest(page),
|
||||
locale: page.localeCode,
|
||||
locale: page.destinationLocaleCode,
|
||||
path: page.destinationPath,
|
||||
title: page.title,
|
||||
description: page.description,
|
||||
|
@@ -129,7 +129,7 @@ module.exports = {
|
||||
locale: page.localeCode,
|
||||
path: page.sourcePath
|
||||
}).update({
|
||||
locale: page.localeCode,
|
||||
locale: page.destinationLocaleCode,
|
||||
path: page.destinationPath
|
||||
})
|
||||
},
|
||||
|
Reference in New Issue
Block a user