Add a tracker
This commit is contained in:
@@ -1120,6 +1120,93 @@ module.exports = function (options) {
|
||||
|
||||
})
|
||||
|
||||
router.route('/:id/tracker')
|
||||
.get(function(request, response, next) {
|
||||
db.Project.findByPk(request.params.id, {
|
||||
include: [
|
||||
{
|
||||
association: db.Project.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities,
|
||||
include: [
|
||||
{
|
||||
association: db.OwnerEntity.Entity,
|
||||
include: [
|
||||
{
|
||||
association: db.Entity.EntityUsers,
|
||||
required: false,
|
||||
where: {
|
||||
userId: request.user?.id ?? null
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}).then(async (project) => {
|
||||
if (project) {
|
||||
db.TranslationChapter.findAll({
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationChapter.TranslationChunks,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationChunk.Translation
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.TranslationChapter.TranslationArtifactVersion,
|
||||
required: true,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationArtifactVersion.ProjectTranslationArtifactVersions,
|
||||
required: true,
|
||||
where: {
|
||||
projectId: request.params.id
|
||||
},
|
||||
},
|
||||
{
|
||||
association: db.TranslationArtifactVersion.ArtifactVersion,
|
||||
include: [
|
||||
{
|
||||
association: db.ArtifactVersion.ProjectArtifactVersions
|
||||
},
|
||||
{
|
||||
association: db.ArtifactVersion.Artifact,
|
||||
include: [
|
||||
{
|
||||
association: db.Artifact.Dialect
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.TranslationArtifactVersion.Dialect
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
}).then(translationChapters => {
|
||||
response.display("project-tracker", {
|
||||
user: request.user,
|
||||
project: project,
|
||||
translationChapters: translationChapters
|
||||
})
|
||||
}).catch(error => {
|
||||
next(error)
|
||||
})
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
const getProjectArtifactVersion = (userId, project, artifactVersion) => {
|
||||
if (project.projectArtifactVersions.length == 0) {
|
||||
return db.ProjectArtifactVersion.create({
|
||||
|
||||
Reference in New Issue
Block a user