draft of Eventbrite API import GUI: #58
This commit is contained in:
parent
dd23db6462
commit
ecd18542e6
6 changed files with 114 additions and 21 deletions
|
@ -59,6 +59,7 @@ Be sure to have a running MongoDB server, locally. If you want to install the de
|
||||||
sudo pip3 install pymongo # version 3.2.2 or later
|
sudo pip3 install pymongo # version 3.2.2 or later
|
||||||
sudo pip3 install python-dateutil
|
sudo pip3 install python-dateutil
|
||||||
sudo pip3 install pycups # only needed if you want to print labels
|
sudo pip3 install pycups # only needed if you want to print labels
|
||||||
|
sudo pip3 install eventbrite # only needed if you want to import from Eventbrite using their API
|
||||||
sudo pip3 install serial # only for the qrcode_reader script
|
sudo pip3 install serial # only for the qrcode_reader script
|
||||||
sudo pip3 install requests # only for the qrcode_reader script
|
sudo pip3 install requests # only for the qrcode_reader script
|
||||||
git clone https://github.com/raspibo/eventman
|
git clone https://github.com/raspibo/eventman
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
<!-- import tickets -->
|
<!-- import tickets -->
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<div class="panel-title"><h1>{{'Import tickets with Eventbrite API' | translate}}</h1></div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<form name="ebAPIForm" class="well">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="eb-api-key">{{'API key' | translate}}</label>
|
||||||
|
<input ng-model="ebAPIkey" id="eb-api-key" type="password" ng-required="true">
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="eb-event-id">{{'Eventbrite Event ID' | translate}}</label>
|
||||||
|
<input ng-model="ebEventID" id="eb-event-id" ng-required="true">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="checkbox" ng-model="createNewEvent"> {{'create a new event' | translate}}
|
||||||
|
|
||||||
|
<div class="form-group" ng-disabled="createNewEvent">
|
||||||
|
<label for="forEvent">{{'Associate tickets to this event' | translate}}</label>
|
||||||
|
<select class="form-control" id="forEvent" ng-model="targetEvent" ng-required="true" ng-disabled="createNewEvent">
|
||||||
|
<option ng-repeat="event in events" value="{{event._id}}">{{event.title}}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<br />
|
||||||
|
<input type="submit" value="{{'Import' | translate}}" ng-click="apiImport()" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-primary">
|
<div class="panel panel-primary">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<div class="panel-title"><h1>{{'Import tickets from Eventbrite CSV' | translate}}</h1></div>
|
<div class="panel-title"><h1>{{'Import tickets from Eventbrite CSV' | translate}}</h1></div>
|
||||||
|
|
22
angular_app/js/controllers.js
vendored
22
angular_app/js/controllers.js
vendored
|
@ -826,14 +826,32 @@ eventManControllers.controller('UsersCtrl', ['$scope', '$rootScope', '$state', '
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
eventManControllers.controller('FileUploadCtrl', ['$scope', '$log', '$upload', 'Event',
|
eventManControllers.controller('FileUploadCtrl', ['$scope', '$log', '$upload', 'EbAPI', 'Event',
|
||||||
function ($scope, $log, $upload, Event) {
|
function ($scope, $log, $upload, EbAPI, Event) {
|
||||||
$scope.file = null;
|
$scope.file = null;
|
||||||
$scope.progress = 0;
|
$scope.progress = 0;
|
||||||
$scope.progressbarType = 'warning';
|
$scope.progressbarType = 'warning';
|
||||||
$scope.deduplicate = false;
|
$scope.deduplicate = false;
|
||||||
|
$scope.targetEvent = null;
|
||||||
|
$scope.createNewEvent = true;
|
||||||
|
$scope.ebAPIkey = '';
|
||||||
|
$scope.ebEventID = '';
|
||||||
$scope.reply = {};
|
$scope.reply = {};
|
||||||
$scope.events = Event.all();
|
$scope.events = Event.all();
|
||||||
|
|
||||||
|
$scope.apiImport = function() {
|
||||||
|
if (!($scope.ebAPIkey && $scope.ebEventID)) {
|
||||||
|
$log.warn('missing Eventbrite API key or Event ID');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EbAPI.apiImport({
|
||||||
|
create: $scope.createNewEvent,
|
||||||
|
eventID: $scope.ebEventID,
|
||||||
|
targetEvent: $scope.targetEvent,
|
||||||
|
apiKey: $scope.ebAPIkey
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.upload = function(file, url) {
|
$scope.upload = function(file, url) {
|
||||||
$log.debug("FileUploadCtrl.upload");
|
$log.debug("FileUploadCtrl.upload");
|
||||||
$scope.progress = 0;
|
$scope.progress = 0;
|
||||||
|
|
54
angular_app/js/services.js
vendored
54
angular_app/js/services.js
vendored
|
@ -22,7 +22,7 @@ eventManServices.factory('Event', ['$resource', '$rootScope',
|
||||||
|
|
||||||
all: {
|
all: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: true,
|
isArray: true,
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
|
@ -39,7 +39,7 @@ eventManServices.factory('Event', ['$resource', '$rootScope',
|
||||||
|
|
||||||
get: {
|
get: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
convert_dates(data);
|
convert_dates(data);
|
||||||
|
@ -57,7 +57,7 @@ eventManServices.factory('Event', ['$resource', '$rootScope',
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
convert_dates(data);
|
convert_dates(data);
|
||||||
|
@ -85,7 +85,7 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope',
|
||||||
all: {
|
all: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/tickets',
|
url: '/tickets',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: true,
|
isArray: true,
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
|
@ -96,7 +96,7 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope',
|
||||||
get: {
|
get: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: 'events/:id/tickets/:ticket_id',
|
url: 'events/:id/tickets/:ticket_id',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
if (data.error) {
|
if (data.error) {
|
||||||
|
@ -108,7 +108,7 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope',
|
||||||
|
|
||||||
add: {
|
add: {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: false,
|
isArray: false,
|
||||||
url: 'events/:event_id/tickets',
|
url: 'events/:event_id/tickets',
|
||||||
params: {uuid: $rootScope.app_uuid},
|
params: {uuid: $rootScope.app_uuid},
|
||||||
|
@ -123,7 +123,7 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope',
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: false,
|
isArray: false,
|
||||||
url: 'events/:event_id/tickets/:ticket_id',
|
url: 'events/:event_id/tickets/:ticket_id',
|
||||||
params: {uuid: $rootScope.app_uuid},
|
params: {uuid: $rootScope.app_uuid},
|
||||||
|
@ -137,7 +137,7 @@ eventManServices.factory('EventTicket', ['$resource', '$rootScope',
|
||||||
|
|
||||||
'delete': {
|
'delete': {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: false,
|
isArray: false,
|
||||||
url: 'events/:event_id/tickets/:ticket_id',
|
url: 'events/:event_id/tickets/:ticket_id',
|
||||||
params: {uuid: $rootScope.app_uuid},
|
params: {uuid: $rootScope.app_uuid},
|
||||||
|
@ -155,7 +155,7 @@ eventManServices.factory('Setting', ['$resource', '$rootScope',
|
||||||
return $resource('settings/', {}, {
|
return $resource('settings/', {}, {
|
||||||
query: {
|
query: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: true,
|
isArray: true,
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
|
@ -168,7 +168,7 @@ eventManServices.factory('Setting', ['$resource', '$rootScope',
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
interceptor : {responseError: $rootScope.errorHandler}
|
interceptor: {responseError: $rootScope.errorHandler}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}]
|
}]
|
||||||
|
@ -180,7 +180,27 @@ eventManServices.factory('Info', ['$resource', '$rootScope',
|
||||||
return $resource('info/', {}, {
|
return $resource('info/', {}, {
|
||||||
get: {
|
get: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
|
isArray: false,
|
||||||
|
transformResponse: function(data, headers) {
|
||||||
|
data = angular.fromJson(data);
|
||||||
|
if (data.error) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
return data.info || {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}]
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
eventManServices.factory('EbAPI', ['$resource', '$rootScope',
|
||||||
|
function($resource, $rootScope) {
|
||||||
|
return $resource('ebapi/', {}, {
|
||||||
|
apiImport: {
|
||||||
|
method: 'POST',
|
||||||
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: false,
|
isArray: false,
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
|
@ -200,7 +220,7 @@ eventManServices.factory('User', ['$resource', '$rootScope',
|
||||||
return $resource('users/:id', {id: '@_id'}, {
|
return $resource('users/:id', {id: '@_id'}, {
|
||||||
all: {
|
all: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
isArray: true,
|
isArray: true,
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
data = angular.fromJson(data);
|
data = angular.fromJson(data);
|
||||||
|
@ -213,7 +233,7 @@ eventManServices.factory('User', ['$resource', '$rootScope',
|
||||||
|
|
||||||
get: {
|
get: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
interceptor : {responseError: $rootScope.errorHandler},
|
interceptor: {responseError: $rootScope.errorHandler},
|
||||||
transformResponse: function(data, headers) {
|
transformResponse: function(data, headers) {
|
||||||
return angular.fromJson(data);
|
return angular.fromJson(data);
|
||||||
}
|
}
|
||||||
|
@ -221,24 +241,24 @@ eventManServices.factory('User', ['$resource', '$rootScope',
|
||||||
|
|
||||||
add: {
|
add: {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
interceptor : {responseError: $rootScope.errorHandler}
|
interceptor: {responseError: $rootScope.errorHandler}
|
||||||
},
|
},
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
interceptor : {responseError: $rootScope.errorHandler}
|
interceptor: {responseError: $rootScope.errorHandler}
|
||||||
},
|
},
|
||||||
|
|
||||||
login: {
|
login: {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: '/login',
|
url: '/login',
|
||||||
interceptor : {responseError: $rootScope.errorHandler}
|
interceptor: {responseError: $rootScope.errorHandler}
|
||||||
},
|
},
|
||||||
|
|
||||||
logout: {
|
logout: {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/logout',
|
url: '/logout',
|
||||||
interceptor : {responseError: $rootScope.errorHandler}
|
interceptor: {responseError: $rootScope.errorHandler}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}]
|
}]
|
||||||
|
|
|
@ -995,6 +995,20 @@ class UsersHandler(CollectionHandler):
|
||||||
super(UsersHandler, self).put(id_, resource, resource_id, **kwargs)
|
super(UsersHandler, self).put(id_, resource, resource_id, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class EbAPIImportHandler(BaseHandler):
|
||||||
|
"""Import events and attendees using Eventbrite API."""
|
||||||
|
@gen.coroutine
|
||||||
|
@authenticated
|
||||||
|
def post(self, *args, **kwargs):
|
||||||
|
reply = {}
|
||||||
|
data = escape.json_decode(self.request.body or '{}')
|
||||||
|
apiKey = data.get('apiKey')
|
||||||
|
targetEvent = data.get('targetEvent')
|
||||||
|
eventID = data.get('eventID')
|
||||||
|
create = data.get('create')
|
||||||
|
self.write(reply)
|
||||||
|
|
||||||
|
|
||||||
class EbCSVImportPersonsHandler(BaseHandler):
|
class EbCSVImportPersonsHandler(BaseHandler):
|
||||||
"""Importer for CSV files exported from Eventbrite."""
|
"""Importer for CSV files exported from Eventbrite."""
|
||||||
csvRemap = {
|
csvRemap = {
|
||||||
|
@ -1259,8 +1273,13 @@ def run():
|
||||||
(r'/v%s%s' % (API_VERSION, _users_path), UsersHandler, init_params),
|
(r'/v%s%s' % (API_VERSION, _users_path), UsersHandler, init_params),
|
||||||
(r"/(?:index.html)?", RootHandler, init_params),
|
(r"/(?:index.html)?", RootHandler, init_params),
|
||||||
(r"/ebcsvpersons", EbCSVImportPersonsHandler, init_params),
|
(r"/ebcsvpersons", EbCSVImportPersonsHandler, init_params),
|
||||||
|
(r"/v%s/ebcsvpersons" % API_VERSION, EbCSVImportPersonsHandler, init_params),
|
||||||
|
(r"/ebapi", EbAPIImportHandler, init_params),
|
||||||
|
(r"/v%s/ebapi" % API_VERSION, EbAPIImportHandler, init_params),
|
||||||
(r"/settings", SettingsHandler, init_params),
|
(r"/settings", SettingsHandler, init_params),
|
||||||
|
(r"/v%s/settings" % API_VERSION, SettingsHandler, init_params),
|
||||||
(r"/info", InfoHandler, init_params),
|
(r"/info", InfoHandler, init_params),
|
||||||
|
(r"/v%s/info" % API_VERSION, InfoHandler, init_params),
|
||||||
_ws_handler,
|
_ws_handler,
|
||||||
(r'/login', LoginHandler, init_params),
|
(r'/login', LoginHandler, init_params),
|
||||||
(r'/v%s/login' % API_VERSION, LoginHandler, init_params),
|
(r'/v%s/login' % API_VERSION, LoginHandler, init_params),
|
||||||
|
|
|
@ -58,12 +58,16 @@
|
||||||
"until": "fino a",
|
"until": "fino a",
|
||||||
"Delete event": "Cancella l'evento",
|
"Delete event": "Cancella l'evento",
|
||||||
"Delete all tickets in event": "Cancella tutti i ticket dell'evento",
|
"Delete all tickets in event": "Cancella tutti i ticket dell'evento",
|
||||||
|
"Import tickets with Eventbrite API": "Importa i biglietti tramite le API di Eventbrite",
|
||||||
|
"API key": "API key",
|
||||||
|
"Eventbrite Event ID": "Eventbrite Event ID",
|
||||||
|
"create a new event": "crea un nuovo evento",
|
||||||
|
"Associate tickets to this event": "Associa i biglietti a questo evento",
|
||||||
|
"Import": "Importa",
|
||||||
"Import tickets from Eventbrite CSV": "Importa i biglietti da un CSV Eventbrite",
|
"Import tickets from Eventbrite CSV": "Importa i biglietti da un CSV Eventbrite",
|
||||||
"CSV file": "File CSV",
|
"CSV file": "File CSV",
|
||||||
"CSV exported from Eventbrite": "CSV esportato da Eventbrite",
|
"CSV exported from Eventbrite": "CSV esportato da Eventbrite",
|
||||||
"Associate tickets to this event": "Associa i biglietti a questo evento",
|
|
||||||
"deduplicate entries": "deduplica le voci",
|
"deduplicate entries": "deduplica le voci",
|
||||||
"Import": "Importa",
|
|
||||||
"Users": "Utenti",
|
"Users": "Utenti",
|
||||||
"All tickets": "Tutti i biglietti",
|
"All tickets": "Tutti i biglietti",
|
||||||
"Import tickets": "Importa biglietti",
|
"Import tickets": "Importa biglietti",
|
||||||
|
|
Loading…
Reference in a new issue