Adding owner (for multiple enity association)
This commit is contained in:
@@ -308,7 +308,13 @@ module.exports = function (options) {
|
||||
artifactVersionId: translationArtifactVersion.artifactVersionId,
|
||||
dialectId: translationArtifactVersion.dialect.id,
|
||||
backTranslationFromId: translationArtifactVersion.id,
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
owner: {
|
||||
ownerEntities: [
|
||||
{
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
}
|
||||
]
|
||||
},
|
||||
translationChapters: translationArtifactVersion.translationChapters.map(translationChapter => {
|
||||
return {
|
||||
creatorId: request.user.id,
|
||||
@@ -332,6 +338,14 @@ module.exports = function (options) {
|
||||
association: db.TranslationChapter.TranslationChunks
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.TranslationArtifactVersionCampaign.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -450,19 +464,49 @@ module.exports = function (options) {
|
||||
description: request.body.description,
|
||||
// defaultSatoshis: [request.body.satoshis].flat()[0],
|
||||
defaultSatoshis: request.body.satoshis,
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
owner: {
|
||||
ownerEntities: [
|
||||
{
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
}
|
||||
]
|
||||
},
|
||||
translationArtifactVersionCampaigns: [
|
||||
{
|
||||
creatorId: request.user.id,
|
||||
translationArtifactVersionId: translationArtifactVersion.id,
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
owner: {
|
||||
ownerEntities: [
|
||||
{
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
}
|
||||
]
|
||||
},
|
||||
satoshis: request.body.satoshis
|
||||
}
|
||||
]
|
||||
}, {
|
||||
include: [
|
||||
{
|
||||
association: db.Campaign.TranslationArtifactVersionCampaigns
|
||||
association: db.Campaign.TranslationArtifactVersionCampaigns,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationArtifactVersionCampaign.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.Campaign.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -573,19 +617,49 @@ module.exports = function (options) {
|
||||
const pledge = await db.Pledge.create({
|
||||
creatorId: request.user.id,
|
||||
message: request.body.message,
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
owner: {
|
||||
ownerEntities: [
|
||||
{
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId
|
||||
}
|
||||
]
|
||||
},
|
||||
translationArtifactVersionPledges: [
|
||||
{
|
||||
creatorId: request.user.id,
|
||||
translationArtifactVersionId: translationArtifactVersion.id,
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
owner: {
|
||||
ownerEntities: [
|
||||
{
|
||||
entityId: request.user.individualEntityUser.entityUser.entityId,
|
||||
}
|
||||
]
|
||||
},
|
||||
satoshis: request.body.satoshis
|
||||
}
|
||||
]
|
||||
}, {
|
||||
include: [
|
||||
{
|
||||
association: db.Pledge.TranslationArtifactVersionPledges
|
||||
association: db.Pledge.TranslationArtifactVersionPledges,
|
||||
include: [
|
||||
{
|
||||
association: db.TranslationArtifactVersionPledge.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
association: db.Pledge.Owner,
|
||||
include: [
|
||||
{
|
||||
association: db.Owner.OwnerEntities
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user