Subversion Repositories SmartDukaan

Rev

Rev 3374 | Rev 3848 | 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,
2841 chandransh 57
	12:i64 vendorId,
58
	13:BillingType billingType
85 ashish 59
}
115 ashish 60
/* */
85 ashish 61
struct ItemInventory{
62
	1:i64 id,
483 rajveer 63
	2:map<i64,i64> availability
85 ashish 64
}
65
 
483 rajveer 66
 
85 ashish 67
struct ItemInventoryHistory{
68
	1:i64 item_id,
69
	2:i64 warehouse_id,
70
	3:i64 timestamp,
71
	4:i64 availability
72
}
73
 
74
struct Item{
75
	1:i64 id,
956 chandransh 76
	2:string productGroup
77
	3:string brand,
78
	4:string modelNumber,
2128 ankur.sing 79
	5:string modelName,
80
	6:string color,
81
	7:i64 category,
82
	8:string comments,
83
	9:i64 catalogItemId,
84
	10:i64 featureId,
85
	11:string featureDescription,
86
	12:ItemInventory itemInventory,
2127 ankur.sing 87
	13:optional double mrp, //maxmimum retail price
2491 ankur.sing 88
	14:optional double mop, //market operative price
2127 ankur.sing 89
	15:optional double sellingPrice, //Selling price
2491 ankur.sing 90
	16:optional double transferPrice,
2127 ankur.sing 91
	17:optional double weight,
2128 ankur.sing 92
	18:i64 addedOn,
2491 ankur.sing 93
	19:optional i64 startDate,
94
	20:optional i64 retireDate,
720 chandransh 95
	21:status itemStatus,
2128 ankur.sing 96
	22:string status_description,
97
	23:map<string,string> otherInfo,
98
	24:string bestDealText,
2127 ankur.sing 99
	25:optional double bestDealValue,
2491 ankur.sing 100
	26:optional double dealerPrice,
2128 ankur.sing 101
	27:bool defaultForEntity,
102
	28:i64 updatedOn,
2127 ankur.sing 103
	29:optional i64 bestSellingRank, 
2249 ankur.sing 104
	30:string hotspotCategory,
3355 chandransh 105
	31:bool risky,
3359 chandransh 106
	32:optional i32 expectedDelay,
3361 chandransh 107
	33:optional string preferredWarehouse
85 ashish 108
}
109
 
1343 chandransh 110
struct VendorItemPricing{
1349 chandransh 111
	1:i64 vendorId,
112
	2:i64 itemId,
1343 chandransh 113
	3:double transferPrice,
114
	4:double mop,
115
	5:double dealerPrice
116
}
117
 
1967 rajveer 118
struct Category{
119
	1:i64 id,
120
	2:string label,
121
	3:string description,
122
	4:i64 parent_category_id,
123
	/**
124
	* This field should not be used.
125
	*/
126
	5:list<i64> children_category_ids
127
}
2113 ankur.sing 128
 
129
struct VendorItemMapping{
130
	1:i64 vendorId,
131
	2:string itemKey,
132
	3:i64 itemId,
133
	4:string vendorCategory
134
}
2983 chandransh 135
 
136
struct ItemShippingInfo{
137
	1:bool isActive,
138
	2:optional bool isRisky,
139
	3:optional i64 quantity
140
}
141
 
3556 rajveer 142
struct Source{
143
	1:i64 id,
144
	2:string name,
145
	3:string identifier
146
}
147
 
148
struct SourceItemPricing{
149
	1:i64 sourceId,
150
	2:i64 itemId,
151
	3:double mrp,
152
	4:double sellingPrice
153
}
154
 
121 ashish 155
exception InventoryServiceException{
85 ashish 156
	1:i64 id,
157
	2:string message
158
}
159
 
