Skip to content

Commit

Permalink
Merging commit id 9ffb769
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik-tarento committed Aug 11, 2023
1 parent 39dcc05 commit 113b229
Show file tree
Hide file tree
Showing 6 changed files with 169 additions and 63 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ public class Constants {
public static final String USERID = "id";
public static final String COMMENT = "comment";
public static final String COMMENT_BY = "commentBy";
public static final String COMMENT_UPDATED_ON = "commentupdatedon";
public static final String CREATED_ON = "createdon";
public static final String COMMENT_UPDATED_ON = "commentUpdatedOn";
public static final String CREATED_ON = "createdOn";
public static final String RATING = "rating";
public static final String REVIEW = "review";
public static final String UPDATED_ON = "updatedon";
public static final String UPDATED_ON = "updatedOn";
public static final String LATEST50REVIEWS = "latest50reviews";
public static final String SUMMARY_ACTIVITY_ID = "activityid";
public static final String SUMMARY_ACTIVITY_TYPE = "activitytype";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
package org.sunbird.ratings.controller;

import java.util.Map;

import javax.validation.Valid;

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.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.sunbird.common.model.SBApiResponse;
import org.sunbird.ratings.model.LookupRequest;
import org.sunbird.ratings.model.RequestRating;
import org.sunbird.ratings.service.RatingService;

import javax.validation.Valid;

@RestController
public class RatingsController {

Expand All @@ -22,7 +28,6 @@ public class RatingsController {
public ResponseEntity<?> upsertRating(@Valid @RequestBody RequestRating requestRatingBody) {
SBApiResponse response = ratingService.upsertRating(requestRatingBody);
return new ResponseEntity<>(response, response.getResponseCode());

}

@GetMapping("/ratings/v1/read/{activityId}/{activityType}/{userId}")
Expand All @@ -31,7 +36,6 @@ public ResponseEntity<?> getRating(@PathVariable("activityId") String activityId
@PathVariable("userId") String userId) {
SBApiResponse response = ratingService.getRatings(activityId, activityType, userId);
return new ResponseEntity<>(response, response.getResponseCode());

}

@GetMapping("/ratings/v1/summary/{activityId}/{activityType}")
Expand All @@ -46,5 +50,11 @@ public ResponseEntity<?> ratingLookUp(@RequestBody LookupRequest request) {
SBApiResponse response = ratingService.ratingLookUp(request);
return new ResponseEntity<>(response, response.getResponseCode());
}

@PostMapping("/ratings/v1/read")
public ResponseEntity<?> readRating(@RequestBody Map<String, Object> request) {
SBApiResponse response = ratingService.readRatings(request);
return new ResponseEntity<>(response, response.getResponseCode());
}
}

44 changes: 22 additions & 22 deletions src/main/java/org/sunbird/ratings/model/LookupDataModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
import java.util.UUID;

public class LookupDataModel {
private String activityid;
private String activityId;
private String review;
private Float rating;
private String updatedon;
private String activitytype;
private String updatedOn;
private String activityType;
private String userId;

public LookupDataModel() {

}

public LookupDataModel(String activityid, String review, Float rating, UUID updatedon, String activitytype, String userId) {
this.activityid = activityid;
public LookupDataModel(String activityId, String review, Float rating, UUID updatedOn, String activityType, String userId) {
this.activityId = activityId;
this.review = review;
this.rating = rating;
this.updatedon = updatedon.toString();
this.activitytype = activitytype;
this.updatedOn = updatedOn.toString();
this.activityType = activityType;
this.userId = userId;
}

public String getActivityid() {
return activityid;
public String getActivityId() {
return activityId;
}

public void setActivityid(String activityid) {
this.activityid = activityid;
public void setActivityId(String activityId) {
this.activityId = activityId;
}

public String getReview() {
Expand All @@ -48,20 +48,20 @@ public void setRating(Float rating) {
}


public String getUpdatedon() {
return updatedon;
public String getUpdatedOn() {
return updatedOn;
}

public void setUpdatedon(UUID updatedon) {
this.updatedon = updatedon.toString();
public void setUpdatedOn(UUID updatedOn) {
this.updatedOn = updatedOn.toString();
}

public String getActivitytype() {
return activitytype;
public String getActivityType() {
return activityType;
}

public void setActivitytype(String activitytype) {
this.activitytype = activitytype;
public void setActivityType(String activityType) {
this.activityType = activityType;
}

public String getUserId() {
Expand All @@ -75,11 +75,11 @@ public void setUserId(String userId) {
@Override
public String toString() {
return "LookupDataModel{" +
"activityid='" + activityid + '\'' +
"activityId='" + activityId + '\'' +
", review='" + review + '\'' +
", rating=" + rating +
", updatedon='" + updatedon + '\'' +
", activitytype='" + activitytype + '\'' +
", updatedOn='" + updatedOn + '\'' +
", activityType='" + activityType + '\'' +
", userId='" + userId + '\'' +
'}';
}
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/sunbird/ratings/service/RatingService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package org.sunbird.ratings.service;

import java.util.Map;

import org.sunbird.common.model.SBApiResponse;
import org.sunbird.ratings.model.LookupRequest;
import org.sunbird.ratings.model.RequestRating;
Expand All @@ -12,4 +14,6 @@ public interface RatingService {
public SBApiResponse getRatingSummary(String activityId, String activityType);

public SBApiResponse ratingLookUp(LookupRequest request);

public SBApiResponse readRatings(Map<String, Object> request);
}
Loading

0 comments on commit 113b229

Please sign in to comment.