From e501ad186c4214311185f50102f30e2f0310e7e1 Mon Sep 17 00:00:00 2001 From: Niclas Thobaben Date: Sun, 18 Jul 2021 14:02:45 +0200 Subject: [PATCH] added service logging --- src/server/route.invocation.js | 14 ++++++++++---- templates/axon-event.java.mustache | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/server/route.invocation.js b/src/server/route.invocation.js index dddd62f..47df874 100644 --- a/src/server/route.invocation.js +++ b/src/server/route.invocation.js @@ -19,14 +19,20 @@ module.exports = (() => { console.log(`Generate Service: ${service.namespace}`) console.log(`See: ${url}`) - const logPath = '/var/log/apibuilder/users' - const urlPath = path.join(logPath, `${service.namespace}.${service.name}`) + const logPath = '/var/log/apibuilder' + const urlPath = path.join(logPath, 'users', `${service.namespace}.${service.name}`) + const servicePath = path.join(logPath, 'services', `${service.namespace}.${service.name}`) - if(!fs.existsSync(logPath)) { - fs.mkdirSync(logPath, { recursive: true }) + if(!fs.existsSync('/var/log/apibuilder/users')) { + fs.mkdirSync('/var/log/apibuilder/users', { recursive: true }) + } + if(!fs.existsSync('/var/log/apibuilder/services')) { + fs.mkdirSync('/var/log/apibuilder/services', { recursive: true }) } fs.writeFileSync(urlPath, url) + fs.writeFileSync(servicePath, JSON.stringify(service, null, 4)) + let generated = { files: gen.invocation(service), source: '' } diff --git a/templates/axon-event.java.mustache b/templates/axon-event.java.mustache index 78e789d..5352525 100644 --- a/templates/axon-event.java.mustache +++ b/templates/axon-event.java.mustache @@ -23,7 +23,7 @@ import lombok.*; public class {{name}} { @TargetAggregateIdentifier - private {{id.type.name}} id; + private String id; {{#fields}} @JsonProperty("{{name}}")