3374 rajveer 160
service InventoryService extends GenericService.GenericService{
763 rajveer 161
 
85 ashish 162
/**
163
	Availability and inventory attributes	
164
*/
165
	//all add and update methods - added by Ashish
123 ashish 166
	i64 addItem(1:Item item) throws (1:InventoryServiceException cex),
167
	i64 updateItem(1:Item item) throws (1:InventoryServiceException cex),
121 ashish 168
	i64 addWarehouse(1:Warehouse warehouse) throws (1:InventoryServiceException cex),
2983 chandransh 169
 
170
	/**
171
	Checks if the item given to the corresponding itemId is active. If it's active,
172
	whether it's risky and if it's risky, its inventory position.
173
	*/
174
	ItemShippingInfo isActive(1:i64 itemId) throws (1:InventoryServiceException isex),
175
 
2033 rajveer 176
	string getItemStatusDescription(1:i64 itemId) throws (1:InventoryServiceException isex),
3323 chandransh 177
 
178
	/**
179
	Stores the incremental warehouse updates of items.
180
	*/
181
	void updateInventoryHistory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
182
 
183
	/**
184
	Stores the final inventory stocks of items.
185
	*/
483 rajveer 186
	void updateInventory(1:i64 warehouse_id, 2:string timestamp, 3:map<string, i64> availability) throws (1:InventoryServiceException cex),
2983 chandransh 187
 
103 ashish 188
	//all delete methods
121 ashish 189
	void retireWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
103 ashish 190
 
191
	//Item management apis
121 ashish 192
	void startItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
193
	void retireItemOn(1:i64 item_id, 2:i64 timestamp) throws (1:InventoryServiceException cex),
194
	void changeItemStatus(1:i64 item_id, 2:i64 timestamp, 3:status newstatus) throws (1:InventoryServiceException cex),
85 ashish 195
	//Other accessor methods - added by Ashish
121 ashish 196
	Item getItem(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 197
	list<Item> getItemsByCatalogId(1:i64 catalog_item_id) throws  (1:InventoryServiceException cex),
121 ashish 198
	list<Item> getAllItems(1:bool isActive) throws (1:InventoryServiceException cex),
199
	list<Item> getAllItemsByStatus(1:status itemStatus) throws (1:InventoryServiceException cex),
200
	ItemInventory getItemInventory(1:i64 item_id) throws (1:InventoryServiceException cex),
632 rajveer 201
	ItemInventory getItemInventoryByItemId(1:i64 item_id) throws (1:InventoryServiceException cex),
202
	//ItemInventory getItemInventoryByCatalogId(1:i64 item_id) throws (1:InventoryServiceException cex),
121 ashish 203
	i64 getItemAvailibilityAtWarehouse(1:i64 warehouse_id, 2:i64 item_id) throws (1:InventoryServiceException cex),
2076 rajveer 204
	bool markItemAsContentComplete(1:i64 entityId, 2:i64 category, 3:string brand, 4:string modelName, 5:string modelNumber) throws (1:InventoryServiceException cex),
646 chandransh 205
 
3355 chandransh 206
	/**
207
	Determines the warehouse that should be used to fulfil an order for the given item.
208
	It first checks all the warehouses which are in the logistics location given by the
209
	warehouse_loc parameter. If none of the warehouses there have any inventory, then the
210
	preferred warehouse for the item is used. 
1157 rajveer 211
 
3355 chandransh 212
	Returns an ordered list of size 4 with following elements in the given order:
213
	1. Logistics location of the warehouse which was finally picked up to ship the order.  
214
	2. Id of the warehouse which was finally picked up.
215
	3. Inventory size in the selected warehouse.
216
	4. Expected delay added by the category manager.
646 chandransh 217
	 */
218
	list<i64> getItemAvailabilityAtLocation(1:i64 warehouse_loc, 2:i64 item_id) throws (1:InventoryServiceException isex),
3355 chandransh 219
 
121 ashish 220
	list<Warehouse> getAllWarehouses(1:bool isActive) throws (1:InventoryServiceException cex),
1343 chandransh 221
 
222
	/**
223
	 Returns the warehouse with the given id.
224
	*/
121 ashish 225
	Warehouse getWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
226
	list<Warehouse> getAllWarehousesForItem(1:i64 item_id) throws (1:InventoryServiceException cex),
502 rajveer 227
	list<Item> getAllItemsForWarehouse(1:i64 warehouse_id) throws (1:InventoryServiceException cex),
228
 
862 chandransh 229
	/**
230
	 Increases the reservation count for an item in a warehouse. Should always succeed normally.
231
	*/
232
	bool reserveItemInWarehouse(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
233
 
234
	/**
235
	 Decreases the reservation count for an item in a warehouse. Should always succeed normally.
236
	*/
237
	bool reduceReservationCount(1:i64 itemId, 2:i64 warehouseId, 3:double quantity) throws (1:InventoryServiceException cex),
238
 
502 rajveer 239
	// for home page .... best deals, best sellers and latest arrivals
588 chandransh 240
	list<Item> getBestSellers() throws (1:InventoryServiceException isex),
1924 rajveer 241
	list<i64> getBestSellersCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 242
	i64 getBestSellersCount() throws (1:InventoryServiceException cex),
243
 
244
	list<Item> getBestDeals() throws (1:InventoryServiceException isex),
1924 rajveer 245
	list<i64> getBestDealsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:i64 category) throws (1:InventoryServiceException cex),
588 chandransh 246
	i64 getBestDealsCount() throws (1:InventoryServiceException cex),
247
 
2975 chandransh 248
	/**
249
	Returns a list of items sorted in the descending order by start date.
250
	The list is limited to the 'latest_arrivals_count' configuraiton parameter.
251
	*/
588 chandransh 252
	list<Item> getLatestArrivals() throws (1:InventoryServiceException isex),
2975 chandransh 253
 
254
	/**
255
	Returns the list of catalog ids of latest arrivals in the given categories of the given brand.
256
	To ignore the categories, pass the list as empty. To ignore brand, pass it as null.   
257
	*/
258
	list<i64> getLatestArrivalsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:string brand, 4:list<i64> categories) throws (1:InventoryServiceException cex),
259
 
260
	/**
261
	Get the total number of latest arrivals we are willing to show.
262
	The count's upper bound is the 'latest_arrivals_count' configuraiton parameter.
263
	*/
632 rajveer 264
	i64 getLatestArrivalsCount() throws (1:InventoryServiceException cex),
265
 
1157 rajveer 266
 
267
	i64 generateNewEntityID(),
268
 
269
	/**
1343 chandransh 270
	Returns the pricing information of an item associated with the vendor of the given warehouse.
271
	Raises an exception if either the item, vendor or the associated pricing information can't be found.
272
	*/
273
	VendorItemPricing getItemPricing(1:i64 itemId, 2:i64 warehouseId) throws (1:InventoryServiceException cex),
274
 
275
	/**
1157 rajveer 276
	* Store category object and retrieve it
277
	*/
1967 rajveer 278
	/**
632 rajveer 279
	bool putCategoryObject(1:binary object),
280
	binary getCategoryObject()
1967 rajveer 281
	*/
282
 
283
	/**
284
	* All category related functions
285
	*/
286
	bool addCategory(1:Category category),
287
	Category getCategory(1:i64 id),
1990 ankur.sing 288
	list<Category> getAllCategories(),
1967 rajveer 289
 
1990 ankur.sing 290
	/**
291
	Returns the list of vendor pricing information of an item.
292
	Raises an exception if item not found corresponding to itemId
293
	*/
294
	list<VendorItemPricing> getAllItemPricing(1:i64 itemId) throws (1:InventoryServiceException cex),
295
 
296
 
297
	/**
2113 ankur.sing 298
	Adds vendor prices corresponding to the item. If pricing already exists then updates the prices. 
1990 ankur.sing 299
	Raises an exception if either the item or vendor can't be found corresponding to their ids.
300
	*/
2113 ankur.sing 301
	void addVendorItemPricing(1:VendorItemPricing vendorItemPricing) throws (1:InventoryServiceException cex),
1990 ankur.sing 302
 
2063 ankur.sing 303
	/**
304
	Return list of all vendors
305
	*/
2113 ankur.sing 306
	list<Vendor> getAllVendors(), 
2063 ankur.sing 307
 
2113 ankur.sing 308
	/**
309
	Checks if the item exists in VendorItemMapping for the given hotspot parameters (ProductGroup,Brand,ModelNumber,Color),
310
	vendor and category.
311
	Returns true if it exists else false.
312
	*/
313
	bool itemExists(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color, 5:i64 vendor_id, 6:string category),
314
 
315
	/**
2356 ankur.sing 316
	Adds VendorItemMapping. Updates VendorItemMapping if exists corresponding to the item key.  
2113 ankur.sing 317
	*/
2356 ankur.sing 318
	void addVendorItemMapping(1:string key, 2:VendorItemMapping vendorItemMapping) throws (1:InventoryServiceException cex),
2113 ankur.sing 319
 
320
	/**
321
	Returns the list of vendor item mapping corresponding to itemId passed as parameter.
322
	Raises an exception if item not found corresponding to itemId
323
	*/
324
	list<VendorItemMapping> getVendorItemMappings(1:i64 itemId) throws (1:InventoryServiceException cex),
325
 
326
	/**
327
	Checks if similar item exists (with same ProductGroup, Brand, ModelNumber, Color)
328
	If yes, returns the itemId else returns 0
329
	*/
2284 ankur.sing 330
	i64 checkSimilarItem(1:string productGroup, 2:string brand, 3:string modelNumber, 4:string color),
331
 
332
	/**
333
	Marks/Unmarks an item as risky. This flag is used for automatic marking of an item as INACTIVE in case of zero inventory.
334
	*/
2356 ankur.sing 335
	void changeItemRiskyFlag(1:i64 itemId, 2:bool risky),
336
 
337
	/**
338
	Returns list of items marked as risky.
339
	*/
340
	list<Item> getItemsByRiskyFlag(),
341
 
342
	/**
343
	Returns list of items with any status except PHASED_OUT and filtered by vendor category.
344
	Raises exception if vendorCategory is null. 
345
	*/
2807 rajveer 346
	list<Item> getItemsByVendorCategory(1:string vendorCategory),
347
 
348
	/**
349
	Returns list of catalog ids of items with same similarity index as of the given itemId 
350
	*/
351
	list<i64> getSimilarItemsCatalogIds(1:i64 beginIndex, 2:i64 totalItems, 3:i64 itemId),
3079 rajveer 352
 
353
	/**
354
	Add user requests for out of stock items. Once user will ask for notify me an entry will 
355
	*/
3086 rajveer 356
	bool addProductNotification(i64 itemId, string email),
3079 rajveer 357
 
3086 rajveer 358
	/**
359
		Send the product notifications to the users for items which has stock.
360
	*/
3348 varun.gupt 361
	bool sendProductNotifications(),
3079 rajveer 362
 
3348 varun.gupt 363
	/**
364
		Returns list of brand names for a given category Id
365
	*/
3556 rajveer 366
	list<string> getAllBrandsByCategory(1:i64 categoryId),
367
 
368
	/**
369
	Return list of all sources
370
	*/
371
	list<Source> getAllSources(), 
372
 
373
	/**
374
	Returns the pricing information of an item. If no information is found, exception will be thrown.
375
	*/
376
	SourceItemPricing getItemPricingBySource(1:i64 itemId, 2:i64 sourceId) throws (1:InventoryServiceException cex),
377
 
378
	/**
379
	Adds prices to be displayed corresponding to the item if user comes from a source.
380
	If item is not found or source is not found, it will throw exception.
381
	*/
382
	void addSourceItemPricing(1:SourceItemPricing sourceItemPricing) throws (1:InventoryServiceException cex),
383
 
384
	/**
385
	Returns the list of source pricing information of an item.
386
	Raises an exception if item not found corresponding to itemId
387
	*/
388
	list<SourceItemPricing> getAllSourcePricing(1:i64 itemId) throws (1:InventoryServiceException cex),
389
 
390
	/**
391
	Get the item for a given itemId and sourceId. MRP and sellingPrice will be updated for source if we have different prices for source.
392
	*/
393
	Item getItemForSource(1:i64 item_id, 2:optional i64  sourceId) throws (1:InventoryServiceException cex)
85 ashish 394
}
395