1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var HttpDataController = require('./data');
|
10 | var LangUtils = require('@themost/common/utils').LangUtils;
|
11 | var httpGet = require('../decorators').httpGet;
|
12 | var httpPost = require('../decorators').httpPost;
|
13 | var httpPut = require('../decorators').httpPut;
|
14 | var httpDelete = require('../decorators').httpDelete;
|
15 | var httpAction = require('../decorators').httpAction;
|
16 | var httpController = require('../decorators').httpController;
|
17 | var defineDecorator = require('../decorators').defineDecorator;
|
18 | var Q = require('q');
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | function HttpDataModelController() {
|
25 | HttpDataModelController.super_.bind(this)();
|
26 | }
|
27 | LangUtils.inherits(HttpDataModelController, HttpDataController);
|
28 | defineDecorator(HttpDataModelController, 'constructor', httpController());
|
29 |
|
30 | HttpDataModelController.prototype.getItems = function() {
|
31 | return Q.nbind(HttpDataModelController.super_.prototype.index,this)();
|
32 | };
|
33 |
|
34 | defineDecorator(HttpDataModelController.prototype, 'getItems', httpGet());
|
35 | defineDecorator(HttpDataModelController.prototype, 'getItems', httpAction("index"));
|
36 |
|
37 | HttpDataModelController.prototype.postItems = function() {
|
38 | return Q.nbind(HttpDataModelController.super_.prototype.index,this)();
|
39 | };
|
40 |
|
41 | defineDecorator(HttpDataModelController.prototype, 'postItems', httpPost());
|
42 | defineDecorator(HttpDataModelController.prototype, 'postItems', httpAction("index"));
|
43 |
|
44 | HttpDataModelController.prototype.putItems = function() {
|
45 | return Q.nbind(HttpDataModelController.super_.prototype.index,this)();
|
46 | };
|
47 |
|
48 | defineDecorator(HttpDataModelController.prototype, 'putItems', httpPut());
|
49 | defineDecorator(HttpDataModelController.prototype, 'putItems', httpAction("index"));
|
50 |
|
51 | HttpDataModelController.prototype.deleteItems = function() {
|
52 | return Q.nbind(HttpDataModelController.super_.prototype.index,this)();
|
53 | };
|
54 |
|
55 | defineDecorator(HttpDataModelController.prototype, 'deleteItems', httpDelete());
|
56 | defineDecorator(HttpDataModelController.prototype, 'deleteItems', httpAction("index"));
|
57 |
|
58 |
|
59 | HttpDataModelController.prototype.showItem = function() {
|
60 | return Q.nbind(HttpDataModelController.super_.prototype.show,this)();
|
61 | };
|
62 |
|
63 | defineDecorator(HttpDataModelController.prototype, 'showItem', httpGet());
|
64 | defineDecorator(HttpDataModelController.prototype, 'showItem', httpAction("show"));
|
65 |
|
66 | HttpDataModelController.prototype.createItem = function() {
|
67 | return {};
|
68 | };
|
69 |
|
70 | defineDecorator(HttpDataModelController.prototype, 'createItem', httpGet());
|
71 | defineDecorator(HttpDataModelController.prototype, 'createItem', httpAction("create"));
|
72 |
|
73 | HttpDataModelController.prototype.getItem = function() {
|
74 | return Q.nbind(HttpDataModelController.super_.prototype.edit,this)();
|
75 | };
|
76 |
|
77 | defineDecorator(HttpDataModelController.prototype, 'getItem', httpGet());
|
78 | defineDecorator(HttpDataModelController.prototype, 'getItem', httpAction("edit"));
|
79 |
|
80 | HttpDataModelController.prototype.postItem = function() {
|
81 | return Q.nbind(HttpDataModelController.super_.prototype.edit,this)();
|
82 | };
|
83 |
|
84 | defineDecorator(HttpDataModelController.prototype, 'postItem', httpPost());
|
85 | defineDecorator(HttpDataModelController.prototype, 'postItem', httpAction("edit"));
|
86 |
|
87 | HttpDataModelController.prototype.deleteItem = function() {
|
88 | return Q.nbind(HttpDataModelController.super_.prototype.edit,this)();
|
89 | };
|
90 |
|
91 | defineDecorator(HttpDataModelController.prototype, 'deleteItem', httpDelete());
|
92 | defineDecorator(HttpDataModelController.prototype, 'deleteItem', httpAction("edit"));
|
93 |
|
94 | if (typeof module !== 'undefined') {
|
95 | module.exports = HttpDataModelController;
|
96 | } |
\ | No newline at end of file |