Skip to main content

ArticleBaseService

ArticleBaseService provides fundamental article operation functionalities, including creating new articles, adding versions, and searching for articles.

References

Methods

findById()

findById(id: string, options?: ArticleFindByIdBaseDto): Promise<ArticleBaseDto>

Parameters:

NameTypeDefaultDescription
iduuidArticle ID

ArticleFindByIdBaseDto:

NameTypeDefaultDescription
languagestringIf provided, multiple language mode article will return article like single language
onlyApprovedbooleanfalseWhen signature mode enabled, pass this args to filter approved version

findAll()

findAll(options?: ArticleFindAllDto): Promise<ArticleBaseDto[]>

Also support findCollection with same arguments to support pagination.

interface ArticleCollectionDto {
articles: ArticleBaseDto[];
total: number;
offset: number;
limit: number;
}

findCollection(options?: ArticleFindAllDto): Promise<ArticleCollectionDto>

Parameters:

NameTypeDefaultDescription
idsuuid[]Find articles in id list
categoryIdsuuid[]Category filter (At least one)
requiredCategoryIdsuuid[]Category filter (Required)
languagestringIf provided, multiple language mode article will return article like single language
sortedenumCREATED_AT_DESCCREATED_AT_DESC
searchTermstringSearch term in title, description, if use full_text_mode will find in contents
searchModeenumTITLETITLE
onlyApprovedbooleanfalseWhen signature mode enabled, pass this args to filter approved version
offsetnumber0Result list pagination offset
limitnumber20Result list pagination limit, max 100

Interfaces

ArticleBaseDto

ArticleBaseDto is union of SingleArticleBaseDto and MultiLanguageArticleBaseDto. It will automatically switch based on whether you have enabled the multilingual mode. When multilingual mode is not enabled, using findById or findAll queries will automatically return the article content in the SingleArticleBaseDto structure. Conversely, if multilingual mode is enabled, the content will be in the MultiLanguageArticleBaseDto structure. However, if you specify a language when querying in multilingual mode, the content returned to you will be in the SingleArticleBaseDto format and in the specified language.

SingleArticleBaseDto

Fields:

NameTypeDescription
iduuidArticle ID
createdAtDateArticle create time
deletedAtDateArticle delete time
versionnumberArticle version
categoriesBaseCategoryEntity[]Article categories
tagsstring[]Article tags
languagestringArticle language
titlestringArticle title
descriptionstringArticle description
contentQuadratsElement[]Article content

MultiLanguageArticleBaseDto

Fields:

NameTypeDescription
iduuidArticle ID
createdAtDateArticle create time
deletedAtDateArticle delete time
versionnumberArticle version
categoriesBaseCategoryEntity[]Article categories
tagsstring[]Article tags
multiLanguageContentsBaseArticleVersionContentEntity[]Article content