|
|
@@ -62,6 +62,65 @@ module.exports = {
|
|
62
|
62
|
});
|
|
63
|
63
|
},
|
|
64
|
64
|
|
|
|
65
|
+ edit_event: function (event_id, name, location, start, end, details, auth, complete) {
|
|
|
66
|
+ var self = this;
|
|
|
67
|
+ self.get_event(event_id, "", function (response) {
|
|
|
68
|
+ if (response.event.id) {
|
|
|
69
|
+ var event = response.event;
|
|
|
70
|
+ permissions_controller.user_can_manage_soc_events(auth, event.society, function (manageable) {
|
|
|
71
|
+ if (manageable) {
|
|
|
72
|
+ var success = true;
|
|
|
73
|
+ if (name) {
|
|
|
74
|
+ redis.hset("event:" + event_id, "name", name);
|
|
|
75
|
+ }
|
|
|
76
|
+ if (location) {
|
|
|
77
|
+ redis.hset("event:" + event_id, "location", location);
|
|
|
78
|
+ }
|
|
|
79
|
+ if (start) {
|
|
|
80
|
+ if (start > Date.now()) {
|
|
|
81
|
+ redis.hset("event:" + event_id, "start", start);
|
|
|
82
|
+ } else {
|
|
|
83
|
+ success = false;
|
|
|
84
|
+ complete({
|
|
|
85
|
+ "success": 0,
|
|
|
86
|
+ "error": 3
|
|
|
87
|
+ });
|
|
|
88
|
+ }
|
|
|
89
|
+ }
|
|
|
90
|
+ if (end) {
|
|
|
91
|
+ if (end > event.end && end > Date.now()) {
|
|
|
92
|
+ redis.hset("event:" + event_id, "end", end);
|
|
|
93
|
+ } else {
|
|
|
94
|
+ success = false;
|
|
|
95
|
+ complete({
|
|
|
96
|
+ "success": 0,
|
|
|
97
|
+ "error": 3
|
|
|
98
|
+ });
|
|
|
99
|
+ }
|
|
|
100
|
+ }
|
|
|
101
|
+ if (details) {
|
|
|
102
|
+ redis.hset("event:" + event_id, "details", details);
|
|
|
103
|
+ }
|
|
|
104
|
+ complete({
|
|
|
105
|
+ "success": 1,
|
|
|
106
|
+ "error": 0
|
|
|
107
|
+ });
|
|
|
108
|
+ } else {
|
|
|
109
|
+ complete({
|
|
|
110
|
+ "success": 0,
|
|
|
111
|
+ "error": 1
|
|
|
112
|
+ });
|
|
|
113
|
+ }
|
|
|
114
|
+ });
|
|
|
115
|
+ } else {
|
|
|
116
|
+ complete({
|
|
|
117
|
+ "success": 0,
|
|
|
118
|
+ "error": 2
|
|
|
119
|
+ });
|
|
|
120
|
+ }
|
|
|
121
|
+ }, true);
|
|
|
122
|
+ },
|
|
|
123
|
+
|
|
65
|
124
|
cancel_event: function (event_id, auth, complete, force) {
|
|
66
|
125
|
var self = this;
|
|
67
|
126
|
self.get_event(event_id, auth, function (response) {
|