restructure project

This commit is contained in:
Carsten Otto
2021-11-22 20:24:13 +01:00
parent a82cb13ef7
commit 874e8fffa6
55 changed files with 46 additions and 14 deletions

View File

@@ -0,0 +1,30 @@
package de.cotto.lndmanagej.controller;
import com.codahale.metrics.MetricRegistry;
import de.cotto.lndmanagej.controller.dto.ObjectMapperConfiguration;
import de.cotto.lndmanagej.metrics.Metrics;
import de.cotto.lndmanagej.service.OwnNodeService;
import org.springframework.context.annotation.Import;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/status/")
@Import(ObjectMapperConfiguration.class)
public class StatusController {
private final OwnNodeService ownNodeService;
private final Metrics metrics;
public StatusController(OwnNodeService ownNodeService, Metrics metrics) {
this.ownNodeService = ownNodeService;
this.metrics = metrics;
}
@GetMapping("/synced-to-chain")
public boolean isSyncedToChain() {
metrics.mark(MetricRegistry.name(getClass(), "isSyncedToChain"));
return ownNodeService.isSyncedToChain();
}
}