Fork correctly

This commit is contained in:
2022-01-09 01:51:11 +02:00
parent f29ba94860
commit c917c9df54

View File

@@ -148,6 +148,14 @@ module.exports = function (options) {
where: { where: {
dialectId: dialect.id, dialectId: dialect.id,
} }
},
{
association: db.ArtifactVersion.Chapters,
include: [
{
association: db.Chapter.Chunks
}
]
} }
] ]
}) })
@@ -183,7 +191,21 @@ module.exports = function (options) {
entityId: entityId, 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: [ include: [
{ {
@@ -193,7 +215,15 @@ module.exports = function (options) {
association: db.Owner.OwnerEntities association: db.Owner.OwnerEntities
} }
] ]
} },
{
association: db.TranslationArtifactVersion.TranslationChapters,
include: [
{
association: db.TranslationChapter.TranslationChunks
}
]
},
] ]
}) })
} else { } else {
@@ -210,7 +240,21 @@ module.exports = function (options) {
entityId: entityId, 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: [ include: [
{ {
@@ -220,7 +264,15 @@ module.exports = function (options) {
association: db.Owner.OwnerEntities association: db.Owner.OwnerEntities
} }
] ]
} },
{
association: db.TranslationArtifactVersion.TranslationChapters,
include: [
{
association: db.TranslationChapter.TranslationChunks
}
]
},
] ]
}) })
} }