diff --git a/src/main/java/com/uci/dao/config/CassandraConfig.java b/src/main/java/com/uci/dao/config/CassandraConfig.java index 6376ff9..fb96a2d 100644 --- a/src/main/java/com/uci/dao/config/CassandraConfig.java +++ b/src/main/java/com/uci/dao/config/CassandraConfig.java @@ -124,7 +124,7 @@ protected List getMigrationScripts() { allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD sessionId uuid;"); allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD ownerOrgId text;"); allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD ownerId text;"); - + allScripts.add("ALTER TABLE " + keyspace + ".XMessage ADD botUuid uuid;"); // allScripts.add("CREATE INDEX IF NOT EXISTS message_state_index\n" + // "ON "+keyspace diff --git a/src/main/java/com/uci/dao/models/XMessageDAO.java b/src/main/java/com/uci/dao/models/XMessageDAO.java index da00b7e..67e5f8e 100644 --- a/src/main/java/com/uci/dao/models/XMessageDAO.java +++ b/src/main/java/com/uci/dao/models/XMessageDAO.java @@ -66,4 +66,7 @@ public class XMessageDAO implements Serializable { @Column private String ownerId; + + @Column + private UUID botUuid; } diff --git a/src/main/java/com/uci/dao/repository/XMessageRepository.java b/src/main/java/com/uci/dao/repository/XMessageRepository.java index ae53ab8..7584262 100644 --- a/src/main/java/com/uci/dao/repository/XMessageRepository.java +++ b/src/main/java/com/uci/dao/repository/XMessageRepository.java @@ -26,57 +26,27 @@ public interface XMessageRepository extends ReactiveCassandraRepository existsByUserId(String userID); - - Flux> findAllByFromIdOrderByTimestampDesc(String fromID); - - Flux findFirstByFromIdOrderByTimestampDesc(String fromID); - - Flux findFirstByAppOrderByTimestampDesc(String appName); - - @AllowFiltering - Flux findAllByUserId(Pageable pageable, String userID); - - Flux findByMessageId(String messageID); - - Flux findFirstByReplyIdOrderByTimestampDesc(String replyId); - - Flux findFirstByCauseIdAndMessageStateOrderByTimestampDesc(String causeId, String messageState); - - @AllowFiltering - Flux> findAllByUserIdOrderByTimestampDesc(String userID); @AllowFiltering Flux findAllByUserIdAndTimestampAfter(String userID, LocalDateTime timestamp); - Flux findTopByFromIdAndMessageStateOrderByTimestampDesc(String fromId, String messageState); - Flux findFirstByUserIdAndCauseIdAndMessageStateOrderByTimestampDesc(String userId, String causeId, String messageState); - Flux findTopByUserIdOrderByTimestampDesc(String userId); - @AllowFiltering Flux findAllByFromIdAndTimestampAfter(String userID, LocalDateTime timestamp); @AllowFiltering Flux findById(UUID uuid); - Flux findByXMessageAndUserId(XMessage xmsg, String userID); - @AllowFiltering Flux findFirstByAppAndUserIdAndFromIdAndMessageStateOrderByTimestampDesc(String app, String userID, String fromId, String messageState); - @AllowFiltering - Flux findAllByUserIdOrderByTimestamp(String userID); - @AllowFiltering Flux> findAllByUserIdAndFromId(Pageable paging, String userID, String fromID); @AllowFiltering Mono> findAllByAppAndTimestampAfterAndTimestampBeforeAndProvider(Pageable paging, String name, Timestamp startDate, Timestamp endDate, String provider); - @AllowFiltering - Mono> findAllByUserIdAndTimestampAfterAndTimestampBeforeAndProvider(Pageable paging, String userId, Timestamp startDate, Timestamp endDate, String provider); - @AllowFiltering Mono> findAllByUserIdInAndFromIdInAndTimestampAfterAndTimestampBeforeAndProvider(Pageable paging, List listUserId, List listFromId, Timestamp startDate, Timestamp endDate, String provider); diff --git a/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java b/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java index 60ebcab..14f05f1 100644 --- a/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java +++ b/src/main/java/com/uci/dao/utils/XMessageDAOUtils.java @@ -51,6 +51,7 @@ public static XMessageDAO convertXMessageToDAO(XMessage xmsg) { xmsgDao.setSessionId(xmsg.getSessionId()); xmsgDao.setOwnerOrgId(xmsg.getOwnerOrgId()); xmsgDao.setOwnerId(xmsg.getOwnerId()); + xmsgDao.setBotUuid(xmsg.getBotId()); LocalDateTime triggerTime = LocalDateTime.ofInstant(Instant.ofEpochMilli(xmsg.getTimestamp()),