overhauled API:

- wrote openapi schema
- re-implemented api endpoint following openapi schema
- intensified and improved working with Result objects

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-12-31 00:02:14 +01:00
parent 10ad309d8c
commit 4822320961
28 changed files with 874 additions and 542 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ dependencies {
implementation("de.srsoftware:configuration.api:1.0.0")
implementation("de.srsoftware:configuration.json:1.0.0")
implementation("de.srsoftware:tools.http:1.0.4")
implementation("de.srsoftware:tools.http:1.2.1")
implementation("de.srsoftware:tools.logging:1.0.2")
implementation("de.srsoftware:tools.web:1.3.8")
implementation("com.mysql:mysql-connector-j:9.1.0")
@@ -4,7 +4,7 @@ package de.srsoftware.cal.app;
import static java.lang.System.Logger.Level.*;
import com.sun.net.httpserver.HttpServer;
import de.srsoftware.cal.ApiHandler;
import de.srsoftware.cal.ApiEndpoint;
import de.srsoftware.cal.IndexHandler;
import de.srsoftware.cal.StaticHandler;
import de.srsoftware.cal.db.Database;
@@ -56,7 +56,15 @@ public class Application {
HttpServer server = HttpServer.create(new InetSocketAddress(port), 0);
var staticPages = new StaticHandler(staticPath).bindPath("/static").on(server);
new IndexHandler(staticPages).bindPath("/").on(server);
new ApiHandler(db).bindPath(("/api")).on(server);
new ApiEndpoint(db).bindPath(("/api")).on(server);
server.start();
// TODO: schedule imports
// TODO: update URL, when tags are selected
// TODO: allow list start time as URL param
// TODO: provide ICAL and WEBDAV links
}
private static void scheduleImports() {
}
}