change tags titleicon and summary to optional function in next database

This commit is contained in:
Jiaxin Peng
2024-03-17 14:36:55 +00:00
parent e0ec27ad07
commit a8ebab7fcb
7 changed files with 62 additions and 35 deletions

View File

@@ -88,9 +88,6 @@ export class Upload2NotionNext extends UploadBaseNext {
parent: {
database_id: databaseID,
},
icon: {
emoji: emoji || '📜'
},
properties: {
title: {
title: [
@@ -101,25 +98,11 @@ export class Upload2NotionNext extends UploadBaseNext {
},
],
},
tags: {
multi_select: tags && true ? tags.map(tag => {
return { "name": tag }
}) : [],
},
type: {
select: {
name: type || 'Post'
}
},
slug: {
rich_text: [
{
text: {
content: slug || ''
}
}
]
},
status: {
select: {
name: stats || 'Draft'
@@ -130,15 +113,7 @@ export class Upload2NotionNext extends UploadBaseNext {
name: category || 'Obsidian'
}
},
summary: {
rich_text: [
{
text: {
content: summary || ''
}
}
]
},
password: {
rich_text: [
{
@@ -165,6 +140,52 @@ export class Upload2NotionNext extends UploadBaseNext {
},
children: childArr,
}
// add tags
if (tags) {
bodyString.properties.tags = {
multi_select: tags.map(tag => {
return { "name": tag }
})
}
}
// add title icon
if (emoji) {
bodyString.icon = {
emoji: emoji
}
}
// add slug
if (slug) {
bodyString.properties.slug = {
rich_text: [
{
text: {
content: slug
}
}
]
}
}
// check if summary is available
if (summary) {
bodyString.properties.summary = {
rich_text: [
{
text: {
content: summary
}
}
]
}
}
if (cover) {
bodyString.cover = {
type: "external",