<commit_before>(function(){
'use strict';

angular
  .module('secondLead')
  
  .factory('ReviewModel',['Restangular', 'store', function(Restangular, store) {
    var currentUser = store.get('user');
    return {
      
      getAll: function(dramaID){
        return Restangular.one('dramas', dramaID).getList('reviews').$object
      },
      
      getOne: function(dramaID, reviewID) {
        return Restangular.one('dramas', dramaID).one('reviews', reviewID).get()
      },

      create: function(dramaID, userID, review) {
        return Restangular.one('dramas', dramaID).getList('reviews').post({drama_id: dramaID, body: review, reviewer_id: userID})
      },

      update: function(dramaID, reviewID,review){
        return Restangular.one('dramas', dramaID).one('reviews', reviewID).put({body: review})
      }

    };

  }])

})();
  <commit_msg>Add find and delete functions to ang review model<commit_after>(function(){
'use strict';

angular
  .module('secondLead')
  
  .factory('ReviewModel',['$http', 'Restangular', 'store', function($http, Restangular, store) {
    var currentUser = store.get('user');
    function extract(result) {
      return result.data;
    };

    return {
      
      getAll: function(dramaID){
        return Restangular.one('dramas', dramaID).getList('reviews').$object
      },
      
      getOne: function(dramaID, reviewID) {
        return Restangular.one('dramas', dramaID).one('reviews', reviewID).get()
      },

      create: function(dramaID, userID, review) {
        return Restangular.one('dramas', dramaID).all('reviews').post({drama_id: dramaID, body: review, reviewer_id: userID})
      },

      find: function(dramaID, userID){
        return $http.get('/reviews/find', {params: {drama_id: dramaID, reviewer_id: userID}}).then(extract);
      },

      update: function(dramaID, reviewID,review){
        return Restangular.one('dramas', dramaID).one('reviews', reviewID).put({body: review})
      },

      delete: function(dramaID, reviewID){
        return Restangular.one('dramas', dramaID).one('reviews', reviewID).remove()
      }

    };

  }])

})();
  
{'fraction_non_alphanumeric': 0.1649436090225564, 'fraction_numerical': 0.0, 'mean_word_length': 3.336048879837067, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '979057', 'n_tokens_mistral': 675, 'n_tokens_neox': 669, 'n_words': 121}