fixed email active NULL
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user