Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lenne.tech/cli",
"version": "1.6.6",
"version": "1.6.7",
"description": "lenne.Tech CLI: lt",
"keywords": [
"lenne.Tech",
Expand Down Expand Up @@ -59,7 +59,7 @@
"gluegun": "5.2.2",
"js-sha256": "0.11.1",
"js-yaml": "4.1.1",
"lodash": "4.17.21",
"lodash": "4.17.23",
"open": "11.0.0",
"ts-morph": "27.0.2",
"ts-node": "10.9.2",
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/parse-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export default (toolbox: ExtendedGluegunToolbox) => {
const value = parameters.options[key];

if (field === 'nullable' || field === 'isArray') {
propData[field] = value === 'true';
// Accept both string 'true' and boolean true
propData[field] = value === 'true' || value === true;
} else {
propData[field] = value;
}
Expand Down
14 changes: 8 additions & 6 deletions src/extensions/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,9 @@ export class Server {
}

// Use utility functions for enum and type config
// For enums, only use enum property (not type property)
const enumConfig = this.getEnumConfig(item);
const typeConfig = this.getTypeConfig(modelFieldType, isArray);
const typeConfig = enumConfig ? '' : this.getTypeConfig(modelFieldType, isArray);

// Build mongoose configuration
const mongooseConfig = reference
Expand All @@ -492,8 +493,8 @@ export class Server {
description: '${this.pascalCase(propName) + (modelName ? ` of ${this.pascalCase(modelName)}` : '')}',
${enumConfig}isOptional: ${item.nullable},
mongoose: ${mongooseConfig},
roles: RoleEnum.S_EVERYONE,
${typeConfig}
roles: RoleEnum.S_EVERYONE,${typeConfig ? `
${typeConfig}` : ''}
})
${propName}: ${(reference ? reference : schema ? schema : enumRef || modelClassType) + (isArray ? '[]' : '')}${undefinedString}
`;
Expand Down Expand Up @@ -592,8 +593,9 @@ export class Server {
}

// Use utility functions for enum and type config
// For enums, only use enum property (not type property)
const enumConfig = this.getEnumConfig(item);
const typeConfig = this.getTypeConfig(inputFieldType, item.isArray);
const typeConfig = enumConfig ? '' : this.getTypeConfig(inputFieldType, item.isArray);

result += `
/**
Expand All @@ -602,8 +604,8 @@ export class Server {
@UnifiedField({
description: '${this.pascalCase(name) + propertySuffix + (modelName ? ` of ${this.pascalCase(modelName)}` : '')}',
${enumConfig}isOptional: ${nullable || item.nullable},
roles: RoleEnum.S_EVERYONE,
${typeConfig}
roles: RoleEnum.S_EVERYONE,${typeConfig ? `
${typeConfig}` : ''}
})
${overrideFlag + this.camelCase(name)}${nullable || item.nullable ? '?' : ''}: ${inputClassType}${item.isArray ? '[]' : ''}${propertyUndefinedString}
`;
Expand Down