create-backlist 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generators/node.js +12 -5
package/package.json
CHANGED
package/src/generators/node.js
CHANGED
|
@@ -85,15 +85,22 @@ async function generateNodeProject(options) {
|
|
|
85
85
|
console.log(chalk.yellow(' -> No API endpoints found. A basic project will be created.'));
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
// --- Step 2: Identify Models to Generate ---
|
|
89
89
|
const modelsToGenerate = new Map();
|
|
90
90
|
endpoints.forEach(ep => {
|
|
91
|
-
//
|
|
92
|
-
//
|
|
93
|
-
if (ep.
|
|
91
|
+
// 🔥 FIX: 'ep.schemaFields' තිබ්බත් නැතත් Controller එක හදන්න ඕන.
|
|
92
|
+
// නැත්නම් Routes Import එකේදි Error එනවා.
|
|
93
|
+
if (ep.controllerName !== 'Default' && ep.controllerName !== 'Auth' && !modelsToGenerate.has(ep.controllerName)) {
|
|
94
|
+
|
|
95
|
+
// Schema Fields නැත්නම් හිස් Array එකක් ගන්න
|
|
96
|
+
let fields = [];
|
|
97
|
+
if (ep.schemaFields) {
|
|
98
|
+
fields = Object.entries(ep.schemaFields).map(([key, type]) => ({ name: key, type, isUnique: key === 'email' }));
|
|
99
|
+
}
|
|
100
|
+
|
|
94
101
|
modelsToGenerate.set(ep.controllerName, {
|
|
95
102
|
name: ep.controllerName,
|
|
96
|
-
fields:
|
|
103
|
+
fields: fields
|
|
97
104
|
});
|
|
98
105
|
}
|
|
99
106
|
});
|