diff --git a/server/router/fork/index.js b/server/router/fork/index.js index ea01e62..877c2ea 100644 --- a/server/router/fork/index.js +++ b/server/router/fork/index.js @@ -148,6 +148,14 @@ module.exports = function (options) { where: { dialectId: dialect.id, } + }, + { + association: db.ArtifactVersion.Chapters, + include: [ + { + association: db.Chapter.Chunks + } + ] } ] }) @@ -183,7 +191,21 @@ module.exports = function (options) { entityId: entityId, } ] - } + }, + translationChapters: artifactVersion.chapters.map(chapter => { + return { + creatorId: userId, + chapterId: chapter.id, + translationChunks: chapter.chunks.map(chunk => { + return { + creatorId: userId, + chunkId: chunk.id, + text: chunk.text, + index: chunk.index + } + }) + } + }) }, { include: [ { @@ -193,7 +215,15 @@ module.exports = function (options) { association: db.Owner.OwnerEntities } ] - } + }, + { + association: db.TranslationArtifactVersion.TranslationChapters, + include: [ + { + association: db.TranslationChapter.TranslationChunks + } + ] + }, ] }) } else { @@ -210,7 +240,21 @@ module.exports = function (options) { entityId: entityId, } ] - } + }, + translationChapters: artifactVersion.chapters.map(chapter => { + return { + creatorId: userId, + chapterId: chapter.id, + translationChunks: chapter.chunks.map(chunk => { + return { + creatorId: userId, + chunkId: chunk.id, + text: chunk.text, + index: chunk.index + } + }) + } + }) }, { include: [ { @@ -220,7 +264,15 @@ module.exports = function (options) { association: db.Owner.OwnerEntities } ] - } + }, + { + association: db.TranslationArtifactVersion.TranslationChapters, + include: [ + { + association: db.TranslationChapter.TranslationChunks + } + ] + }, ] }) }