Skip to content

Commit

Permalink
chore: add check notion props easily
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroki0525 committed Jan 22, 2024
1 parent a87cfc8 commit 024ea31
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/ui/templates/generateDandoriNotionPages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { loadEnvFile } from "@dandori/libs";
import { tasks } from "./mock";
import { generateDandoriNotionPages } from "@dandori/ui";
import { Client } from "@notionhq/client";

// set environment variables like access token
loadEnvFile();
Expand All @@ -16,6 +17,21 @@ const databasePropertiesMap = {
"status.done": "",
};

const notion = new Client({ auth: process.env.NOTION_API_KEY });
async function getDatabaseSchema() {
try {
const response = await notion.databases.retrieve({
database_id: databaseId,
});
console.log(response);
} catch (error) {
console.error(error);
}
}

// check database schema if you want
await getDatabaseSchema();

await generateDandoriNotionPages(tasks, {
databaseId,
databasePropertiesMap,
Expand Down

0 comments on commit 024ea31

Please sign in to comment.