Merge remote-tracking branch 'refs/remotes/origin/feature-ml-integration' into dev

This commit is contained in:
ltiongku
2024-08-14 11:12:23 +08:00
4 changed files with 6 additions and 3 deletions

View File

@@ -45,7 +45,7 @@ public class GmailEmailEntity {
private OffsetDateTime dateCreated;
@Column(name = "active")
private Integer active = 1;
private int active = 1;
@PrePersist
public void prePersist() {

View File

@@ -13,6 +13,7 @@ public class EmailMessage {
private String subject;
private String historyId;
private String date;
private int active;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
List<QRCodeByContentId> qrCodeByContentId;
@@ -29,6 +30,7 @@ public class EmailMessage {
this.subject = subject;
this.historyId = historyId;
this.date = date;
this.active = 1;
this.qrCodeByContentId = new ArrayList<>();
this.qrCodeByURL = new ArrayList<>();
this.decodedContentsDetails = new ArrayList<>();

View File

@@ -17,12 +17,12 @@ public interface GmailEmailRespository extends JpaRepository<GmailEmailEntity, U
// Method to update active status to 0 for a specific userId
@Modifying
@Transactional
@Query("UPDATE GmailEmailEntity e SET e.active = 0 WHERE e.userId = :userId")
@Query("UPDATE GmailEmailEntity e SET e.active = e.active - 1 WHERE e.userId = :userId")
int deactivateEmailsByUserId(String userId);
// Method to update active status to 0 for a specific userId and messageId
@Modifying
@Transactional
@Query("UPDATE GmailEmailEntity e SET e.active = 0 WHERE e.userId = :userId AND e.messageId = :messageId")
@Query("UPDATE GmailEmailEntity e SET e.active = e.active - 1 WHERE e.userId = :userId AND e.messageId = :messageId")
int deactivateEmailByUserIdAndMessageId(String userId, String messageId);
}

View File

@@ -210,6 +210,7 @@ public class GmailService {
.historyId(Long.valueOf(emailMessage.getHistoryId()))
.subject(emailMessage.getSubject())
.dateReceived(dateReceived)
.active(emailMessage.getActive())
.build();
return gmailEmailRespository.save(gmailEmailEntity);
} catch (DataIntegrityViolationException e) {