Subversion Repositories SmartDukaan

Rev

Rev 4333 | Rev 4375 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
85 ashish 1
namespace java in.shop2020.model.v1.catalog
95 ashish 2
namespace py shop2020.thriftpy.model.v1.catalog
85 ashish 3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
85 ashish 6
/**
7
	Objects
8
*/
9
 
123 ashish 10
/**
1330 chandransh 11
Caution :- Never ever change the numbers in it. Please confirm from @Chandranshu or @Rajveer before any changes in enum and other entries in file.
123 ashish 12
**/
103 ashish 13
enum status{
123 ashish 14
	PHASED_OUT = 0,		//Item is no longer selling
15
	DELETED = 1,		//Item has been deliberately deleted 
3009 chandransh 16
	PAUSED = 2,			//Item's sale has been paused manually.
123 ashish 17
	ACTIVE = 3,			//Item is available for sale as of now
2984 rajveer 18
	IN_PROCESS = 4,		//Item has been added, but content is not available for the same
19
	CONTENT_COMPLETE = 5,  //The content for this item has been completed. We can start selling the item now.
3009 chandransh 20
	PAUSED_BY_RISK = 6    //Item's sale has been automatically paused since it was marked as risky
103 ashish 21
}
22
 
646 chandransh 23
enum WarehouseLocation{
1330 chandransh 24
	Mumbai = 0,
25
	Delhi = 1,
646 chandransh 26
	Bangalore = 2,
27
	Kolkata = 3
28
}
29
 
1330 chandransh 30
struct Vendor{
31
	1:i64 id,
32
	2:string name
33
}
34
 
2841 chandransh 35
enum BillingType {
36
	OURS = 0,
37
	EXTERNAL = 1
38
}
39
 
483 rajveer 40
/* 
41
Warehouse fields details
42
location: it is full address
43
vendorString: some key for the warehouse
44
*/
85 ashish 45
struct Warehouse{
46
	1:i64 id,
752 chandransh 47
	2:string displayName,
48
	3:string location,
49
	4:status warehouseStatus,
50
	5:i64 addedOn,
51
	6:i64 lastCheckedOn,
52
	7:string tinNumber,
53
	8:string pincode,
54
	9:string vendorString,
2824 chandransh 55
	10:WarehouseLocation logisticsLocation,
56
	11:string vendor,
4333 anupam.sin 57
	/*
58
	vendorId in fact should be list of vendorIds as warehouse-vendor is a many-to-many mapping
59
	*/
2841 chandransh 60
	12:i64 vendorId,
61
	13:BillingType billingType
85 ashish 62
}
4024 chandransh 63
 
115 ashish 64
/* */
85 ashish 65
struct ItemInventory{
66
	1:i64 id,
483 rajveer 67
	2:map<i64,i64> availability
85 ashish 68
}
69
 
483 rajveer 70
 
85 ashish 71
struct ItemInventoryHistory{
72
	1:i64 item_id,
73
	2:i64 warehouse_id,
74
	3:i64 timestamp,
75
	4:i64 availability
76
}
77
 
78
struct Item{
79
	1:i64 id,
956 chandransh 80
	2:string productGroup
81
	3:string brand,
82
	4:string modelNumber,
2128 ankur.sing 83
	5:string modelName,
84
	6:string color,
85
	7:i64 category,
86
	8:string comments,
87
	9:i64 catalogItemId,
88
	10:i64 featureId,
89
	11:string featureDescription,
90
	12:ItemInventory itemInventory,
2127 ankur.sing 91
	13:optional double mrp, //maxmimum retail price
2491 ankur.sing 92
	14:optional double mop, //market operative price
2127 ankur.sing 93
	15:optional double sellingPrice, //Selling price
2491 ankur.sing 94
	16:optional double transferPrice,
2127 ankur.sing 95
	17:optional double weight,
2128 ankur.sing 96
	18:i64 addedOn,
2491 ankur.sing 97
	19:optional i64 startDate,
98
	20:optional i64 retireDate,
720 chandransh 99
	21:status itemStatus,
2128 ankur.sing 100
	22:string status_description,
101
	23:map<string,string> otherInfo,
102
	24:string bestDealText,
2127 ankur.sing 103
	25:optional double bestDealValue,
2491 ankur.sing 104
	26:optional double dealerPrice,
2128 ankur.sing 105
	27:bool defaultForEntity,
106
	28:i64 updatedOn,
2127 ankur.sing 107
	29:optional i64 bestSellingRank, 
2249 ankur.sing 108
	30:string hotspotCategory,
3355 chandransh 109
	31:bool risky,
3359 chandransh 110
	32:optional i32 expectedDelay,
4295 varun.gupt 111
	33:optional string preferredWarehouse,
112
	34:i32 warrantyPeriod
85 ashish 113
}
114
 
