Subversion Repositories SmartDukaan

Rev

Rev 14499 | Rev 14575 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14499 Rev 14552
Line 54... Line 54...
54
        resp.body = json.dumps(json_docs, encoding='utf-8')
54
        resp.body = json.dumps(json_docs, encoding='utf-8')
55
 
55
 
56
    
56
    
57
    def on_post(self, req, resp):
57
    def on_post(self, req, resp):
58
        
58
        
-
 
59
        multi = req.get_param_as_int("multi")
-
 
60
        
59
        try:
61
        try:
60
            result_json = json.loads(req.stream.read(), encoding='utf-8')
62
            result_json = json.loads(req.stream.read(), encoding='utf-8')
61
        except ValueError:
63
        except ValueError:
62
            raise falcon.HTTPError(falcon.HTTP_400,
64
            raise falcon.HTTPError(falcon.HTTP_400,
63
                'Malformed JSON',
65
                'Malformed JSON',
64
                'Could not decode the request body. The '
66
                'Could not decode the request body. The '
65
                'JSON was incorrect.')
67
                'JSON was incorrect.')
66
            
68
            
67
        result = Mongo.addSchemeDetailsForSku(result_json)
69
        result = Mongo.addSchemeDetailsForSku(result_json, multi)
68
        resp.body = json.dumps(result, encoding='utf-8')
70
        resp.body = json.dumps(result, encoding='utf-8')
69
        
71
        
70
class SkuDiscountInfo():
72
class SkuDiscountInfo():
71
    
73
    
72
    def on_get(self, req, resp):
74
    def on_get(self, req, resp):
Line 78... Line 80...
78
        resp.body = json.dumps(json_docs, encoding='utf-8')
80
        resp.body = json.dumps(json_docs, encoding='utf-8')
79
 
81
 
80
    
82
    
81
    def on_post(self, req, resp):
83
    def on_post(self, req, resp):
82
        
84
        
-
 
85
        multi = req.get_param_as_int("multi")
-
 
86
        
83
        try:
87
        try:
84
            result_json = json.loads(req.stream.read(), encoding='utf-8')
88
            result_json = json.loads(req.stream.read(), encoding='utf-8')
85
        except ValueError:
89
        except ValueError:
86
            raise falcon.HTTPError(falcon.HTTP_400,
90
            raise falcon.HTTPError(falcon.HTTP_400,
87
                'Malformed JSON',
91
                'Malformed JSON',
88
                'Could not decode the request body. The '
92
                'Could not decode the request body. The '
89
                'JSON was incorrect.')
93
                'JSON was incorrect.')
90
            
94
            
91
        result = Mongo.addSkuDiscountInfo(result_json)
95
        result = Mongo.addSkuDiscountInfo(result_json, multi)
92
        resp.body = json.dumps(result, encoding='utf-8')
96
        resp.body = json.dumps(result, encoding='utf-8')
93
        
97
        
94
    def on_put(self, req, resp, _id):
98
    def on_put(self, req, resp, _id):
95
        try:
99
        try:
96
            result_json = json.loads(req.stream.read(), encoding='utf-8')
100
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 114... Line 118...
114
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
118
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
115
        resp.body = json.dumps(json_docs, encoding='utf-8')
119
        resp.body = json.dumps(json_docs, encoding='utf-8')
116
    
120
    
117
    def on_post(self, req, resp):
121
    def on_post(self, req, resp):
118
        
122
        
-
 
123
        multi = req.get_param_as_int("multi")
-
 
124
        
119
        try:
125
        try:
120
            result_json = json.loads(req.stream.read(), encoding='utf-8')
126
            result_json = json.loads(req.stream.read(), encoding='utf-8')
121
        except ValueError:
127
        except ValueError:
122
            raise falcon.HTTPError(falcon.HTTP_400,
128
            raise falcon.HTTPError(falcon.HTTP_400,
123
                'Malformed JSON',
129
                'Malformed JSON',
124
                'Could not decode the request body. The '
130
                'Could not decode the request body. The '
125
                'JSON was incorrect.')
131
                'JSON was incorrect.')
126
            
132
            
127
        result = Mongo.addExceptionalNlc(result_json)
133
        result = Mongo.addExceptionalNlc(result_json, multi)
128
        resp.body = json.dumps(result, encoding='utf-8')
134
        resp.body = json.dumps(result, encoding='utf-8')
129
    
135
    
130
    def on_put(self, req, resp, _id):
136
    def on_put(self, req, resp, _id):
131
        try:
137
        try:
132
            result_json = json.loads(req.stream.read(), encoding='utf-8')
138
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 225... Line 231...
225
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
231
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
226
        resp.body = json.dumps(json_docs, encoding='utf-8')
232
        resp.body = json.dumps(json_docs, encoding='utf-8')
227
    
233
    
228
    def on_post(self, req, resp):
234
    def on_post(self, req, resp):
229
        
235
        
-
 
236
        multi = req.get_param_as_int("multi")
-
 
237
        
230
        try:
238
        try:
231
            result_json = json.loads(req.stream.read(), encoding='utf-8')
