<commit_before>'use strict'
var dataServices = angular.module('dataServices', ['ngResource']);

dataServices.factory('User', function($resource) {
	return $resource('j/users/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/users/show/:id' },
		update: { method: 'POST', url: 'j/users/update/:id' },
	})
});

dataServices.factory('Team', function($resource) {
	return $resource('j/teams/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/teams/show/:id' },
		save: { method: 'POST', url: 'j/teams/new' },
		update: { method: 'POST', url: 'j/teams/update/:id' },
		delete: { method: 'POST', url: 'j/teams/destroy/:id' }
	})
});

dataServices.factory('Tournament', function($resource) {
	return $resource('j/tournaments/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/tournaments/show/:id' },
		save: { method: 'POST', url: 'j/tournaments/new' },
		update: { method: 'POST', url: 'j/tournaments/update/:id' },
		delete: { method: 'POST', url: 'j/tournaments/destroy/:id' }
	})
});

dataServices.factory('Invite', function($http, $log, $q){
    return {
			send: function(currentUser, emails){
				var deferred = $q.defer();
					$http({
						method: 'POST',
						url: '/j/invite',
						contentType: 'application/json',
						params:{ emails: emails, name: currentUser.Name } }).
						success(function(data,status,headers,config){
							deferred.resolve(data);
							$log.info(data, status, headers() ,config);
						}).
						error(function (data, status, headers, config){
							$log.warn(data, status, headers(), config);
							deferred.reject(status);
						});
					return deferred.promise;
			}
    };
});<commit_msg>client: before calling user json handlers, user session data should be passed in the request<commit_after>'use strict'
var dataServices = angular.module('dataServices', ['ngResource']);

dataServices.factory('User', function($http, $resource, $cookieStore) {
	$http.defaults.headers.common['Authorization'] = $cookieStore.get('auth');
	
	return $resource('j/users/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/users/show/:id' },
		update: { method: 'POST', url: 'j/users/update/:id' },
	})
});

dataServices.factory('Team', function($http, $resource) {
	$http.defaults.headers.common['Authorization'] = $cookieStore.get('auth');
	
	return $resource('j/teams/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/teams/show/:id' },
		save: { method: 'POST', url: 'j/teams/new' },
		update: { method: 'POST', url: 'j/teams/update/:id' },
		delete: { method: 'POST', url: 'j/teams/destroy/:id' }
	})
});

dataServices.factory('Tournament', function($http, $resource) {
	$http.defaults.headers.common['Authorization'] = $cookieStore.get('auth');
	
	return $resource('j/tournaments/:id', {id:'@id'}, {
		get: { method: 'GET', url: 'j/tournaments/show/:id' },
		save: { method: 'POST', url: 'j/tournaments/new' },
		update: { method: 'POST', url: 'j/tournaments/update/:id' },
		delete: { method: 'POST', url: 'j/tournaments/destroy/:id' }
	})
});

dataServices.factory('Invite', function($http, $log, $q){
	$http.defaults.headers.common['Authorization'] = $cookieStore.get('auth');
	
	return {
		send: function(currentUser, emails){
			var deferred = $q.defer();
				$http({
					method: 'POST',
					url: '/j/invite',
					contentType: 'application/json',
					params:{ emails: emails, name: currentUser.Name } }).
					success(function(data,status,headers,config){
						deferred.resolve(data);
						$log.info(data, status, headers() ,config);
					}).
					error(function (data, status, headers, config){
						$log.warn(data, status, headers(), config);
						deferred.reject(status);
					});
				return deferred.promise;
		}
	};
});
{'fraction_non_alphanumeric': 0.2161720664307106, 'fraction_numerical': 0.0, 'mean_word_length': 4.160112359550562, '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': '5144941', 'n_tokens_mistral': 1424, 'n_tokens_neox': 1263, 'n_words': 250}