Skip to content

Commit

Permalink
Create unused function and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
dat-devuap committed Jan 29, 2025
1 parent 9a72736 commit 8b1a5d5
Showing 1 changed file with 0 additions and 73 deletions.
73 changes: 0 additions & 73 deletions implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,76 +74,3 @@ async function create_notion_database(params, userSettings) {
return { error: error.message };
}
}

function buildColumnSchema({
columnName,
columnType,
options = [],
format = "decimal",
formatDate,
formula = "",
}) {
const schema = {
properties: {},
};

// Define properties based on the column type
switch (columnType) {
case "title":
schema.properties[columnName] = { title: {} };
break;
case "rich_text":
schema.properties[columnName] = { rich_text: {} };
break;
case "number":
schema.properties[columnName] = { number: { format: format } };
break;
case "select":
schema.properties[columnName] = {
select: {
options: options.map((option) => ({ name: option })),
},
};
break;
case "multi_select":
schema.properties[columnName] = {
multi_select: {
options: options.map((option) => ({ name: option })),
},
};
break;
case "date":
schema.properties[columnName] = {
date: {
format: formatDate,
},
};
break;
case "checkbox":
schema.properties[columnName] = { checkbox: {} };
break;
case "url":
schema.properties[columnName] = { url: {} };
break;
case "email":
schema.properties[columnName] = { email: {} };
break;
case "phone_number":
schema.properties[columnName] = { phone_number: {} };
break;
case "formula":
schema.properties[columnName] = {
formula: {
expression: formula, // Formula expression goes here
},
};
break;
case "status":
schema.properties[columnName] = { status: {} };
break;
default:
throw new Error(`Unknown column type: ${columnType}`);
}

return schema;
}

0 comments on commit 8b1a5d5

Please sign in to comment.