# I cashed out on this project,As it's not my primary business,guess I just had to share ..=D =D
# just run the following ,Homie :
in Root folder of project,type:
1.gradle build
2.find application.properties file in src/main/java/resources/ folder edit this to suit the url of your mongo installation
3.gradle bootRun
u can then access the endpoints from localhost:8080/ you can insert a userName and password in your MongoDb with db.getCollection('GeneralUserDoc').find({"userName":"r2","password":"222"})
afterwards,for eg,to authenticate,just post {"userName":"r2","password":"222"} to localhost:8080/auth with consumes header of application/json.
`public OutgoingPayload createMultipleGroupContacts(BulkGroupContactsCreationRequest bulkGroupContactsCreationRequest) { log.info("Create Multiple GroupContact Request aka Upload Multiple Contacts : {}", g.toJson(bulkGroupContactsCreationRequest)); OutgoingPayload outgoingPayload;
String groupId = bulkGroupContactsCreationRequest.getGroupId();
String userName = bulkGroupContactsCreationRequest.getUserName();
List<GroupContactsDoc> iterableGroupContacts = bulkGroupContactsCreationRequest.getContactsList();
log.info("Raw contacts List number before duplicate numbers removed = " + iterableGroupContacts.size());
List<GroupContactsDoc> newlySetGroupIdAndUserNameContactsDoc = new ArrayList<>(0);
//set groupId and userName for each since user will not set GroupId with each contact List element
for (GroupContactsDoc groupContactsDocElement : iterableGroupContacts) {
groupContactsDocElement.setGroupId(groupId);
groupContactsDocElement.setUserName(userName);
newlySetGroupIdAndUserNameContactsDoc.add(groupContactsDocElement);
}
log.info("Newly sorted list,with set groupId and Username = " + newlySetGroupIdAndUserNameContactsDoc.size());
//sort and remove duplicates Initial
List<GroupContactsDoc> removeInitialDuplicates = removeDuplicateContactsInitial(newlySetGroupIdAndUserNameContactsDoc);
log.info("Newly sorted List with Duplicates Removed Stage1 = " + removeInitialDuplicates.size() + " contacts");
List<GroupContactsDoc> groupContactsDocListFinallySaved =
removeDuplicatesFromIncomingListByCheckingDBListAndSave(removeInitialDuplicates);
int noOfSavedContacts = groupContactsDocListFinallySaved.size();
log.info("no of final list saved in db = " + noOfSavedContacts);
if (noOfSavedContacts == 0) {
outgoingPayload = new SuccessfulOutgoingPayload("Nothing was saved because the contacts exist already", null);
} else {
outgoingPayload = new SuccessfulOutgoingPayload(noOfSavedContacts + " saved Successfully");
}
return outgoingPayload;
}`
Now have fun confusing yourself....Regards!!