|
2 | 2 | from recastdb.database import db |
3 | 3 |
|
4 | 4 | from eve_sqlalchemy.decorators import registerSchema |
5 | | - |
| 5 | +from eve.utils import config |
6 | 6 | from recastrestapi.apiconfig import config as apiconf |
7 | 7 |
|
8 | 8 |
|
| 9 | +DEBUG = True |
| 10 | + |
| 11 | +SQLALCHEMY_DATABASE_URI = apiconf['DBPATH'] |
| 12 | +RESOURCE_METHODS = ['GET', 'POST', 'DELETE'] |
| 13 | +PUBLIC_ITEM_METHODS = ['GET', 'POST'] |
| 14 | +HATEOAS = True |
| 15 | +IF_MATCH = False |
| 16 | +LAST_UPDATED = '_updated' |
| 17 | +DATE_CREATED = '_created' |
| 18 | + |
| 19 | +ID_FIELD = 'id' |
| 20 | +ITEM_LOOKUP_FIELD = ID_FIELD |
| 21 | +config.ID_FIELD = ID_FIELD |
| 22 | +config.ITEM_LOOKUP_FIELD = ID_FIELD |
| 23 | + |
| 24 | +XML = True |
| 25 | +JSON = True |
| 26 | + |
9 | 27 | registerSchema('users')(recastdb.models.User) |
10 | 28 | registerSchema('analysis')(recastdb.models.Analysis) |
11 | 29 | registerSchema('subscriptions')(recastdb.models.Subscription) |
|
21 | 39 | registerSchema('point_responses')(recastdb.models.PointResponse) |
22 | 40 | registerSchema('basic_responses')(recastdb.models.BasicResponse) |
23 | 41 | registerSchema('histograms')(recastdb.models.Histogram) |
| 42 | +registerSchema('access_tokens')(recastdb.models.AccessToken) |
24 | 43 |
|
25 | | -DEBUG = True |
26 | | - |
27 | | -SQLALCHEMY_DATABASE_URI = apiconf['DBPATH'] |
28 | | - |
29 | | -XML = True |
30 | | -JSON = False |
31 | 44 |
|
32 | 45 | DOMAIN = { |
33 | 46 | 'users': recastdb.models.User._eve_schema['users'], |
|
45 | 58 | 'point_responses': recastdb.models.PointResponse._eve_schema['point_responses'], |
46 | 59 | 'basic_responses': recastdb.models.BasicResponse._eve_schema['basic_responses'], |
47 | 60 | 'histograms': recastdb.models.Histogram._eve_schema['histograms'], |
| 61 | + 'access_tokens': recastdb.models.AccessToken._eve_schema['access_tokens'], |
48 | 62 | } |
49 | 63 |
|
50 | 64 | DOMAIN['users'].update({ |
|
55 | 69 | }, |
56 | 70 | 'cache_control': 'max-age=10,must-revalidate', |
57 | 71 | 'cache_expires': 10, |
| 72 | + 'resource_methods': ['GET', 'POST', 'DELETE'], |
| 73 | + 'item_methods': ['GET', 'PUT', 'PATCH'] |
| 74 | + }) |
| 75 | + |
| 76 | +DOMAIN['analysis'].update({ |
| 77 | + 'item_lookup_field': 'id', |
| 78 | + 'additional_lookup': { |
| 79 | + 'url': 'regex("[\w]+")', |
| 80 | + 'field': 'collaboration' |
| 81 | + }, |
| 82 | + 'cache_control': 'max-age=10,must-revalidate', |
| 83 | + 'cache_expires': 10, |
58 | 84 | 'resource_methods': ['GET', 'POST', 'DELETE'] |
59 | 85 | }) |
60 | 86 |
|
| 87 | +DOMAIN['run_conditions'].update({ |
| 88 | + 'item_lookup_field': 'id', |
| 89 | + 'additional_lookup': { |
| 90 | + 'url': 'regex("[0-9]+")', |
| 91 | + 'field': 'id' |
| 92 | + }, |
| 93 | + 'cache_control': 'max-age=10,must-revalidate', |
| 94 | + 'cache_expires': 10, |
| 95 | + 'resource_methods': ['GET', 'POST', 'DELETE'], |
| 96 | + 'item_methods': ['GET', 'PUT', 'PATCH'] |
| 97 | + }) |
| 98 | + |
0 commit comments