-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
119 lines (108 loc) · 3.23 KB
/
config.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
'use strict';
var itemProp = require(__dirname + "/model/schemas/item.js");
module.exports = {
"serviceName": "shoppingCart",
"serviceVersion": 1,
"servicePort": 4900,
"serviceGroup": "SOAJS Shopping Cart",
"extKeyRequired": true,
"session": true,
type: "service",
prerequisites: {
cpu: '',
memory: ''
},
"errors": {
400: "Failed to connect to Database", // unknown db connection error
401: "Invalid user Id provided", //user id does not match the logged in user
402: "You are not logged in",//invalid login,
403: "Cart is empty", //deprecated,
407: "Internal Server Error"
},
"schema": {
"commonFields": {
"userId": {
"source": ['query.userId'],
"required": true,
"validation": {
"type": "string"
}
},
"model": {
"source": ['query.model'],
"required": false,
"default": "mongo",
"validation": {
"type": "string",
"enum": ["testModel" , "mongo"]
}
}
},
"/cart/getCart": {
"_apiInfo": {
"l": "Get all items of a given user cart",
"group": "Basic"
},
"commonFields": ["userId", "model"]
},
"/cart/setCart": {
"_apiInfo": {
"l": "Add items to cart",
"group": "Basic"
},
"commonFields": ["userId", "model"],
// reset the cart or add items to the old ones
"add" : {
"source": ['query.add'],
"default" : false,
"validation": {
"type" : "boolean"
}
},
"items": {
"source": ['body.items'],
"validation": {
"type": "array",
"items": {
"type": "object",
"properties": itemProp
},
"minItems": 0,
"uniqeItems": true,
"additionalItems": false
}// validation
}//items
},//set cart
"/cart/emptyCart":{
"_apiInfo": {
"l": "empty cart",
"group": "Basic"
},
"commonFields": ["userId", "model"]
},//emptyCart
"/cart/getCarts":{
"_apiInfo": {
"l": "list all user carts",
"group": "Manage"
}
,
"start": {
"source": ['query.start'],
"required": false,
"default" : 0,
"validation": {
"type": "integer"
}
},
"limit": {
"source": ['query.limit'],
"default" : 1000,
"required": false,
"validation": {
"type": "integer"
}
},
"commonFields": [ "model"]
}//getCarts
}//schema,
};//exports;