Skip to content

Commit

Permalink
[EDM] Clean-up output model file (#4051)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThuF authored Jun 18, 2024
1 parent 2008467 commit b2a0801
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,46 +94,46 @@ function createModel(graph) {
property.dataName = property.dataName ? property.dataName : _.escape(child.value.dataName).toUpperCase() + "_" + JSON.stringify(property.name).replace(/\W/g, '').toUpperCase();

model.push(' <property name="' + _.escape(property.name) +
'" isRequiredProperty="' + _.escape(property.isRequiredProperty) +
'" isCalculatedProperty="' + _.escape(property.isCalculatedProperty) +
'" calculatedPropertyExpressionCreate="' + _.escape(property.calculatedPropertyExpressionCreate) +
'" calculatedPropertyExpressionUpdate="' + _.escape(property.calculatedPropertyExpressionUpdate) +
'" dataName="' + _.escape(property.dataName) +
'" dataType="' + _.escape(property.dataType) + '"');
if (property.dataLength !== null) {
if (property.dataType === 'CHAR' || property.dataType === 'VARCHAR') {
model.push(' dataLength="' + _.escape(property.dataLength) + '"');
}
if (property.dataLength !== null && (property.dataType === 'CHAR' || property.dataType === 'VARCHAR')) {
model.push(' dataLength="' + _.escape(property.dataLength) + '"');
}
if (property.dataNotNull) {
model.push(' dataNullable="' + (property.dataNotNull == "false") + '"');
} else {
model.push(' dataNullable="true"');
}
if (property.dataPrimaryKey) {
model.push(' dataPrimaryKey="' + (property.dataPrimaryKey == "true") + '"');
} else {
model.push(' dataPrimaryKey="false"');
if (property.dataPrimaryKey == "true") {
model.push(' dataPrimaryKey="true"');
}
if (property.dataAutoIncrement) {
model.push(' dataAutoIncrement="' + (property.dataAutoIncrement == "true") + '"');
} else {
model.push(' dataAutoIncrement="false"');
if (property.dataAutoIncrement == "true") {
model.push(' dataAutoIncrement="true"');
}
if (property.dataUnique) {
model.push(' dataUnique="' + (property.dataUnique == "true") + '"');
} else {
model.push(' dataUnique="false"');
if (property.dataUnique == "true") {
model.push(' dataUnique="true"');
}
if (property.dataDefaultValue !== null) {
model.push(' dataDefaultValue="' + _.escape(property.dataDefaultValue) + '"');
}
if (property.dataPrecision !== null) {
if (property.dataPrecision !== null && property.dataType === 'DECIMAL') {
model.push(' dataPrecision="' + _.escape(property.dataPrecision) + '"');
}
if (property.dataScale !== null) {
if (property.dataScale !== null && property.dataType === 'DECIMAL') {
model.push(' dataScale="' + _.escape(property.dataScale) + '"');
}
if (property.isRequiredProperty == "true") {
model.push(' isRequiredProperty="true"');
}
if (property.isCalculatedProperty == "true") {
model.push(' isCalculatedProperty="true"');
}
if (property.calculatedPropertyExpressionCreate != null) {
model.push(' calculatedPropertyExpressionCreate="' + _.escape(property.calculatedPropertyExpressionCreate) + '"');
}
if (property.calculatedPropertyExpressionUpdate != null) {
model.push(' calculatedPropertyExpressionUpdate="' + _.escape(property.calculatedPropertyExpressionUpdate) + '"');
}
if (property.relationshipType !== null) {
model.push(' relationshipType="' + _.escape(property.relationshipType ? property.relationshipType : 'ASSOCIATION') + '"');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export class ${name}Repository {
#end
#end
#foreach ($property in $properties)
#if($property.isCalculatedProperty && $property.calculatedPropertyExpressionCreate != "")
#if($property.isCalculatedProperty && $property.calculatedPropertyExpressionCreate)
// @ts-ignore
(entity as ${name}Entity).${property.name} = ${property.calculatedPropertyExpressionCreate};
#end
Expand Down Expand Up @@ -253,7 +253,7 @@ export class ${name}Repository {
#end
#end
#foreach ($property in $properties)
#if($property.isCalculatedProperty && $property.calculatedPropertyExpressionUpdate != "")
#if($property.isCalculatedProperty && $property.calculatedPropertyExpressionUpdate)
// @ts-ignore
(entity as ${name}Entity).${property.name} = ${property.calculatedPropertyExpressionUpdate};
#end
Expand Down

0 comments on commit b2a0801

Please sign in to comment.