implemented loading and display of journal.
Nächste Schritte: der Hinweis "you can view/edit xxx at https://…" sollte zwar in der Mail auftauchen, nicht aber im Journal – hier muss also nochmal nachgearbeitet werden Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
/* © SRSoftware 2025 */
|
||||
package de.srsoftware.umbrella.messagebus.events;
|
||||
|
||||
import de.srsoftware.tools.Mappable;
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.model.ObjectWithId;
|
||||
import static de.srsoftware.umbrella.core.Util.mapMarkdown;
|
||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||
import static java.time.ZoneOffset.UTC;
|
||||
|
||||
import de.srsoftware.umbrella.core.model.ObjectWithId;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static de.srsoftware.umbrella.core.constants.Field.*;
|
||||
|
||||
public class JournalEntry extends ObjectWithId {
|
||||
|
||||
long timestamp, userId, entityId;
|
||||
LocalDateTime timestamp;
|
||||
long userId, entityId;
|
||||
String action, description, module;
|
||||
|
||||
public JournalEntry(long id, long timestamp, long userId, String module, long entityId, String action, String description){
|
||||
public JournalEntry(long id, LocalDateTime timestamp, long userId, String module, long entityId, String action, String description){
|
||||
super(id);
|
||||
this.timestamp = timestamp;
|
||||
this.userId = userId;
|
||||
@@ -26,7 +28,7 @@ public class JournalEntry extends ObjectWithId {
|
||||
}
|
||||
public static JournalEntry of(ResultSet rs) throws SQLException {
|
||||
var id = rs.getLong(ID);
|
||||
var timestamp = rs.getLong(TIMESTAMP);
|
||||
var timestamp = LocalDateTime.ofEpochSecond(rs.getLong(TIMESTAMP),0, UTC);
|
||||
var userId = rs.getLong(USER_ID);
|
||||
var module = rs.getString(MODULE);
|
||||
var entityId = rs.getLong(ENTITY_ID);
|
||||
@@ -36,6 +38,10 @@ public class JournalEntry extends ObjectWithId {
|
||||
return new JournalEntry(id, timestamp, userId, module, entityId, action, description);
|
||||
}
|
||||
|
||||
public long userId(){
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> toMap() {
|
||||
return map(
|
||||
@@ -44,7 +50,7 @@ public class JournalEntry extends ObjectWithId {
|
||||
MODULE, module,
|
||||
ENTITY_ID, entityId,
|
||||
ACTION, action,
|
||||
DESCRIPTION, description
|
||||
DESCRIPTION, mapMarkdown(description)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,6 @@ import static de.srsoftware.umbrella.messagebus.events.Event.EventType.MEMBER_AD
|
||||
|
||||
import de.srsoftware.umbrella.core.constants.Field;
|
||||
import de.srsoftware.umbrella.core.model.*;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
Reference in New Issue
Block a user