Newer
Older
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# @author: Kevin S Hahn
"""
API request handlers for Apps.
represents the /nimsapi/apps route
"""
import bson
import logging
log = logging.getLogger('nimsapi.jobs')
import base
# TODO: create schemas to verify various json payloads
APP_SCHEMA = {}
class Apps(base.RequestHandler):
"""Return information about the all the apps."""
def get(self):
return list(self.app.db.apps.find())
# TODO: add post route
def count(self):
return self.app.db.apps.count()
class App(base.RequestHandler):
json_schema = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'App',
'type': 'object',
'properties': {
'_id': {
'title': 'App ID',
'type': 'string',
},
},
'required': ['_id'],
'additionalProperties': True,
}
def get(self, _id):
_id = bson.ObjectId(_id)