Skip to content

Commit ef4b40b

Browse files
committed
Merge pull request #15 from performant-software/master
Merge forks in preparation for release.
2 parents 84e803e + 66f7133 commit ef4b40b

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ config.js
99
.env
1010

1111
# backups
12-
backups/
12+
_backups/
1313

1414
*.rej
15+
16+
*.log

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"jwt-simple": "0.1.0",
66
"express": "3.4.4",
77
"less-middleware": "0.1.12",
8-
"mongoose": "3.6.20",
9-
"v8tools": "0.2.2"
8+
"mongoose": "4.1.9"
109
},
1110
"engines": {
1211
"node": "0.10.21",

web.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ var Annotation = new Schema({
137137
admin: [String],
138138
update: [String],
139139
delete: [String]
140+
},
141+
annotation_categories: [Number],
142+
sort_position: {
143+
type: String,
144+
required: false
140145
}
141146
});
142147

@@ -222,6 +227,9 @@ app.get('/api/search', tokenOK, function(req, res) {
222227
if (req.query.tags) {
223228
query.where('tags'). in (req.query.tags.split(/[\s,]+/));
224229
}
230+
if (req.query.annotation_categories) {
231+
query.where('annotation_categories'). in (req.query.annotation_categories);
232+
}
225233

226234
query.limit(req.query.limit);
227235

@@ -306,7 +314,9 @@ app.post('/api/annotations', tokenOK, function(req, res) {
306314
parentIndex: req.body.parentIndex,
307315
ranges: req.body.ranges,
308316
shapes: req.body.shapes,
309-
permissions: req.body.permissions
317+
permissions: req.body.permissions,
318+
annotation_categories: req.body.annotation_categories,
319+
sort_position: req.body.sort_position
310320
});
311321

312322
annotation.save(function(err) {
@@ -320,6 +330,13 @@ app.post('/api/annotations', tokenOK, function(req, res) {
320330
return res.send(annotation);
321331
});
322332

333+
app.post('/api/annotations/positions', tokenOK, function(req, res) {
334+
for(annotation_id in req.body.sort_positions) {
335+
AnnotationModel.update({ uuid: annotation_id }, { $set: { sort_position: req.body.sort_positions[annotation_id] }}, function() { });
336+
}
337+
res.send('Positions have been updated');
338+
});
339+
323340
// PUT to UPDATE
324341
// Single update
325342
app.put('/api/annotations/:id', tokenOK, function(req, res) {
@@ -344,6 +361,8 @@ app.put('/api/annotations/:id', tokenOK, function(req, res) {
344361
annotation.parentIndex = req.body.parentIndex;
345362
annotation.ranges = req.body.ranges;
346363
annotation.permissions = req.body.permissions;
364+
annotation.annotation_categories = req.body.annotation_categories;
365+
annotation.sort_position = req.body.sort_position;
347366

348367
return annotation.save(function(err) {
349368
if (!err) {

0 commit comments

Comments
 (0)