Skip to content

Commit

Permalink
add if when the database has types
Browse files Browse the repository at this point in the history
  • Loading branch information
LuigimonSoft committed Aug 29, 2024
1 parent c76d2ec commit fcdb872
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/exportAs/documentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export function jsonToDocumentation(obj) {
return `- **${startTable} to ${endTable}**: ${r.cardinality}\n`;
}).join("") : "";

const documentationTypes = obj.types.map((type) => {
const documentationTypes = databases[obj.database].hasTypes && obj.types.length > 0 ? obj.types.map((type) => {
return `| Name | fields | Note |\n` +
`|-------------|---------------|--------------------------------|\n` +
`| ${type.name} | ${type.fields.map((field) => field.name).join(", ")} | ${type.comment ? type.comment : ""} |`;
}).join("\n");
}).join("\n") : "";

return `# ${obj.title} documentation\n## Summary\n\n- [Introduction](#introduction)\n- [Database Type](#database-type)\n`+
`- [Table Structure](#table-structure)\n${documentationSummary}\n- [Relationships](#relationships)\n- [Database Diagram](#database-Diagram)\n\n`+
Expand Down

0 comments on commit fcdb872

Please sign in to comment.