fixed email active NULL
This commit is contained in:
@@ -45,7 +45,7 @@ public class GmailEmailEntity {
|
|||||||
private OffsetDateTime dateCreated;
|
private OffsetDateTime dateCreated;
|
||||||
|
|
||||||
@Column(name = "active")
|
@Column(name = "active")
|
||||||
private Integer active = 1;
|
private int active = 1;
|
||||||
|
|
||||||
@PrePersist
|
@PrePersist
|
||||||
public void prePersist() {
|
public void prePersist() {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class EmailMessage {
|
|||||||
private String subject;
|
private String subject;
|
||||||
private String historyId;
|
private String historyId;
|
||||||
private String date;
|
private String date;
|
||||||
|
private int active;
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
List<QRCodeByContentId> qrCodeByContentId;
|
List<QRCodeByContentId> qrCodeByContentId;
|
||||||
@@ -29,6 +30,7 @@ public class EmailMessage {
|
|||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
this.historyId = historyId;
|
this.historyId = historyId;
|
||||||
this.date = date;
|
this.date = date;
|
||||||
|
this.active = 1;
|
||||||
this.qrCodeByContentId = new ArrayList<>();
|
this.qrCodeByContentId = new ArrayList<>();
|
||||||
this.qrCodeByURL = new ArrayList<>();
|
this.qrCodeByURL = new ArrayList<>();
|
||||||
this.decodedContentsDetails = 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
|
// Method to update active status to 0 for a specific userId
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@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);
|
int deactivateEmailsByUserId(String userId);
|
||||||
|
|
||||||
// Method to update active status to 0 for a specific userId and messageId
|
// Method to update active status to 0 for a specific userId and messageId
|
||||||
@Modifying
|
@Modifying
|
||||||
@Transactional
|
@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);
|
int deactivateEmailByUserIdAndMessageId(String userId, String messageId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ public class GmailService {
|
|||||||
.historyId(Long.valueOf(emailMessage.getHistoryId()))
|
.historyId(Long.valueOf(emailMessage.getHistoryId()))
|
||||||
.subject(emailMessage.getSubject())
|
.subject(emailMessage.getSubject())
|
||||||
.dateReceived(dateReceived)
|
.dateReceived(dateReceived)
|
||||||
|
.active(emailMessage.getActive())
|
||||||
.build();
|
.build();
|
||||||
return gmailEmailRespository.save(gmailEmailEntity);
|
return gmailEmailRespository.save(gmailEmailEntity);
|
||||||
} catch (DataIntegrityViolationException e) {
|
} catch (DataIntegrityViolationException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user