working on notes

This commit is contained in:
2025-07-28 21:31:26 +02:00
parent 6600b6fd27
commit 325dffa3fe
9 changed files with 102 additions and 40 deletions

View File

@@ -73,6 +73,7 @@ public class Constants {
public static final String NEW_MEMBER = "new_member";
public static final String MIME = "mime";
public static final String NO_INDEX = "no_index";
public static final String NOTE = "note";
public static final String NUMBER = "number";
public static final String OPTIONAL = "optional";

View File

@@ -6,11 +6,12 @@ import de.srsoftware.umbrella.core.model.Note;
import de.srsoftware.umbrella.core.model.UmbrellaUser;
import java.util.Collection;
import java.util.Map;
public interface NoteService {
void deleteEntity(String task, long taskId);
Collection<Note> getNotes(String module, long entityId) throws UmbrellaException;
Map<Long,Note> getNotes(String module, long entityId) throws UmbrellaException;
Note save(Note note);
}

View File

@@ -6,10 +6,12 @@ import de.srsoftware.tools.Mappable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Map;
import static de.srsoftware.umbrella.core.Constants.*;
import static de.srsoftware.umbrella.core.Util.markdown;
import static java.time.ZoneOffset.UTC;
public record Note(long id, String module, long entityId, long authorId, String text, LocalDateTime timestamp) implements Mappable {
public static Note of(ResultSet rs) throws SQLException {
@@ -18,8 +20,8 @@ public record Note(long id, String module, long entityId, long authorId, String
rs.getString(MODULE),
rs.getLong(ENTITY_ID),
rs.getLong(USER_ID),
rs.getString(TEXT),
LocalDateTime.parse(rs.getString(TIMESTAMP))
rs.getString(NOTE),
LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP),0, UTC)
);
}