-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
35 lines (27 loc) · 699 Bytes
/
app.js
File metadata and controls
35 lines (27 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var couchapp = require('couchapp')
, path = require('path')
ddoc =
{ _id:'_design/apk-deployer'
, rewrites :
[ {from:"/", to:'index.html'}
, {from:"/api", to:'../../'}
, {from:"/api/*", to:'../../*'}
, {from:"/*", to:'*'}
]
}
ddoc.views = {
apks: {
map: function(doc) {
if (doc.kind == 'apk') {
emit(doc._id, true)
}
}
}
}
ddoc.validate_doc_update = function (newDoc, oldDoc, userCtx) {
if (newDoc._deleted === true && userCtx.roles.indexOf('_admin') === -1) {
throw "Only admin can delete documents on this database."
}
}
couchapp.loadAttachments(ddoc, path.join(__dirname, 'attachments'))
module.exports = ddoc