Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
51021f5
Added userSignup and bulkUpload API implementation
karthik-tarento Sep 19, 2022
b39450b
changes for the new courses email
juhiagl8 Sep 19, 2022
0a1e420
changes for the new courses email
juhiagl8 Sep 19, 2022
3142285
changes for the new courses email
juhiagl8 Sep 19, 2022
d90d3a3
changes for the new courses email
juhiagl8 Sep 19, 2022
b3650fe
changes for the new courses email
juhiagl8 Sep 19, 2022
cb8ac89
changes for the new courses email
juhiagl8 Sep 19, 2022
f46d864
changes for the new courses email
juhiagl8 Sep 19, 2022
63e085e
changes for the new courses email
juhiagl8 Sep 19, 2022
cda3b06
changes for the new courses email
juhiagl8 Sep 20, 2022
a7153c1
changes for the new courses email
juhiagl8 Sep 20, 2022
34533e8
changes for the new courses email
juhiagl8 Sep 20, 2022
b1fc342
changes for the new courses email
juhiagl8 Sep 20, 2022
076f8d2
changes for the new courses email
juhiagl8 Sep 20, 2022
261d3cc
changes for the new courses email
juhiagl8 Sep 20, 2022
4f6418c
changes for the new courses email
juhiagl8 Sep 20, 2022
fe13221
changes for the new courses email
juhiagl8 Sep 21, 2022
8c813fb
changes for the new courses email
juhiagl8 Sep 21, 2022
2ddbf05
changes for the new courses email
juhiagl8 Sep 21, 2022
0721e3f
changes for the new courses email
juhiagl8 Sep 21, 2022
b02dac7
changes for the new courses email
juhiagl8 Sep 21, 2022
6149861
changes for the new courses email
juhiagl8 Sep 22, 2022
4614200
changes for the new courses email
juhiagl8 Sep 22, 2022
3f19bdb
changes for the new courses email
juhiagl8 Sep 23, 2022
7111283
changes for the new courses email
juhiagl8 Sep 23, 2022
f69d3cf
changes for the new courses email
juhiagl8 Sep 23, 2022
9f512ee
changes for the new courses email
juhiagl8 Sep 23, 2022
265c0ce
changes for the new courses email
juhiagl8 Sep 23, 2022
65ea946
changes for the new courses email
juhiagl8 Sep 23, 2022
a3d75cf
changes for the new courses email
juhiagl8 Sep 23, 2022
a0795c5
changes for the new courses email
juhiagl8 Sep 23, 2022
b12c141
changes
juhiagl8 Sep 28, 2022
6e5703c
changes
juhiagl8 Sep 28, 2022
6a20402
changes
juhiagl8 Sep 29, 2022
d9bdd07
changes
juhiagl8 Sep 29, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,18 @@ CREATE TABLE sunbird.ratings_lookup (
```sh
CREATE TABLE sunbird.explore_course_list ( identifier text primary key ) ;
```
```sh
CREATE TABLE sunbird.user_bulk_upload (
rootorgid text,
identifier text,
comment text,
createdby text,
datecreatedon timestamp,
dateupdatedon timestamp,
filename text,
filepath text,
status text,
updatedby text,
PRIMARY KEY (rootorgid, identifier)
) WITH CLUSTERING ORDER BY (identifier ASC);
```
22 changes: 22 additions & 0 deletions src/main/java/org/sunbird/common/util/CbExtServerProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,12 @@ public class CbExtServerProperties {
@Value("${sb.es.user.profile.index}")
private String sbEsUserProfileIndex;

@Value("${sb.service.signup.user}")
private String lmsUserSignUpPath;

@Value("${user.bulk.upload.status.fields}")
private String bulkUploadStatusFields;

public String getUserAssessmentSubmissionDuration() {
return userAssessmentSubmissionDuration;
}
Expand Down Expand Up @@ -1303,4 +1309,20 @@ public String getSbEsUserProfileIndex() {
public void setSbEsUserProfileIndex(String sbEsUserProfileIndex) {
this.sbEsUserProfileIndex = sbEsUserProfileIndex;
}

public String getLmsUserSignUpPath() {
return lmsUserSignUpPath;
}

public void setLmsUserSignUpPath(String lmsUserSignUpPath) {
this.lmsUserSignUpPath = lmsUserSignUpPath;
}

public List<String> getBulkUploadStatusFields() {
return Arrays.asList(bulkUploadStatusFields.split(",", -1));
}

public void setBulkUploadStatusFields(String bulkUploadStatusFields) {
this.bulkUploadStatusFields = bulkUploadStatusFields;
}
}
42 changes: 38 additions & 4 deletions src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ public class Constants {
public static final String SUNBIRD_KEY_SPACE_NAME = "sunbird";
public static final String SUNBIRD_COURSES_KEY_SPACE_NAME = "sunbird_courses";
public static final String LAST_ACCESS_TIME_GAP = "last.access.time.gap.millis";

public static final String SEARCH_FIELDS = "search.fields";
public static final String USER_CONTENT_CONSUMPTION = "user_content_consumption";
public static final String NOTIFICATION_UTIL = "notificationUtil";
public static final String NOTIFICATIONS = "notifications";
Expand All @@ -337,22 +339,28 @@ public class Constants {
public static final String QUERY_LOGGER_THRESHOLD = "queryLoggerConstantThreshold";
public static final String SUNBIRD_CASSANDRA_CONSISTENCY_LEVEL = "sunbird_cassandra_consistency_level";
public static final String INCOMPLETE_COURSES_MAIL_SUBJECT = "Complete the courses you started";
public static final String NEW_COURSES_MAIL_SUBJECT = "Check out exciting new courses that launched this week!";
public static final String COURSE = "Course";
public static final String COURSE_KEYWORD = "course";
public static final String _URL = "_url";
public static final String THUMBNAIL = "_thumbnail";
public static final String _NAME = "_name";
public static final String _DESCRIPTION = "_description";
public static final String _DURATION = "_duration";
public static final String SEND_NOTIFICATION_PROPERTIES = "send-notification";
public static final String NOTIFICATION_HOST = "notification.service.host";
public static final String NOTIFICATION_ENDPOINT = "notification.event.endpoint";
public static final String SUBJECT = "subject";
public static final String SCHEDULER_TIME_GAP = "scheduler-time-gap";
public static final String SCHEDULER_RUN_DAY = "scheduler-run-day";
public static final String SCHEDULER_RUN_TIME = "scheduler-run-time";
public static final String INCOMPLETE_COURSES_SCHEDULER_TIME_GAP = "incomplete-courses-scheduler-time-gap";
public static final String INCOMPLETE_COURSES_SCHEDULER_RUN_DAY = "incomplete-courses-scheduler-run-day";
public static final String INCOMPLETE_COURSES_SCHEDULER_RUN_TIME = "incomplete-courses-scheduler-run-time";
public static final String NEW_COURSES_SCHEDULER_TIME_GAP = "new-courses-scheduler-time-gap";
public static final String NEW_COURSES_SCHEDULER_RUN_DAY = "new-courses-scheduler-run-day";
public static final String NEW_COURSES_SCHEDULER_RUN_TIME = "new-courses-scheduler-run-time";
public static final String IS_DELETED = "isDeleted";
public static final String EXCLUDE_USER_EMAILS = "exclude_user_emails";
public static final String INCOMPLETE_COURSES = "incompletecourses";
public static final String NEW_COURSES = "newcourses";
public static final String POSTER_IMAGE = "posterImage";

public static final String COURSE_URL = "course.url";
Expand Down Expand Up @@ -439,6 +447,7 @@ public class Constants {
public static final String MODE = "mode";
public static final String ORG_NAME = "orgName";
public static final String RECIPIENT_EMAILS = "recipientEmails";
public static final String RECIPIENT_NEW_COURSE_EMAILS = "recipient.new.course.email";
public static final String SET_PASSWORD_LINK = "setPasswordLink";
public static final String WELCOME_MESSAGE = "welcomeMessage";
public static final String HELLO = "Hello";
Expand Down Expand Up @@ -504,7 +513,32 @@ public class Constants {
public static final String PUBLIC_COURSE_LIST = "exploreOpenCourseList";
public static final String LAST_UPDATED_ON = "lastUpdatedOn";
public static final String DESCENDING_ORDER = "desc";

public static final String ASSESSMENT_HOST = "assessment.host";
public static final String CONTENT_SEARCH = "content.search";
public static final String SB_API_KEY = "sb.api.key";
public static final String NEW_COURSES_EMAIL_LIMIT = "new-courses-email-limit";
public static final String EMAIL_RECORD_TABLE = "email_record";
public static final String EMAIL_TYPE = "emailtype";
public static final String LAST_SENT_DATE = "lastsentdate";

public static final String NEW_COURSES_EMAIL = "New Courses Email";
public static final String KM_BASE_HOST = "km.base.host";

public static final String NO_OF_COURSES = "noOfCourses";
public static final String X_AUTH_USER_ORG_ID = "x-authenticated-user-orgid";
public static final String API_USER_SIGNUP = "api.user.signup";
public static final String API_USER_BULK_UPLOAD = "api.user.bulk.upload";
public static final String API_USER_BULK_UPLOAD_STATUS = "api.user.bulk.upload.status";
public static final String TABLE_USER_BULK_UPLOAD = "user_bulk_upload";
public static final String FILE_NAME = "fileName";
public static final String FILE_PATH = "filePath";
public static final String DATE_CREATED_ON = "dateCreatedOn";
public static final String DATE_UPDATE_ON = "dateUpdatedOn";
public static final String INITIATED_CAPITAL = "INITIATED";
public static final String MIN = "min";
public static final String MAX = "max";
public static final String CONTENT_TYPE_SEARCH = "contentType";

private Constants() {
throw new IllegalStateException("Utility class");
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/sunbird/common/util/NotificationUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class NotificationUtil {
}

public <params> void sendNotification(List<String> sendTo, Map<String, Object> params, String senderMail,
String notificationUrl) {
String notificationUrl, String emailTemplate, String emailSubject) {
new Thread(() -> {
try {
HttpHeaders headers = new HttpHeaders();
RestTemplate restTemplate = new RestTemplate();
headers.setContentType(MediaType.APPLICATION_JSON);
Map<String, Object> notificationRequest = new HashMap<>();
List<Object> notificationTosend = new ArrayList<>(Arrays.asList(new Notification(Constants.EMAIL,
Constants.MESSAGE, new EmailConfig(senderMail, Constants.INCOMPLETE_COURSES_MAIL_SUBJECT),
sendTo, new Template(null, INCOMPLETE_COURSES, params))));
Constants.MESSAGE, new EmailConfig(senderMail, emailSubject),
sendTo, new Template(null, emailTemplate, params))));
notificationRequest.put(Constants.REQUEST, new HashMap<String, List<Object>>() {
{
put(Constants.NOTIFICATIONS, notificationTosend);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
package org.sunbird.profile.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.sunbird.common.model.SBApiResponse;
import org.sunbird.common.util.Constants;
import org.sunbird.profile.service.ProfileService;
import java.util.Map;

@RestController
public class ProfileController {
Expand Down Expand Up @@ -59,4 +68,24 @@ private ResponseEntity<?> adminMigrateUser(@RequestHeader(Constants.X_AUTH_TOKEN
SBApiResponse response = profileService.migrateUser(request, userToken, authToken);
return new ResponseEntity<>(response, response.getResponseCode());
}

@PostMapping("/user/v1/ext/signup")
public ResponseEntity<?> userSignup(@RequestBody Map<String,Object> request) {
SBApiResponse response = profileService.userSignup(request);
return new ResponseEntity<>(response, response.getResponseCode());
}

@PostMapping("/user/v1/bulkupload")
public ResponseEntity<?> bulkUpload(@RequestParam(value = "file", required = true) MultipartFile multipartFile,
@RequestHeader(Constants.X_AUTH_USER_ORG_ID) String rootOrgId,
@RequestHeader(Constants.X_AUTH_USER_ID) String userId) {
SBApiResponse uploadResponse = profileService.bulkUpload(multipartFile, rootOrgId, userId);
return new ResponseEntity<>(uploadResponse, uploadResponse.getResponseCode());
}

@GetMapping(value = {"/user/v1/bulkupload", "/user/v1/bulkupload/{orgId}"})
public ResponseEntity<?> getBulkUploadDetails(@PathVariable(value = "orgId", required = false) String orgId) {
SBApiResponse response = profileService.getBulkUploadDetails(orgId);
return new ResponseEntity<>(response, response.getResponseCode());
}
}
10 changes: 9 additions & 1 deletion src/main/java/org/sunbird/profile/service/ProfileService.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.sunbird.profile.service;

import org.sunbird.common.model.SBApiResponse;
import java.util.Map;

import org.springframework.web.multipart.MultipartFile;
import org.sunbird.common.model.SBApiResponse;

public interface ProfileService {
SBApiResponse profileUpdate(Map<String, Object> request, String XAuthToken, String AuthToken) throws Exception;

Expand All @@ -17,4 +19,10 @@ public interface ProfileService {
SBApiResponse userAutoComplete(String searchTerm);

SBApiResponse migrateUser(Map<String, Object> request, String userToken, String authToken);

SBApiResponse userSignup(Map<String, Object> request);

SBApiResponse bulkUpload(MultipartFile mFile, String orgId, String userId);

SBApiResponse getBulkUploadDetails(String orgId);
}
Loading