Subversion Repositories SmartDukaan

Rev

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