1343 chandransh 115
struct VendorItemPricing{
1349 chandransh 116
	1:i64 vendorId,
117
	2:i64 itemId,
1343 chandransh 118
	3:double transferPrice,
119
	4:double mop,
120
	5:double dealerPrice
121
}
122
 
1967 rajveer 123
struct Category{
124
	1:i64 id,
125
	2:string label,
126
	3:string description,
127
	4:i64 parent_category_id,
128
	/**
129
	* This field should not be used.
130
	*/
131
	5:list<i64> children_category_ids
132
}
2113 ankur.sing 133
 
134
struct VendorItemMapping{
135
	1:i64 vendorId,
136
	2:string itemKey,
137
	3:i64 itemId,
138
	4:string vendorCategory
139
}
2983 chandransh 140
 
141
struct ItemShippingInfo{
142
	1:bool isActive,
143
	2:optional bool isRisky,
144
	3:optional i64 quantity
145
}
146
 
3556 rajveer 147
struct Source{
148
	1:i64 id,
149
	2:string name,
150
	3:string identifier
151
}
152
 
153
struct SourceItemPricing{
154
	1:i64 sourceId,
155
	2:i64 itemId,
156
	3:double mrp,
157
	4:double sellingPrice
158
}
159
 
4024 chandransh 160
struct AvailableAndReservedStock {
161
	1:i64 itemId,
162
	2:i64 available,
163
	3:i64 reserved,
164
	4:i64 minimumStock
165
}
166
 
4295 varun.gupt 167
struct ProductNotificationRequest	{
168
	1:Item item,
169
	2:string email,
170
	3:i64 addedOn
171
}
172
 
173
struct ProductNotificationRequestCount	{
174
	1:Item item,
175
	2:i64 count
176
}
177
 
121 ashish 178
exception InventoryServiceException{
85 ashish 179
	1:i64 id,
180
	2:string message
181
}
182
 
