fixed bugs with coords:
argument order is now [lat, lon] everywhere Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -61,8 +61,12 @@ public class MariaDB implements Database {
|
||||
@Override
|
||||
public Result<Appointment> add(Appointment appointment) {
|
||||
try {
|
||||
var start = Timestamp.valueOf(appointment.start());
|
||||
var end = appointment.end().map(Timestamp::valueOf).orElse(null);
|
||||
var coords = appointment.coords().map(Object::toString).orElse(null);
|
||||
var location = appointment.location().orElse(null);
|
||||
ResultSet keys = insertInto(APPOINTMENTS, TITLE, DESCRIPTION, START, END, LOCATION, COORDS) //
|
||||
.values(appointment.title(), appointment.description(), appointment.start(), appointment.end().orElse(null), appointment.location().orElse(null), appointment.coords().orElse(null))
|
||||
.values(appointment.title(), appointment.description(), start, end, location, coords)
|
||||
.execute(connection)
|
||||
.getGeneratedKeys();
|
||||
Appointment saved = null;
|
||||
@@ -309,14 +313,17 @@ public class MariaDB implements Database {
|
||||
|
||||
@Override
|
||||
public Result<Appointment> update(Appointment event) {
|
||||
var start = Timestamp.valueOf(event.start());
|
||||
var end = event.end().map(Timestamp::valueOf).orElse(null);
|
||||
var coords = event.coords().map(Object::toString).orElse(null);
|
||||
var location = event.location().orElse(null);
|
||||
try {
|
||||
Query
|
||||
.update(APPOINTMENTS) //
|
||||
.set(TITLE, DESCRIPTION, START, END, LOCATION, COORDS)
|
||||
.where(AID, equal(event.id()))
|
||||
.prepare(connection)
|
||||
.apply(event.title(), event.description(), Timestamp.valueOf(event.start()), end, event.location().orElse(null), event.coords().orElse(null));
|
||||
.apply(event.title(), event.description(), start, end, location, coords);
|
||||
|
||||
// TODO: update links, attachments, tags
|
||||
|
||||
|
||||
Reference in New Issue
Block a user