Complix Integration added
This commit is contained in:
@@ -2,6 +2,7 @@ package com.rit.whatsapp.service;
|
||||
|
||||
import com.rit.whatsapp.model.UserEntity;
|
||||
import com.rit.whatsapp.model.UserState;
|
||||
import com.rit.whatsapp.model.GrievanceDraft;
|
||||
import com.rit.whatsapp.repository.UserRepository;
|
||||
import com.rit.whatsapp.util.EncryptionUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -137,4 +138,30 @@ public class SessionService {
|
||||
public void clearTempLoginId(String phoneNumber) {
|
||||
temporaryLoginIds.remove(phoneNumber);
|
||||
}
|
||||
|
||||
private final Map<String, GrievanceDraft> grievanceDrafts = new ConcurrentHashMap<>();
|
||||
|
||||
public GrievanceDraft getOrCreateGrievanceDraft(String phoneNumber) {
|
||||
return grievanceDrafts.computeIfAbsent(phoneNumber, k -> {
|
||||
GrievanceDraft draft = new GrievanceDraft();
|
||||
draft.setPhoneNumber(phoneNumber);
|
||||
return draft;
|
||||
});
|
||||
}
|
||||
|
||||
public GrievanceDraft getGrievanceDraft(String phoneNumber) {
|
||||
return grievanceDrafts.get(phoneNumber);
|
||||
}
|
||||
|
||||
public void clearGrievanceDraft(String phoneNumber) {
|
||||
grievanceDrafts.remove(phoneNumber);
|
||||
}
|
||||
|
||||
public String getImsId(String phoneNumber) {
|
||||
Optional<UserEntity> userOpt = userRepository.findById(phoneNumber);
|
||||
if (userOpt.isPresent()) {
|
||||
return userOpt.get().getImsId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user