-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathumlGenerator.js
37 lines (32 loc) · 1.11 KB
/
umlGenerator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// umlGenerator.js
const { generateClassDiagram } = require('./generators/classDiagramGenerator');
const { generateERDiagram } = require('./generators/erDiagramGenerator');
const { generateSequenceDiagram } = require('./generators/sequenceDiagramGenerator');
function generateUML(parsedDiagram) {
if (!parsedDiagram) {
app.toast.error("Received NO mermaid code!");
return;
}
// Fetch the project
const project = app.repository.select("@Project")[0];
if (!project) {
app.toast.error("No active project found.");
return;
}
// Handle different types of diagrams
switch (parsedDiagram.type) {
case 'classDiagram':
generateClassDiagram(project, parsedDiagram);
break;
case 'erDiagram':
generateERDiagram(project, parsedDiagram);
break;
case 'sequenceDiagram':
generateSequenceDiagram(project, parsedDiagram);
break;
default:
app.toast.error(`Unsupported diagram type: ${parsedDiagram.type}`);
return;
}
}
module.exports = { generateUML };