239
            result_json = json.loads(req.stream.read(), encoding='utf-8')
232
        except ValueError:
240
        except ValueError:
233
            raise falcon.HTTPError(falcon.HTTP_400,
241
            raise falcon.HTTPError(falcon.HTTP_400,
234
                'Malformed JSON',
242
                'Malformed JSON',
235
                'Could not decode the request body. The '
243
                'Could not decode the request body. The '
236
                'JSON was incorrect.')
244
                'JSON was incorrect.')
237
            
245
            
238
        result = Mongo.addSkuDealerPrice(result_json)
246
        result = Mongo.addSkuDealerPrice(result_json, multi)
239
        resp.body = json.dumps(result, encoding='utf-8')
247
        resp.body = json.dumps(result, encoding='utf-8')
240
    
248
    
241
    def on_put(self, req, resp, _id):
249
    def on_put(self, req, resp, _id):
242
        try:
250
        try:
243
            result_json = json.loads(req.stream.read(), encoding='utf-8')
251
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 289... Line 297...
289
        resp.body = dumps(result) 
297
        resp.body = dumps(result) 
290
 
298
 
291
    
299
    
292
    def on_post(self, req, resp):
300
    def on_post(self, req, resp):
293
        
301
        
-
 
302
        multi = req.get_param_as_int("multi")
-
 
303
        
294
        try:
304
        try:
295
            result_json = json.loads(req.stream.read(), encoding='utf-8')
305
            result_json = json.loads(req.stream.read(), encoding='utf-8')
296
        except ValueError:
306
        except ValueError:
297
            raise falcon.HTTPError(falcon.HTTP_400,
307
            raise falcon.HTTPError(falcon.HTTP_400,
298
                'Malformed JSON',
308
                'Malformed JSON',
299
                'Could not decode the request body. The '
309
                'Could not decode the request body. The '
300
                'JSON was incorrect.')
310
                'JSON was incorrect.')
301
            
311
            
302
        result = Mongo.addNegativeDeals(result_json)
312
        result = Mongo.addNegativeDeals(result_json, multi)
303
        resp.body = json.dumps(result, encoding='utf-8')
313
        resp.body = json.dumps(result, encoding='utf-8')
304
 
314
 
305
class ManualDeals():
315
class ManualDeals():
306
    
316
    
307
    def on_get(self, req, resp):
317
    def on_get(self, req, resp):
Line 313... Line 323...
313
        resp.body = dumps(result)
323
        resp.body = dumps(result)
314
 
324
 
315
    
325
    
316
    def on_post(self, req, resp):
326
    def on_post(self, req, resp):
317
        
327
        
-
 
328
        multi = req.get_param_as_int("multi")
-
 
329
        
318
        try:
330
        try:
319
            result_json = json.loads(req.stream.read(), encoding='utf-8')
331
            result_json = json.loads(req.stream.read(), encoding='utf-8')
320
        except ValueError:
332
        except ValueError:
321
            raise falcon.HTTPError(falcon.HTTP_400,
333
            raise falcon.HTTPError(falcon.HTTP_400,
322
                'Malformed JSON',
334
                'Malformed JSON',
323
                'Could not decode the request body. The '
335
                'Could not decode the request body. The '
324
                'JSON was incorrect.')
336
                'JSON was incorrect.')
325
            
337
            
326
        result = Mongo.addManualDeal(result_json)
338
        result = Mongo.addManualDeal(result_json, multi)
327
        resp.body = json.dumps(result, encoding='utf-8')
339
        resp.body = json.dumps(result, encoding='utf-8')
328
        
340
        
329
class CommonDelete():
341
class CommonDelete():
330
    
342
    
331
    def on_post(self,req,resp):
343
    def on_post(self,req,resp):
Line 363... Line 375...
363
        resp.body = dumps(result)
375
        resp.body = dumps(result)
364
 
376
 
365
    
377
    
366
    def on_post(self, req, resp):
378
    def on_post(self, req, resp):
367
        
379
        
-
 
380
        multi = req.get_param_as_int("multi")
-
 
381
        
368
        try:
382
        try:
369
            result_json = json.loads(req.stream.read(), encoding='utf-8')
383
            result_json = json.loads(req.stream.read(), encoding='utf-8')
370
        except ValueError:
384
        except ValueError:
371
            raise falcon.HTTPError(falcon.HTTP_400,
385
            raise falcon.HTTPError(falcon.HTTP_400,
372
                'Malformed JSON',
386
                'Malformed JSON',
373
                'Could not decode the request body. The '
387
                'Could not decode the request body. The '
374
                'JSON was incorrect.')
388
                'JSON was incorrect.')
375
            
389
            
376
        result = Mongo.addFeaturedDeal(result_json)
390
        result = Mongo.addFeaturedDeal(result_json, multi)
377
        resp.body = json.dumps(result, encoding='utf-8')
391
        resp.body = json.dumps(result, encoding='utf-8')
378
 
392
 
379
 
393
 
380
class CommonSearch():
394
class CommonSearch():
381
    
395