Add creator

This commit is contained in:
2022-01-07 00:27:14 +02:00
parent 129ce8cbc6
commit 0d0468e45c
5 changed files with 14 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ module.exports = function (options) {
if (translationArtifactVersion) {
// fork...
const forkedTranslationArtifactVersion = await db.TranslationArtifactVersion.create({
creatorId: request.user.id,
name: translationArtifactVersion.name,
artifactVersionId: translationArtifactVersion.artifactVersionId,
userId: request.user.id,
@@ -100,6 +101,7 @@ module.exports = function (options) {
if (artifactVersion.translationArtifactVersions.length == 0) {
// create a translationArtifactVersion with a new dialect...
return db.TranslationArtifactVersion.create({
creatorId: userId,
name: dialect.name,
artifactVersionId: artifactVersion.id,
dialectId: dialect.id,
@@ -108,6 +110,7 @@ module.exports = function (options) {
})
} else {
return db.TranslationArtifactVersion.create({
creatorId: userId,
name: artifactVersion.translationArtifactVersions[0].name,
artifactVersionId: artifactVersion.translationArtifactVersions[0].artifactVersionId,
userId: userId,

View File

@@ -44,6 +44,7 @@ module.exports = function (options) {
}).then(dialect => {
if (dialect) {
return db.Artifact.create({
creatorId: request.user.id,
name: request.body.name,
url: request.body.url,
dialectId: dialect.id,

View File

@@ -80,6 +80,7 @@ module.exports = function (options) {
})
.post(function(request, response, next) {
db.Project.create({
creatorId: request.user.id,
name: request.body.name,
description: request.body.description,
entityId: request.user.individualEntityUser.entityUser.entityId
@@ -175,6 +176,7 @@ module.exports = function (options) {
if (artifactVersion) {
const projectArtifactVersion = db.ProjectArtifactVersion.create({
creatorId: request.user.id,
projectId: project.id,
artifactVersionId: artifactVersion.id
})
@@ -260,6 +262,7 @@ module.exports = function (options) {
if (translationArtifactVersion) {
const projectTranslationArtifactVersion = db.ProjectTranslationArtifactVersion.create({
creatorId: request.user.id,
projectId: project.id,
translationArtifactVersionId: translationArtifactVersion.id
})
@@ -407,6 +410,7 @@ module.exports = function (options) {
}
})
const campaign = await db.Campaign.create({
creatorId: request.user.id,
name: request.body.name,
description: request.body.description,
// defaultSatoshis: [request.body.satoshis].flat()[0],

View File

@@ -194,6 +194,7 @@ module.exports = function (options) {
await chunk.translation.save()
} else {
translation = await db.Translation.create({
creatorId: request.user.id,
chunkId: chunk.id,
text: request.body.translatedText,
translationArtifactVersionId: request.params.id
@@ -249,6 +250,7 @@ module.exports = function (options) {
// TODO: Create a backTranslation...
backTranslatedArtifact = {}
return db.BackTranslation.create({
creatorId: request.user.id,
translationArtifactVersionId: translationArtifactVersion.id,
artifact: {
name: translationArtifactVersion.name + translationArtifactVersion.artifactVersion.artifact.name,
@@ -413,6 +415,7 @@ module.exports = function (options) {
if (translationArtifactVersion) {
// TODO: Create campaign...
const campaign = await db.Campaign.create({
creatorId: request.user.id,
name: request.body.name,
description: request.body.description,
// defaultSatoshis: [request.body.satoshis].flat()[0],
@@ -537,6 +540,7 @@ module.exports = function (options) {
if (translationArtifactVersion) {
// TODO: Create campaign...
const pledge = await db.Pledge.create({
creatorId: request.user.id,
message: request.body.message,
entityId: request.user.individualEntityUser.entityUser.entityId,
translationArtifactVersionPledges: [

View File

@@ -90,6 +90,7 @@ module.exports = function (options) {
if (artifactVersion && isString) {
const chunks = request.body.text.trim().split(/\r?\n\r?\n/)
db.Chapter.create({
creatorId: request.user.id,
name: chunks[0].trim(),
artifactVersionId: artifactVersion.id,
chunks: chunks.map((chunk,index) => {
@@ -250,6 +251,7 @@ module.exports = function (options) {
if (dialect) {
const translationArtifactVersion = await db.TranslationArtifactVersion.create({
creatorId: request.user.id,
name: dialect.name,
artifactVersionId: artifactVersion.id,
dialectId: dialect.id,