3374 rajveer 183
service InventoryService extends GenericService.GenericService{
763 rajveer 184
 
85 ashish 185
/**
186
	Availability and inventory attributes	
187
*/
188
	//all add and update methods - added by Ashish
123 ashish 189
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
190
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 191
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
2983 chandransh 192
 
193
	/**
4332 anupam.sin 194
	add a new vendor
195
	*/
196
	i64 addVendor(1:Vendor vendor) throws (1:InventoryServiceException cex),
197
	bool addWarehouseVendorMapping(1:i64 warehouse_id, 2:i64 vendorId),
198
	list<Vendor> getVendorsForWarehouse(1:i64 warehouse_id),
199
	list<Warehouse> getWarehousesForVendor(1:i64 vendorId),
200
 
201
	/**
2983 chandransh 202
	Checks if the item given to the corresponding itemId is active. If it's active,
203
	whether it's risky and if it's risky, its inventory position.
204
	*/
205
	ItemShippingInfo isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
206
 
2033 rajveer 207
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
3323 chandransh 208
 
209
	/**
210
	Stores the incremental warehouse updates of items.
211
	*/
212
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
213
 
214
	/**
215
	Stores the final inventory stocks of items.
216
	*/
483 rajveer 217
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 218
 
4320 rajveer 219
	/**
220
	Add the inventory to existing stock.
221
	*/
222
	void addInventory(1:i64 itemId, 2:i64 warehouseId, 3:i64 quantity) throws (1:InventoryServiceException cex),
223
 
103 ashish 224
	//all delete methods
121 ashish 225
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 226
 
227
	//Item management apis
121 ashish 228
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
229
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
230
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 231
	//Other accessor methods - added by Ashish
121 ashish 232
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 233
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 234
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
235
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
236
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 237
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
238
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 239
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 240
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 241
 
3355 chandransh 242
	/**
3848 chandransh 243
	Gets at most 'limit' items starting at the given offset. Returns an empty list if there are no more items at the given offset.
244
	*/
245
	list<Item> getAllItemsInRange(1:i64 offset, 2:i64 limit) throws (1:InventoryServiceException cex),
246
 
247
	/**
248
	Gets at most 'limit' items starting at the given offset in the given status. Returns an empty list if there are no more items at the given offset.
249
	*/
250
	list<Item> getAllItemsByStatusInRange(1:status itemStatus, 2:i64 offset, 3:i64 limit) throws (1:InventoryServiceException cex),
251
 
252
	/**
253
	Gets a count of all items by status
254
	*/
255
	i32 getItemCountByStatus(1:bool useStatus, 2:status itemStatus),
256
	/**
3355 chandransh 257
	Determines the warehouse that should be used to fulfil an order for the given item.
258
	It first checks all the warehouses which are in the logistics location given by the
259
	warehouse_loc parameter. If none of the warehouses there have any inventory, then the
260
	preferred warehouse for the item is used. 
1157 rajveer 261
 
3355 chandransh 262
	Returns an ordered list of size 4 with following elements in the given order:
263
	1. Logistics location of the warehouse which was finally picked up to ship the order.  
264
	2. Id of the warehouse which was finally picked up.
265
	3. Inventory size in the selected warehouse.
266
	4. Expected delay added by the category manager.
646 chandransh 267
	 */
268
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
3355 chandransh 269
 
121 ashish 270
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 271
 
272
	/**
273
	 Returns the warehouse with the given id.
274
	*/
121 ashish 275
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
276
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 277
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
278
 
862 chandransh 279
	/**
280
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
281
	*/
282
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
283
 
284
	/**
285
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
286
	*/
287
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
288
 
502 rajveer 289
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 290
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 291
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 292
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
293
 
294
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 295
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 296
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
297
 
2975 chandransh 298
	/**
299
	Returns a list of items sorted in the descending order by start date.
300
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
301
	*/
588 chandransh 302
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 303
 
304
	/**
305
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
306
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
307
	*/
308
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
309
 
310
	/**
311
	Get the total number of latest arrivals we are willing to show.
312
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
313
	*/
632 rajveer 314
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
315
 
1157 rajveer 316
 
317
	i64 generateNewEntityID(),
318
 
319
	/**
1343 chandransh 320
	Returns the pricing information of an item associated with the vendor of the given warehouse.
321
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
322
	*/
4283 anupam.sin 323
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 vendorId) throws (1:InventoryServiceException cex),
1343 chandransh 324
 
325
	/**
1157 rajveer 326
	* Store category object and retrieve it
327
	*/
1967 rajveer 328
	/**
632 rajveer 329
	bool putCategoryObject(1:binary object),
330
	binary getCategoryObject()
1967 rajveer 331
	*/
332
 
333
	/**
334
	* All category related functions
335
	*/
336
	bool addCategory(1:Category category),
337
	Category getCategory(1:i64 id),
1990 ankur.sing 338
	list<Category> getAllCategories(),
1967 rajveer 339
 
1990 ankur.sing 340
	/**
341
	Returns the list of vendor pricing information of an item.
342
	Raises an exception if item not found corresponding to itemId
343
	*/
344
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
345
 
346
 
347
	/**
2113 ankur.sing 348
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 349
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
350
	*/
2113 ankur.sing 351
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 352
 
2063 ankur.sing 353
	/**
354
	Return list of all vendors
355
	*/
2113 ankur.sing 356
	list<Vendor> getAllVendors(), 
2063 ankur.sing 357
 
2113 ankur.sing 358
	/**
359
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
360
	vendor and category.
361
	Returns true if it exists else false.
362
	*/
