diff --git a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/controller/AnnotationController.java b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/controller/AnnotationController.java index 4e6bb8e9e71c4f85ec6d31c1a18591f20a09fa30..27abdc4bcc7f9abed957e39b46369e80ed5f3ba9 100644 --- a/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/controller/AnnotationController.java +++ b/gemeinsamforschen/src/main/java/unipotsdam/gf/modules/annotation/controller/AnnotationController.java @@ -21,27 +21,21 @@ public class AnnotationController implements IAnnotation { uuid = UUID.randomUUID().toString(); } - // build the annotation - Annotation annotation = new Annotation(uuid, - ZonedDateTime.now().toEpochSecond(), - annotationPostRequest.getUserId(), - annotationPostRequest.getTargetId(), - annotationPostRequest.getBody(), - annotationPostRequest.getStartCharacter(), - annotationPostRequest.getEndCharacter()); - // establish connection MysqlConnect connection = new MysqlConnect(); connection.connect(); // build and execute request String request = "INSERT INTO annotations (`id`, `userId`, `targetId`, `body`, `startCharacter`, `endCharacter`) VALUES (?,?,?,?,?,?);"; - connection.issueInsertOrDeleteStatement(request, annotation.getId(), annotation.getUserId(), annotation.getTargetId(), annotation.getBody(), annotation.getStartCharacter(), annotation.getEndCharacter()); + connection.issueInsertOrDeleteStatement(request, uuid, annotationPostRequest.getUserId(), annotationPostRequest.getTargetId(), annotationPostRequest.getBody(), annotationPostRequest.getStartCharacter(), annotationPostRequest.getEndCharacter()); // close connection connection.close(); - return annotation; + // build response annotation + Annotation annotationResponse = getAnnotation(uuid); + + return annotationResponse; }