added Commands to evens

master
Niclas Thobaben 2021-07-18 15:56:25 +02:00
parent 0f3ac20614
commit 7237e9e35c
2 changed files with 24 additions and 0 deletions

View File

@ -22,6 +22,17 @@ module.exports = (service) => {
return model
})
models = javaModels.mapJavaModels(models, service.namespace, 'events')
models = models.map(model => {
let command = model.attributes.find(attr => attr.name === 'command')
if(command) {
model.command = command.value
model.command.fields = model.command.fields.map(field => {
field.type = javaType.mapJavaType(field.type, service.namespace)
return field
})
}
return model
})
const modelFiles = models.map(model => {
return {

View File

@ -30,4 +30,17 @@ public class {{name}} {{#implements.length}}implements {{#implements}}{{name}}{{
private {{{type.name}}} {{name}};
{{/fields}}
{{#command}}
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class {{name}}Command {
{{#fields}}{{#isAggregateId}}
@TargetAggregateIdentifier{{//isAggregateId}}
private {{{type.name}}} {{name}};
{{/fields}}
}
{{/command}}
}