@rytass/cms-base-nestjs-module
Advanced tools
Comparing version 0.1.38 to 0.1.39
@@ -526,3 +526,3 @@ 'use strict'; | ||
function _ts_decorate$3(decorators, target, key, desc) { | ||
/* eslint-disable quotes */ function _ts_decorate$3(decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
@@ -790,3 +790,3 @@ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
if (!this.multipleLanguageMode) throw new MultipleLanguageModeIsDisabledError(); | ||
await runner.manager.save(Object.entries(options.multiLanguageContents).map(([language, content])=>this.baseArticleVersionContentRepo.create({ | ||
const savedContents = await runner.manager.save(Object.entries(options.multiLanguageContents).map(([language, content])=>this.baseArticleVersionContentRepo.create({ | ||
...content, | ||
@@ -797,4 +797,7 @@ articleId: article.id, | ||
}))); | ||
if (this.fullTextSearchMode) { | ||
await savedContents.map((articleContent)=>()=>this.bindSearchTokens(articleContent, options.tags, runner)).reduce((prev, next)=>prev.then(next), Promise.resolve()); | ||
} | ||
} else { | ||
await runner.manager.save(this.baseArticleVersionContentRepo.create({ | ||
const savedContent = await runner.manager.save(this.baseArticleVersionContentRepo.create({ | ||
...Object.entries(options).filter(([key])=>!~ArticleVersionContentNotIncludeFields.indexOf(key)).reduce((vars, [key, value])=>({ | ||
@@ -808,2 +811,5 @@ ...vars, | ||
})); | ||
if (this.fullTextSearchMode) { | ||
await this.bindSearchTokens(savedContent, options.tags, runner); | ||
} | ||
} | ||
@@ -810,0 +816,0 @@ await runner.commitTransaction(); |
{ | ||
"name": "@rytass/cms-base-nestjs-module", | ||
"version": "0.1.38", | ||
"version": "0.1.39", | ||
"description": "Rytass Content Management System NestJS Base Module", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
import { OnApplicationBootstrap } from '@nestjs/common'; | ||
import { DataSource, Repository } from 'typeorm'; | ||
import { BaseArticleEntity } from '../models/base-article.entity'; | ||
import { ArticleCreateDto } from '../typings/article-create.dto'; | ||
import { MultiLanguageArticleCreateDto, SingleArticleCreateDto } from '../typings/article-create.dto'; | ||
import { BaseArticleVersionEntity } from '../models/base-article-version.entity'; | ||
@@ -31,4 +31,6 @@ import { BaseArticleVersionContentEntity } from '../models/base-article-version-content.entity'; | ||
archive(id: string): Promise<void>; | ||
addVersion<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(id: string, options: Omit<ArticleCreateDto<A, AV, AVC>, 'version'>): Promise<A>; | ||
create<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(options: ArticleCreateDto<A, AV, AVC>): Promise<A>; | ||
addVersion<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(id: string, options: Omit<SingleArticleCreateDto<A, AV, AVC>, 'version'>): Promise<A>; | ||
addVersion<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(id: string, options: Omit<MultiLanguageArticleCreateDto<A, AV, AVC>, 'version'>): Promise<A>; | ||
create<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(options: SingleArticleCreateDto<A, AV, AVC>): Promise<A>; | ||
create<A extends ArticleEntity = ArticleEntity, AV extends ArticleVersionEntity = ArticleVersionEntity, AVC extends ArticleVersionContentEntity = ArticleVersionContentEntity>(options: MultiLanguageArticleCreateDto<A, AV, AVC>): Promise<A>; | ||
} |
@@ -15,3 +15,3 @@ import { Injectable, Inject, Logger, BadRequestException } from '@nestjs/common'; | ||
function _ts_decorate(decorators, target, key, desc) { | ||
/* eslint-disable quotes */ function _ts_decorate(decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
@@ -279,3 +279,3 @@ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
if (!this.multipleLanguageMode) throw new MultipleLanguageModeIsDisabledError(); | ||
await runner.manager.save(Object.entries(options.multiLanguageContents).map(([language, content])=>this.baseArticleVersionContentRepo.create({ | ||
const savedContents = await runner.manager.save(Object.entries(options.multiLanguageContents).map(([language, content])=>this.baseArticleVersionContentRepo.create({ | ||
...content, | ||
@@ -286,4 +286,7 @@ articleId: article.id, | ||
}))); | ||
if (this.fullTextSearchMode) { | ||
await savedContents.map((articleContent)=>()=>this.bindSearchTokens(articleContent, options.tags, runner)).reduce((prev, next)=>prev.then(next), Promise.resolve()); | ||
} | ||
} else { | ||
await runner.manager.save(this.baseArticleVersionContentRepo.create({ | ||
const savedContent = await runner.manager.save(this.baseArticleVersionContentRepo.create({ | ||
...Object.entries(options).filter(([key])=>!~ArticleVersionContentNotIncludeFields.indexOf(key)).reduce((vars, [key, value])=>({ | ||
@@ -297,2 +300,5 @@ ...vars, | ||
})); | ||
if (this.fullTextSearchMode) { | ||
await this.bindSearchTokens(savedContent, options.tags, runner); | ||
} | ||
} | ||
@@ -299,0 +305,0 @@ await runner.commitTransaction(); |
@@ -11,3 +11,2 @@ import { Language } from './language'; | ||
}; | ||
export type ArticleCreateDto<A extends BaseArticleEntity = BaseArticleEntity, AV extends BaseArticleVersionEntity = BaseArticleVersionEntity, AVC extends BaseArticleVersionContentEntity = BaseArticleVersionContentEntity> = SingleArticleCreateDto<A, AV, AVC> | MultiLanguageArticleCreateDto<A, AV, AVC>; | ||
export {}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
149696
3399