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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-backlist",
3
- "version": "6.1.0",
3
+ "version": "6.1.1",
4
4
  "description": "An advanced, multi-language backend generator based on frontend analysis.",
5
5
  "type": "commonjs",
6
6
  "bin": {
@@ -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
- // --- Step 2: Identify Models to Generate ---
88
+ // --- Step 2: Identify Models to Generate ---
89
89
  const modelsToGenerate = new Map();
90
90
  endpoints.forEach(ep => {
91
- // Default saha Auth walata Model hadanna ona na (Auth ekata User Model eka yatin hadanawa)
92
- // ep.controllerName dan hariyatama 'Users' kiyala enawa, 'V1' enne na.
93
- if (ep.schemaFields && ep.controllerName !== 'Default' && ep.controllerName !== 'Auth' && !modelsToGenerate.has(ep.controllerName)) {
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: Object.entries(ep.schemaFields).map(([key, type]) => ({ name: key, type, isUnique: key === 'email' }))
103
+ fields: fields
97
104
  });
98
105
  }
99
106
  });