implemented adding notes to projects and tasks
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -19,12 +19,14 @@ import de.srsoftware.umbrella.core.api.UserService;
|
||||
import de.srsoftware.umbrella.core.exceptions.UmbrellaException;
|
||||
import de.srsoftware.umbrella.core.model.Note;
|
||||
import de.srsoftware.umbrella.core.model.Token;
|
||||
import de.srsoftware.umbrella.core.model.UmbrellaUser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NoteModule extends BaseHandler implements NoteService {
|
||||
private final NotesDb notesDb;
|
||||
@@ -71,7 +73,9 @@ public class NoteModule extends BaseHandler implements NoteService {
|
||||
if (module == null) throw unprocessable("Module missing in path.");
|
||||
var head = path.pop();
|
||||
long entityId = Long.parseLong(head);
|
||||
return sendContent(ex, mapValues(getNotes(module,entityId)));
|
||||
var notes = getNotes(module,entityId);
|
||||
var authors = notes.values().stream().map(Note::authorId).distinct().map(users::loadUser).collect(Collectors.toMap(UmbrellaUser::id,UmbrellaUser::toMap));
|
||||
return sendContent(ex, Map.of("notes",mapValues(notes),"authors",authors));
|
||||
} catch (NumberFormatException e){
|
||||
return sendContent(ex,HTTP_UNPROCESSABLE,"Entity id missing in path.");
|
||||
} catch (UmbrellaException e){
|
||||
|
||||
Reference in New Issue
Block a user