Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/msa-ez/platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kibum0405 committed Dec 27, 2024
2 parents abb7006 + 79b5e03 commit 7308796
Showing 1 changed file with 60 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
},
"value.controllerInfo.method": function(newVal) {
this.setApiPath()
this.setHttpCommand()
},
"value.restRepositoryInfo.method":function(newVal){
this.setHttpCommand()
Expand Down Expand Up @@ -424,25 +425,23 @@
var tempField = '';
if(target.isVO){
var field = target.fieldDescriptors
for(var i = 0; i < field.length; i++){
var voField = '';
switch(field[i].className){
field.forEach(item => {
switch(item.className) {
case "String":
tempField = tempField.concat(`"${field[i].nameCamelCase}":"value"`, ", ");
tempField = tempField.concat(`"${item.nameCamelCase}":"value"`, ", ");
break;
case "Long":
case "Integer":
case "Float":
case "BigDecimal":
case "Double":
tempField = tempField.concat(`"${field[i].nameCamelCase}":"0"`, ", ");
tempField = tempField.concat(`"${item.nameCamelCase}":"0"`, ", ");
break;
case "Boolean":
tempField = tempField.concat(`"${field[i].nameCamelCase}":"true"`, ", ");
tempField = tempField.concat(`"${item.nameCamelCase}":"true"`, ", ");
break;
}
}
});
tempField = tempField.slice(0, -2);
fieldDescriptorsName = fieldDescriptorsName.concat(`${target.nameCamelCase}:='{${tempField}}' `);
Expand Down Expand Up @@ -486,8 +485,56 @@
if(me.value.fieldDescriptors && me.value.fieldDescriptors.length > 0 ){
fieldDescriptorsName = ''
me.value.fieldDescriptors.forEach(function (fieldItem) {
if(!fieldItem.isKey){
fieldDescriptorsName = fieldDescriptorsName.concat(`${fieldItem.name}="value" ` )
if(!fieldItem.isKey && !fieldItem.isVO && (fieldItem.className == 'String' || fieldItem.className == 'Long' || fieldItem.className == 'Integer' || fieldItem.className == 'Double' || fieldItem.className == 'BigDecimal')){
switch(fieldItem.className){
case "String":
fieldDescriptorsName = fieldDescriptorsName.concat(`${fieldItem.name}="value" ` )
break;
case "Long":
case "Integer":
case "Float":
case "BigDecimal":
case "Double":
fieldDescriptorsName = fieldDescriptorsName.concat(`${fieldItem.name}=0 ` )
break;
case "Boolean":
fieldDescriptorsName = fieldDescriptorsName.concat(`${fieldItem.name}=true ` )
break;
}
}else if(!fieldItem.isKey && (fieldItem.className != 'String' || fieldItem.className != 'Long' || fieldItem.className != 'Integer' || fieldItem.className != 'Double' || fieldItem.className != 'BigDecimal')){
Object.values((me.relatedAggregate.aggregateRoot.entities.relations) || {})
.filter(relation => relation.targetElement.namePascalCase === fieldItem.className)
.forEach((field) => {
var target = field.targetElement;
var tempField = '';
if(target.isVO){
var field = target.fieldDescriptors
field.forEach(item => {
switch(item.className) {
case "String":
tempField = tempField.concat(`"${item.nameCamelCase}":"value"`, ", ");
break;
case "Long":
case "Integer":
case "Float":
case "BigDecimal":
case "Double":
tempField = tempField.concat(`"${item.nameCamelCase}":"0"`, ", ");
break;
case "Boolean":
tempField = tempField.concat(`"${item.nameCamelCase}":"true"`, ", ");
break;
}
});
tempField = tempField.slice(0, -2);
fieldDescriptorsName = fieldDescriptorsName.concat(`${target.nameCamelCase}:='{${tempField}}' `);
}else{
if(target._type.endsWith("enum")){
fieldDescriptorsName = fieldDescriptorsName.concat(`${fieldItem.name}="${target.items[0].value}" ` )
}
}
});
}
})
}
Expand All @@ -502,11 +549,11 @@
} else {
// Controller -> Extend Verb
if(me.value.controllerInfo.method == 'POST'){
me.commandExample = `http POST localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))} ${fieldDescriptorsName}`
me.commandExample = `http POST localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))}${me.value.controllerInfo.apiPath} ${fieldDescriptorsName}`
}else if(me.value.controllerInfo.method == 'PUT'){
me.commandExample = `http PUT localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))}/1/${me.value.controllerInfo.apiPath} ${descriptorName}="{value}"`
me.commandExample = `http PUT localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))}/1/${me.value.controllerInfo.apiPath} ${fieldDescriptorsName}`
}else if(me.value.controllerInfo.method == 'DELETE'){
me.commandExample = `http DELETE localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))}/1/${me.value.controllerInfo.apiPath} ${descriptorName}="{value}"`
me.commandExample = `http DELETE localhost:8080/${pluralize(changeCase.camelCase(me.relatedAggregateName))}/1/${me.value.controllerInfo.apiPath} ${fieldDescriptorsName}`
}
me.setApiPath()
}
Expand Down

0 comments on commit 7308796

Please sign in to comment.