363
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
364
 
365
	/**
2356 ankur.sing 366
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 367
	*/
2356 ankur.sing 368
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 369
 
370
	/**
371
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
372
	Raises an exception if item not found corresponding to itemId
373
	*/
374
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
375
 
376
	/**
377
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
378
	If yes, returns the itemId else returns 0
379
	*/
2284 ankur.sing 380
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
381
 
382
	/**
383
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
384
	*/
2356 ankur.sing 385
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
386
 
387
	/**
388
	Returns list of items marked as risky.
389
	*/
390
	list<Item> getItemsByRiskyFlag(),
391
 
392
	/**
393
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
394
	Raises exception if vendorCategory is null. 
395
	*/
2807 rajveer 396
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
397
 
398
	/**
399
	Returns list of catalog ids of items with same similarity index as of the given itemId 
400
	*/
401
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 402
 
403
	/**
404
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
405
	*/
3086 rajveer 406
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 407
 
3086 rajveer 408
	/**
409
		Send the product notifications to the users for items which has stock.
410
	*/
3348 varun.gupt 411
	bool sendProductNotifications(),
3079 rajveer 412
 
3348 varun.gupt 413
	/**
414
		Returns list of brand names for a given category Id
415
	*/
3556 rajveer 416
	list<string> getAllBrandsByCategory(1:i64 categoryId),
417
 
418
	/**
419
	Return list of all sources
420
	*/
421
	list<Source> getAllSources(), 
422
 
423
	/**
424
	Returns the pricing information of an item. If no information is found, exception will be thrown.
425
	*/
426
	SourceItemPricing getItemPricingBySource(1:i64 itemId, 2:i64 sourceId) throws (1:InventoryServiceException cex),
427
 
428
	/**
429
	Adds prices to be displayed corresponding to the item if user comes from a source.
430
	If item is not found or source is not found, it will throw exception.
431
	*/
432
	void addSourceItemPricing(1:SourceItemPricing sourceItemPricing) throws (1:InventoryServiceException cex),
433
 
434
	/**
435
	Returns the list of source pricing information of an item.
436
	Raises an exception if item not found corresponding to itemId
437
	*/
438
	list<SourceItemPricing> getAllSourcePricing(1:i64 itemId) throws (1:InventoryServiceException cex),
439
 
440
	/**
441
	Get the item for a given itemId and sourceId. MRP and sellingPrice will be updated for source if we have different prices for source.
442
	*/
3872 chandransh 443
	Item getItemForSource(1:i64 item_id, 2:optional i64  sourceId) throws (1:InventoryServiceException cex),
444
 
445
	/**
446
	Searches items matching the the given terms in the catalog and returns results within the specified range.
447
	*/
448
	list<Item> searchItemsInRange(1:list<string> searchTerms, 2:i64 offset, 3:i64 limit),
449
 
450
	/**
451
	Gets the count of search results for the given search terms so that the user can go through all the pages.
452
	*/
4024 chandransh 453
	i32 getSearchResultCount(1:list<string> searchTerms),
454
 
455
	/**
4063 chandransh 456
	Returns a list of inventory stock for items for which there are pending orders for the given vendor.
4024 chandransh 457
	*/
4295 varun.gupt 458
	list<AvailableAndReservedStock> getPendingOrdersInventory(1:i64 vendorid),
459
 
460
	/**
461
	Returns a list of product notifications added after a supplied datetime
462
	*/
463
	list<ProductNotificationRequest> getProductNotifications(1:i64 startDateTime),
464
 
465
	/**
466
	Returns a list of count of requests for product notification against each item
467
	*/
468
	list<ProductNotificationRequestCount> getProductNotificationRequestCount(1:i64 startDateTime)
4370 anupam.sin 469
 
470
	/**
471
	This method creates a purchase order from an excel sheet containing Item Id and Quantity column and returns the PO Id.
472
	*/
473
	string processPurchaseOrder(1:string filename 2:i32 vendorId) throws (1:InventoryServiceException cex)
4295 varun.gupt 474
}